I'm currently configuring hadoop on a server running CentOs. When I run start-dfs.sh
or stop-dfs.sh
, I get the following error:
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
I'm running Hadoop 2.2.0.
Doing a search online brought up this link: http://balanceandbreath.blogspot.ca/2013/01/utilnativecodeloader-unable-to-load.html
However, the contents of /native/
directory on hadoop 2.x appear to be different so I am not sure what to do.
I've also added these two environment variables in hadoop-env.sh
:
export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=/usr/local/hadoop/lib/"
export HADOOP_COMMON_LIB_NATIVE_DIR="/usr/local/hadoop/lib/native/"
Any ideas?
Verified remedy from earlier postings:
1) Checked that the
libhadoop.so.1.0.0
shipped with the Hadoop distribution was compiled for my machine architecture, which is x86_64:2) Added
-Djava.library.path=<path>
toHADOOP_OPT
inhadoop-env.sh
:This indeed made the annoying warning disappear.
In addition to @zhutoulala accepted answer, here is an update to make it work with latest stable version to date (2.8) on ARMHF platforms (Raspberry Pi 3 model B). First I can confirm that you must recompile native libraries to 64 bit ARM, other answers here based on setting some environment variables won't work. As indicated in Hadoop documentation, the pre-built native libraries are 32 bit.
High level steps given in the fist link (http://www.ercoppa.org/posts/how-to-compile-apache-hadoop-on-ubuntu-linux.html) are correct. On this url http://www.instructables.com/id/Native-Hadoop-260-Build-on-Pi/ you get more details specific to Raspberry Pi, but not for Hadoop version 2.8.
Here are my indications pour Hadoop 2.8 :
CMake file patching method must be changed. Moreovere, files to patch are not the same. Unfortunately, there is no accepted patch on JIRA specific to 2.8. On this URL (https://issues.apache.org/jira/browse/HADOOP-9320) you must copy and paste Andreas Muttscheller proposed patch on your namenode :
Once build is successful :
And replace the content of the lib/native directory of your Hadoop install with the content of this archive. Warning message when running Hadoop should disappear.
In my case , after I build hadoop on my 64 bit Linux mint OS, I replaced the native library in
hadoop/lib
. Still the problem persist. Then I figured out the hadoop pointing tohadoop/lib
not to thehadoop/lib/native
. So I just moved all content from native library to its parent. And the warning just gone.Firstly: You can modify the glibc version.CentOS provides safe softwares tranditionally,it also means the version is old such as glibc,protobuf ...
You can compare the version of current glibc with needed glibc.
Secondly: If the version of current glibc is old,you can update the glibc. DownLoad Glibc
If the version of current glibc id right,you can append word native to your HADOOP_OPTS
Just append word native to your
HADOOP_OPTS
like this:PS: Thank Searene