1、错误描述
当在Hadoop sbin目录下执行start-dfs.sh脚本的时候,出现报错17:52:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable Starting namenodes on [wh301]
$ ./start-dfs.sh
17/03/15 17:52:29 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
Starting namenodes on [wh301]
wh301: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-namenode-wh301.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hadoop-datanode-wh301.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-secondarynamenode-wh301.out
17/03/15 17:52:47 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
2、分析
这是由于hadoop-2.6.0.tar.gz安装包是在32位机器上编译的,在64位的机器安装此包后,当加载本地库.so文件时就会出现版本不一致的情况。
3、解决
我的建议是下载相关的64位lib库进行替换lib目录下的原native目录,位置是/usr/local/hadoop/lib/native。(如果你的安装目录和我的一致的话)
tar -x hadoop-native-64-2.6.0.tar -C /usr/local/hadoop/lib/native/
[hadoop@wh301 native]$ ls -ltr
total 4356
-rwxr-xr-x. 1 hadoop hadoop 228435 Dec 2 2014 libhdfs.so.0.0.0
-rw-r–r–. 1 hadoop hadoop 359458 Dec 2 2014 libhdfs.a
-rwxr-xr-x. 1 hadoop hadoop 671189 Dec 2 2014 libhadoop.so.1.0.0
-rw-r–r–. 1 hadoop hadoop 1119486 Dec 2 2014 libhadoop.a
-rw-r–r–. 1 hadoop hadoop 581944 Dec 2 2014 libhadooputils.a
-rw-r–r–. 1 hadoop hadoop 1486964 Dec 2 2014 libhadooppipes.a
lrwxrwxrwx. 1 hadoop hadoop 18 Mar 15 17:55 libhadoop.so -> libhadoop.so.1.0.0
lrwxrwxrwx. 1 hadoop hadoop 16 Mar 15 17:55 libhdfs.so -> libhdfs.so.0.0.0
[hadoop@wh301 native]$ pwd
/usr/local/hadoop/lib/native
[hadoop@wh301 sbin]$ ./start-dfs.sh
Starting namenodes on [wh301]
wh301: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-namenode-wh301.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hadoop-datanode-wh301.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-secondarynamenode-wh301.out
可以看到,错误解决了。
如果你是hadoop2.6版本就可以右键下载: