我正在尝试让Hadoop在Alpine Linux docker容器中加载本机库。我编译了库并安装了zlib和gzip。然后将共享对象放在/opt/hadoop/lib/native
中。
# ls /opt/hadoop/lib/native/
libhadoop.so libhdfs.so
然后将HADOOP_OPTS
更改为包括:
-Djava.library.path=/opt/hadoop/lib/native/
现在,当我运行hadoop checknative
时,我得到:
18/06/28 12:56:38 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Native library checking:
hadoop: false
zlib: false
snappy: false
lz4: false
bzip2: false
openssl: false
18/06/28 12:56:38 INFO util.ExitUtil: Exiting with status 1
运行ps -ef | grep hadoop
时,我得到:
251 root 0:00 / usr / lib / jvm / default-jvm / bin / java -Xmx1000m -Djava.net.preferIPv4Stack = true -Djava.library.path = / opt / hadoop / lib / native / -Dhadoop .log.dir = / opt / hadoop / logs -Dhadoop.log.file = hadoop.log -Dhadoop.home.dir = / opt / hadoop -Dhadoop.id.str = root -Dhadoop.root.logger = INFO,控制台-Dhadoop.policy.file = hadoop-policy.xml -Djava.net.preferIPv4Stack = true -Xmx512m -Dhadoop.security.logger = INFO,NullAppender org.apache.hadoop.util.NativeLibraryChecker
所以看起来好像那里的库,路径是正确的,但是Hadoop仍然没有看到它们。这是Hadoop 2.8.1。有什么想法吗?
更新:显然问题是:
# ldd /opt/hadoop-2.8.1/lib/native/libhadoop.so.1.0.0
ldd (0x7fe7463f7000)
libc.musl-x86_64.so.1 => ldd (0x7fe7463f7000)
Error relocating /opt/hadoop-2.8.1/lib/native/libhadoop.so.1.0.0: endnetgrent: symbol not found
Error relocating /opt/hadoop-2.8.1/lib/native/libhadoop.so.1.0.0: getnetgrent: symbol not found
Error relocating /opt/hadoop-2.8.1/lib/native/libhadoop.so.1.0.0: setnetgrent: symbol not found
所以我可能在编译过程中出错了,但是我不确定是什么错误。