在开启Hadoop的时候出现这个报错
[xkhadoop@xkhadoop sbin]$ hadoop fs -ls /
19/04/16 11:20:40 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
ls: Call From xkhadoop/192.168.40.133 to xkhadoop:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
报错问题是无法加载本地的Hadoop的库
参考博客:https://www.cnblogs.com/kevinq/p/5103653.html
[root@xkhadoop ~]# rpm -qa | grep glibc
glibc-devel-2.12-1.132.el6.x86_64
glibc-2.12-1.132.el6.x86_64
glibc-headers-2.12-1.132.el6.x86_64
glibc-common-2.12-1.132.el6.x86_64
首先先启动Hadoop,然后查询进程,发现编译包是2.12版本的,查询了一下资料,发现可能是由于编译包的版本太低导致的这个问题
所以先去下载glibc2.14的包
网址:http://ftp.ntu.edu.tw/gnu/glibc/
把下载的这两个文件传到虚拟机里面
[xkhadoop@xkhadoop glibc]$ rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring glibc-linuxthreads-2.5.tar.bz2...
100% 236 KB 236 KB/sec 00:00:01 0 Errors
Transferring glibc-2.14.tar.bz2...
100% 15264 KB 15264 KB/sec 00:00:01 0 Errors
[xkhadoop@xkhadoop glibc]$ ll
total 15508
-rw-r--r--. 1 xkhadoop xkhadoop 15630590 Apr 16 14:39 glibc-2.14.tar.bz2
-rw-r--r--. 1 xkhadoop xkhadoop 242445 Apr 16 14:39 glibc-linuxthreads-2.5.tar.bz2
[xkhadoop@xkhadoop glibc]$
然后解压这两个文件:
[xkhadoop@xkhadoop glibc]$ tar -xjvf glibc-2.14.tar.bz2
[xkhadoop@xkhadoop glibc]$ cd glibc-2.14
[xkhadoop@xkhadoop glibc-2.14]$ tar -xjvf ../glibc-linuxthreads-2.5.tar.bz2
把解压的两个文件全部都放到glibc-2.14这个文件夹里面
然后开始编译这两个文件:
[xkhadoop@xkhadoop glibc]$ glibc-2.14/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/xkhadoop/software/glibc':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[xkhadoop@xkhadoop glibc]$ make
make: *** No targets specified and no makefile found. Stop.
出现这个问题,发现虚拟机里面缺少gcc编译器:
需要在root用户下
[root@xkhadoop ~]# yum install -y gcc
然后执行:
[xkhadoop@xkhadoop glibc]$ glibc-2.14/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin --disable-sanity-checks
[xkhadoop@xkhadoop glibc]$ make
安装,必须root用户执行,执行很久
[root@xkhadoop glibc]# make install
查看是否安装成功:
[xkhadoop@xkhadoop glibc]$ ll /lib64/libc.so.6
lrwxrwxrwx. 1 root root 12 Apr 16 15:06 /lib64/libc.so.6 -> libc-2.14.so
最后重启hdfs
[xkhadoop@xkhadoop ~]$ cd app/hadoop-2.6.0-cdh5.7.0/sbin/
[xkhadoop@xkhadoop sbin]$ ./stop-all.sh
[xkhadoop@xkhadoop sbin]$ ./start-all.sh