Building Alluxio From Source
Last updated
Last updated
This guide describes how to clone the Alluxio repository, compile the source code, and run tests in your environment.
Alternatively, we have published a docker image with Java, Maven, and Git pre-installed to help build Alluxio source code.
Checkout the Alluxio master branch from Github:
By default, cloning the repository will check out the master branch. If you are looking to build a particular version of the code you may check out the version using a git tag.
This section guides you to setup pre-configured compilation environment based on our published docker image. You can skip this section and build Alluxio source code if JDK and Maven are already installed locally.
Start a container named alluxio-build
based on this image and get into this container to proceed:
Note that,
Container path /alluxio
is mapped to host path ${ALLUXIO_HOME}
, so the binary built will still be accessible outside the container afterwards.
Container path /root/.m2
is mapped to host path ${HOME}/.m2
to leverage your local copy of the maven cache. This is optional.
When done using the container, destroy it by running
Build the source code using Maven:
To speed up the compilation, you can run the following instruction to skip different checks:
The Maven build system fetches its dependencies, compiles source code, runs unit tests, and packages the system. If this is the first time you are building the project, it can take a while to download all the dependencies. Subsequent builds, however, will be much faster.
Once Alluxio is built, you can validate and start it with:
You should be able to see the result Passed the test!
You can stop the local Alluxio system by using:
Since Alluxio 1.7, Alluxio client jar built and located at {{site.ALLUXIO_CLIENT_JAR_PATH}}
will work with different compute frameworks (e.g., Spark, Flink, Presto and etc) by default.
By default, Alluxio is built with the HDFS under storage of Hadoop 3.3. Run the following command by specifying <UFS_HADOOP_PROFILE>
and the corresponding ufs.hadoop.version
to build ufs with different versions.
Here <UFS_HADOOP_VERSION>
can be set for different distributions. Available Hadoop profiles include ufs-hadoop-1
, ufs-hadoop-2
, ufs-hadoop-3
to cover the major Hadoop versions 1.x, 2.x and 3.x.
Hadoop versions >= 3.0.0 are best for compatibility with newer releases of Alluxio.
For example,
If you find a jar named alluxio-underfs-hdfs-<UFS_HADOOP_VERSION>-{{site.ALLUXIO_VERSION_STRING}}.jar
under ${ALLUXIO_HOME}/lib
, it indicates successful compilation.
Checkout the flags for different HDFS distributions.
If you are seeing java.lang.OutOfMemoryError: Java heap space
, please set the following variable to increase the memory heap size for maven:
If you see following error message by maven: "An error occurred while running protolock: Cannot run program "/alluxio/core/transport/target/protolock-bin/protolock" (in directory "/alluxio/core/transport/target/classes"): error=2, No such file or directory
"
please make sure the maven flag "-Dskip.protoc
" is NOT included when building the source code.
If you see following error message by maven like below: "Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create-metadata (default) on project alluxio-core-common: Execution default of goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create-metadata failed.: NullPointerException
"
Because the build number is based on the revision number retrieved from SCM, it will check build number from git hash code. If check failed, SCM will throw NPE. To avoid the exception, please set the alluxio version with maven parameter "-Dmaven.buildNumber.revisionOnScmFailure
".
For example, if the alluxio version is 2.7.3 then set parameter "-Dmaven.buildNumber.revisionOnScmFailure=2.7.3
".
See https://www.mojohaus.org/buildnumber-maven-plugin/create-mojo.html#revisionOnScmFailure for more infomation.
To verify that Alluxio is running, you can visit or check the log in the alluxio/logs
directory. The worker.log
and master.log
files will typically be the most useful. It may take a few seconds for the web server to start. You can also run a simple program to test that data can be read and written to Alluxio's UFS:
To enable active sync be sure to build using the hdfsActiveSync
property. Please visit for more information on using active sync.