赞
踩
运行 HDFS 命令,总是出现恼人的
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
- # hdfs dfs -ls /
- 23/02/24 16:00:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
- Found 2 items
- drwxr-xr-x - yunwei supergroup 0 2023-02-24 14:39 /hbase
- drwxr-xr-x - yunwei supergroup 0 2023-02-24 14:55 /usr
这个警告是说,Hadoop 没有成功加载你电脑的本地库,所以使用了内置的 Java 类库。
本地库的作用:提升一些操作的性能(Java 不够快),并且弥补 Java 类库的不足,Hadoop 为某些组件提供了自己的本地实现,保存在一个独立的动态链接的库里,在 类 Uinux 平台上名为 libhadoop.so。
1.首先进入目录查看
- # ll /data/apps/hadoop/lib/native/
- total 5360
- -rw-rw-r-- 1 yunwei yunwei 1370614 Oct 3 2016 libhadoop.a
- -rw-rw-r-- 1 yunwei yunwei 1934326 Oct 3 2016 libhadooppipes.a
- lrwxrwxrwx 1 yunwei yunwei 18 Oct 3 2016 libhadoop.so -> libhadoop.so.1.0.0
- -rwxrwxr-x 1 yunwei yunwei 798496 Oct 3 2016 libhadoop.so.1.0.0
- -rw-rw-r-- 1 yunwei yunwei 650580 Oct 3 2016 libhadooputils.a
- -rw-rw-r-- 1 yunwei yunwei 443766 Oct 3 2016 libhdfs.a
- lrwxrwxrwx 1 yunwei yunwei 16 Oct 3 2016 libhdfs.so -> libhdfs.so.0.0.0
- -rwxrwxr-x 1 yunwei yunwei 280368 Oct 3 2016 libhdfs.so.0.0.0
目录下确实没有这个文件,到hadoop的目录下
- # grep -R 'java.library.path' *
- bin/yarn: YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
- bin/yarn.cmd: set YARN_OPTS=%YARN_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
- etc/hadoop/yarn-env.cmd: set YARN_OPTS=%YARN_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
- etc/hadoop/yarn-env.sh: YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
- libexec/hadoop-config.sh:# setup 'java.library.path' for native-hadoop code if necessary
- libexec/hadoop-config.sh: HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
- libexec/hadoop-config.cmd:@rem setup 'java.library.path' for native hadoop code if necessary
- libexec/hadoop-config.cmd: set HADOOP_OPTS=%HADOOP_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
- share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-4458. Warn if java.library.path is used for AM or Task
- share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-4072. User set java.library.path seems to overwrite default
- share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-3259. Added java.library.path of NodeManager to
果然发现有定义这个参数,到哪没有具体指定,除了在配置文件中指定外,在主机的~/.bash_profile指定参数也是一样的。
- # vi ~/.bash_profile
-
-
- export JAVA_LIBRARY_PATH=/data/apps/hadoop/lib/native
-
- # source ~/.bash_profile
到此,执行hadoop的命令已无警告
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。