启动Hadoop文件系统时报错:util.NativeCodeLoader: Unable to load native-hadoop library for your platform..using

时间:2024-04-03 13:20:48

启动Hadoop文件系统时报错:

18/06/21 00:45:57 WARNutil.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

 

首先打开调试,查看具体的报错信息

在/etc/profile中,添加

Export HADOOP_ROOT_LOGGER=DEBUG,console

最后记得使配置生效:source /etc/profile

查看错误信息

 启动Hadoop文件系统时报错:util.NativeCodeLoader: Unable to load native-hadoop library for your platform..using

 

错误信息如下:Failed to load native-hadoop with error:java.lang.UnsatisfiedLinkError:/usr/soft/hadoop/hadoop-2.5.2/lib/native/libhadoop.so.1.0.0: /lib64/libc.so.6:version `GLIBC_2.14'

not found (required by/usr/soft/hadoop/hadoop-2.5.2/lib/native/libhadoop.so.1.0.0)

可以看到是因为系统的glibc版本太低,查看当前系统的glibc支持的所有版本

strings /lib64/libc.so.6 |grep GLIBC_

启动Hadoop文件系统时报错:util.NativeCodeLoader: Unable to load native-hadoop library for your platform..using

 

可以看到并不支持2.14的版本

本次下载的是glibc-2.14.tar.xz压缩包,解压到任意目录

[[email protected] glibc-2.14]# pwd

/usr/soft/glibc-2.14

[[email protected] glibc-2.14]# xz -dglibc-2.14.tar.xz

[[email protected] glibc-2.14]# tar xvfglibc-2.14.tar

[[email protected] glibc-2.14]# cd glibc-2.14

[[email protected] glibc-2.14]# mkdir build

[[email protected] glibc-2.14]# cd build

[[email protected] build]# ../configure --prefix=/opt/glibc-2.14

[[email protected] build]# make -j4

[[email protected] build]# sudo make install

[[email protected] build]# exportLD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH

[[email protected] build]# cp/opt/glibc-2.14/lib/libc-2.14.so /lib64/libc-2.14.so

[[email protected] build]# mv/lib64/libc.so.6 /lib64/libc.so.6.bak

[[email protected] build]#LD_PRELOAD=/lib64/libc-2.14.so ln -s /lib64/libc-2.14.so /lib64/libc.so.6

 

最后执行strings /lib64/libc.so.6 |grep GLIBC_,查看glibc是否更新

[[email protected] var]# strings/lib64/libc.so.6 |grep GLIBC_

启动Hadoop文件系统时报错:util.NativeCodeLoader: Unable to load native-hadoop library for your platform..using