hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

你是无意穿堂风 偏偏孤倨引山洪

安装hadoop启动之后总有警告:
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第1张图片
问题示例

原因:
Apache提供的hadoop本地库是32位的,而在64位的服务器上就会有问题,因此需要自己编译64位的版本。
1 首先找到对应自己hadoop版本的64位的lib包,可以自己手动去编译,但比较麻烦,也可以去网上找,好多都有已经编译好了的。
2 可以去网站:http://dl.bintray.com/sequenceiq/sequenceiq-bin/ 下载对应的编译版本

hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第2张图片
下载对应的编译版本

注:
Hadoop 2.6.x 版本用hadoop-native-64-2.6.0.tar即可
Hadoop 2.7.x 版本用hadoop-native-64-2.7.0.tar即可

3 将准备好的64位的lib包解压到已经安装好的hadoop安装目录lib/native下

tar -xvf hadoop-native-64-2.6.0.tar -C native  
hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第3张图片
tar -xvf hadoop-native-64-2.6.0.tar -C native

4 然后增加环境变量:

sudo vi /etc/profile 

5 增加下面的内容:

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native  
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib/native"  
hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第4张图片
1

6 让环境变量生效

source /etc/profile  
hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第5张图片
source /etc/profile

7 自检hadoop checknative –a 指令检查

hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第6张图片
指令检查

问题成功解决:

hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable_第7张图片
image.png

世界上所有的追求都是因为热爱
一枚爱编码 爱生活 爱分享的IT信徒
— hongXkeX

你可能感兴趣的:(hadoop 问题解决 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable)