If the native library is not used, you will get warning shown as follows:
WARN util.NativeCodeLoader: Unable to load native-hadoop library ...We can compile hadoop from src to utilize the native library. The following steps can help you do so:
- Download hadoop src and untar the source code.
- Go to the src code directory and run the following compile command:
- Copy the compiled native library files to your working hadoop native library folder.
- Add the following two lines into your $HADOOP_HOME/etc/hadoop/hadoop-env.sh file
- No need to restart hadoop daemons and your native libraries will be used and the warning will be gone.
mvn package -Pdist,native -DskipTests -DtarIf the compilation is successful, we can find the native library files under directory ./hadoop-dist/target/hadoop-2.2.0/lib/native
cp hadoop-dist/target/hadoop-2.2.0/lib/native/* $HADOOP_HOME/lib/native
export HADOOP_COMMON_LIB_NATIVE_DIR="$HADOOP_HOME/lib/native" export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$HADOOP_HOME/lib/native"