Sunday, March 16, 2014

Building your first Accumulo tar file

The goal of this tutorial is for you to be able to run Accumulo in your environment and to be able to contribute to it. In order to do that you need to know how to build Accumulo tar file from the source code. So let's get to it:

Create a directory where you want to store Accumulo source code and use git clone command to pull the latest and greatest. For example,
$ sudo mkdir /opt/accumulo/source
$ git clone https://git-wip-us.apache.org/repos/asf/accumulo.git

(please refer to this page for up to date link to the Accumulo git repository, under Source Code)

Navigate to Accumulo source code directory and review its contents files via your favorite IDE.

When you are ready to build your Accumulo tar file, execute following commands

$ cd path/to/accumulo
$ mvn package -P assemble


Depending on your machine it can take some time, but eventually you shall see something like this if everything went well.

[INFO] Reactor Summary:
[INFO]
[INFO] Apache Accumulo ................................... SUCCESS [01:00 min]
[INFO] Trace ............................................. SUCCESS [ 16.735 s]
[INFO] Fate .............................................. SUCCESS [  5.040 s]
[INFO] Start ............................................. SUCCESS [01:47 min]
[INFO] Core .............................................. SUCCESS [02:03 min]
[INFO] Simple Examples ................................... SUCCESS [ 17.305 s]
[INFO] Server Base ....................................... SUCCESS [ 16.004 s]
[INFO] GC Server ......................................... SUCCESS [  3.220 s]
[INFO] Master Server ..................................... SUCCESS [  7.238 s]
[INFO] Tablet Server ..................................... SUCCESS [ 17.611 s]
[INFO] MiniCluster ....................................... SUCCESS [01:38 min]
[INFO] Monitor Server .................................... SUCCESS [  4.857 s]
[INFO] Native Libraries .................................. SUCCESS [ 13.424 s]
[INFO] Tracer Server ..................................... SUCCESS [  1.992 s]
[INFO] Accumulo Maven Plugin ............................. SUCCESS [ 25.701 s]
[INFO] Testing ........................................... SUCCESS [01:03 min]
[INFO] Proxy ............................................. SUCCESS [ 28.249 s]
[INFO] Assemblies ........................................ SUCCESS [ 11.505 s]
[INFO] Documentation ..................................... SUCCESS [  0.126 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:26 min
[INFO] Finished at: 2014-03-01T02:40:37-05:00
[INFO] Final Memory: 95M/276M
[INFO] ------------------------------------------------------------------------


Congrats! You just built your first Accumulo tar file that is ready to be deployed! Navigate to assemble/target/ directory to find your file. It should look something like this: accumulo-1.6.0-bin.tar.gz

Now let's see how we can pull code from different branches and see if there were any updates. Switch to you accumulo directory and check if you have anything new to commit

[root@localhost accumulo]# git status
# On branch master
nothing to commit (working directory clean)


Now let's see if there were any new updates to the code by someone else since your last check out

[root@localhost accumulo]# git pull
Already up-to-date.


Seems like everything is up to date... If you experience issues with git pull command, make sure that remote site is linked properly so git knows where to pull the data from

[root@localhost accumulo]# git remote add origin https://git-wip-us.apache.org/repos/asf/accumulo.git

Now, you probably don't want to make your changes against master branch... In order to switch branches execute

[root@localhost accumulo]# git pull origin 1.6.0-SNAPSHOT

This should give you 1.6.0 development branch of Accumulo

To find out entire list of available ranches

[root@localhost assemble]# git branch -a
  1.6.0-SNAPSHOT
* master
  remotes/origin/1.4.5-SNAPSHOT
  remotes/origin/1.5.2-SNAPSHOT
  remotes/origin/1.6.0-SNAPSHOT
  remotes/origin/ACCUMULO-1000
  remotes/origin/ACCUMULO-1409
  remotes/origin/ACCUMULO-1566
  remotes/origin/ACCUMULO-2061
  remotes/origin/ACCUMULO-2442
  remotes/origin/ACCUMULO-578
  remotes/origin/ACCUMULO-652
  remotes/origin/ACCUMULO-672
  remotes/origin/ACCUMULO-722
  remotes/origin/ACCUMULO-802
  remotes/origin/ACCUMULO-CURATOR
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

-a shows all local and remote branches.

To create your own branch and switched to it at the same time, execute

[root@localhost assemble]# git checkout -b 1.6.0-SNAPSHOT-myown

This will come in handy when we are ready to contribute, which involve switching between different branches, creating our own feature branches and then committing it back.



No comments:

Post a Comment