hadoop 日常问题汇总(持续更新)
问题描述:
每次执行hadoop的shell命令时均出现如下警告:
[hadoop@MyDB01 ~]$ hadoop fs -ls /
16/09/25 07:59:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
问题定位:
用ldd命令查看依赖库
[hadoop@MyDB01 native]$ ldd libhadoop.so
./libhadoop.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./libhadoop.so)
linux-vdso.so.1 => (0x00007ffff3837000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa27ce68000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa27cad3000)
/lib64/ld-linux-x86-64.so.2 (0x000000333de00000)
[hadoop@MyDB01 native]$ ldd libhadoop.so.1.0.0
./libhadoop.so.1.0.0: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./libhadoop.so.1.0.0)
linux-vdso.so.1 => (0x00007fff4b9ff000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f2a22745000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2a223b0000)
/lib64/ld-linux-x86-64.so.2 (0x000000333de00000)
[hadoop@MyDB01 native]$
看到报错,GLIBC_2.14找不到,现在检查系统的glibc库, ldd --version即可检查:
[hadoop@MyDB01 native]$ ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
由 Roland McGrath 和 Ulrich Drepper 编写。
[hadoop@MyDB01 native]$
原来系统预装的glibc库是2.12版本,而hadoop期望是2.14版本,所以打印警告信息。
解决方案:
第一个办法重新编译glibc重新编译glibc.2.14版本,安装后专门给hadoop使用,这个有点危险。
第二个办法直接在log4j日志中去除告警信息。在//usr/local/hadoop/etc/hadoop/log4j.properties文件中添加
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR
参考:http://blog.csdn.net/l1028386804/article/details/51538611
如何查看识别hadoop是32位还是64位:hadoop-2.6.0
[hadoop@MyDB01 native]$ pwd
/usr/local/hadoop/lib/native
[hadoop@MyDB01 native]$ ls
libhadoop.a libhadoop.so libhadooputils.a libhdfs.so
libhadooppipes.a libhadoop.so.1.0.0 libhdfs.a libhdfs.so.0.0.0
[hadoop@MyDB01 native]$ file libhadoop.so.1.0.0
libhadoop.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
[hadoop@MyDB01 native]$