[root@hdp2 /root]#hadoop checknative -a
18/12/09 00:31:19 WARN bzip2.Bzip2Factory: Failed to load/initialize native-bzip2 library system-native, will use pure-Java version
18/12/09 00:31:19 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
Native library checking:
hadoop: true /mnt/software/hadoop-2.6.0-cdh5.7.0/lib/native/libhadoop.so.1.0.0
zlib: true /lib64/libz.so.1
snappy: true /mnt/software/hadoop-2.6.0-cdh5.7.0/lib/native/libsnappy.so.1
lz4: true revision:99
bzip2: false
openssl: true /lib64/libcrypto.so
18/12/09 00:31:19 INFO util.ExitUtil: Exiting with status 1
不支持bzip2
解决方案
1 按照bzip2包
yum -y install bzip2-devel
2 安装成功后 重新编译Hadoop 到Hadoop源码目录下
mvn package -Pdist,native -DskipTests -Dtar -Djavax.net.debug=all
3 编译完之后 检查 是否编译成功
strings ~/build/hadoop-2.6.0-cdh5.7.0/hadoop-dist/target/hadoop-2.6.0-cdh5.7.0/lib/native/libhadoop.so | grep initIDs
看到有bzip2信息表示成功
4 拷贝编译好的native下文件 替换
cp ~/build/hadoop-2.6.0-cdh5.7.0/hadoop-dist/target/hadoop-2.6.0-cdh5.7.0/lib/native/* /mnt/software/hadoop-2.6.0-cdh5.7.0/lib/native/
5 然后 再次执行Hadoop checknative -a
[root@hdp1 /mnt/software/hadoop-2.6.0-cdh5.7.0/lib]#hadoop checknative -a
解决问题