Building Alluxio From Source

    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 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.

    1. $ git checkout <TAG_NAME>

    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:

    1. --network=host \
    2. -v ${ALLUXIO_HOME}:/alluxio \
    3. -v ${HOME}/.m2:/root/.m2 \
    4. --name alluxio-build \
    5. alluxio/alluxio-maven bash
    6. $ docker exec -it -w /alluxio alluxio-build bash

    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

    1. $ docker rm -f alluxio-build

    Build

    Build the source code using Maven:

    1. $ mvn clean install -DskipTests

    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:

    1. $ # Alluxio uses ./underFSStorage for under file system storage by default
    2. $ mkdir ./underFSStorage
    3. $ ./bin/alluxio validateEnv local
    4. $ ./bin/alluxio-start.sh local SudoMount

    To verify that Alluxio is running, you can visit http://localhost:19999 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:

    1. $ ./bin/alluxio runTests

    You should be able to see the result Passed the test!

    You can stop the local Alluxio system by using:

    1. $ ./bin/alluxio-stop.sh local

    Build Options

    Since Alluxio 1.7, Alluxio client jar built and located at /<PATH_TO_ALLUXIO>/client/alluxio-2.5.0-client.jar 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.

    1. $ mvn install -pl underfs/hdfs/ \

    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.

    1. $ mvn clean install -pl underfs/hdfs/ \
    2. -Dmaven.javadoc.skip=true -DskipTests -Dlicense.skip=true \
    3. -Dcheckstyle.skip=true -Dfindbugs.skip=true \
    4. -Pufs-hadoop-2 -Dufs.hadoop.version=2.6.0

    If you find a jar named under ${ALLUXIO_HOME}/lib, it indicates successful compilation.

    Checkout the flags for different HDFS distributions.

    Apache

    All main builds are from Apache so all Apache releases can be used directly

    1. -Pufs-hadoop-1 -Dufs.hadoop.version=1.0.4
    2. -Pufs-hadoop-1 -Dufs.hadoop.version=1.2.0
    3. -Pufs-hadoop-2 -Dufs.hadoop.version=2.2.0
    4. -Pufs-hadoop-2 -Dufs.hadoop.version=2.3.0
    5. -Pufs-hadoop-2 -Dufs.hadoop.version=2.4.1
    6. -Pufs-hadoop-2 -Dufs.hadoop.version=2.5.2
    7. -Pufs-hadoop-2 -Dufs.hadoop.version=2.6.5
    8. -Pufs-hadoop-2 -Dufs.hadoop.version=2.7.3
    9. -Pufs-hadoop-2 -Dufs.hadoop.version=2.8.0
    10. -Pufs-hadoop-2 -Dufs.hadoop.version=2.9.0
    11. -Pufs-hadoop-3 -Dufs.hadoop.version=3.0.0

    Cloudera

    To build against Cloudera’s releases, just use a version like $apacheRelease-cdh$cdhRelease

    1. -Pufs-hadoop-2 -Dufs.hadoop.version=2.3.0-cdh5.1.0
    2. -Pufs-hadoop-2 -Dufs.hadoop.version=2.0.0-cdh4.7.0

    Hortonworks

    To build against a Hortonworks release, just use a version like $apacheRelease.$hortonworksRelease

    1. -Pufs-hadoop-2 -Dufs.hadoop.version=2.1.0.2.0.5.0-67
    2. -Pufs-hadoop-2 -Dufs.hadoop.version=2.2.0.2.1.0.0-92

    If you are seeing java.lang.OutOfMemoryError: Java heap space, please set the following variable to increase the memory heap size for maven:

    please make sure the maven flag “-Dskip.protoc” is NOT included when building the source code.