当前位置:   article > 正文

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin

warn util.nativecodeloader: unable to load native-hadoop library for your pl

运行 HDFS 命令,总是出现恼人的

 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items

  1. # hdfs dfs -ls /
  2. 23/02/24 16:00:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  3. Found 2 items
  4. drwxr-xr-x - yunwei supergroup 0 2023-02-24 14:39 /hbase
  5. drwxr-xr-x - yunwei supergroup 0 2023-02-24 14:55 /usr

这个警告是说,Hadoop 没有成功加载你电脑的本地库,所以使用了内置的 Java 类库。

本地库的作用:提升一些操作的性能(Java 不够快),并且弥补 Java 类库的不足,Hadoop 为某些组件提供了自己的本地实现,保存在一个独立的动态链接的库里,在 类 Uinux 平台上名为 libhadoop.so。

1.首先进入目录查看

  1. # ll /data/apps/hadoop/lib/native/
  2. total 5360
  3. -rw-rw-r-- 1 yunwei yunwei 1370614 Oct 3 2016 libhadoop.a
  4. -rw-rw-r-- 1 yunwei yunwei 1934326 Oct 3 2016 libhadooppipes.a
  5. lrwxrwxrwx 1 yunwei yunwei 18 Oct 3 2016 libhadoop.so -> libhadoop.so.1.0.0
  6. -rwxrwxr-x 1 yunwei yunwei 798496 Oct 3 2016 libhadoop.so.1.0.0
  7. -rw-rw-r-- 1 yunwei yunwei 650580 Oct 3 2016 libhadooputils.a
  8. -rw-rw-r-- 1 yunwei yunwei 443766 Oct 3 2016 libhdfs.a
  9. lrwxrwxrwx 1 yunwei yunwei 16 Oct 3 2016 libhdfs.so -> libhdfs.so.0.0.0
  10. -rwxrwxr-x 1 yunwei yunwei 280368 Oct 3 2016 libhdfs.so.0.0.0

目录下确实没有这个文件,到hadoop的目录下

  1. # grep -R 'java.library.path' *
  2. bin/yarn: YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  3. bin/yarn.cmd: set YARN_OPTS=%YARN_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
  4. etc/hadoop/yarn-env.cmd: set YARN_OPTS=%YARN_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
  5. etc/hadoop/yarn-env.sh: YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  6. libexec/hadoop-config.sh:# setup 'java.library.path' for native-hadoop code if necessary
  7. libexec/hadoop-config.sh: HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  8. libexec/hadoop-config.cmd:@rem setup 'java.library.path' for native hadoop code if necessary
  9. libexec/hadoop-config.cmd: set HADOOP_OPTS=%HADOOP_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
  10. share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-4458. Warn if java.library.path is used for AM or Task
  11. share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-4072. User set java.library.path seems to overwrite default
  12. share/doc/hadoop/mapreduce/CHANGES.txt: MAPREDUCE-3259. Added java.library.path of NodeManager to

果然发现有定义这个参数,到哪没有具体指定,除了在配置文件中指定外,在主机的~/.bash_profile指定参数也是一样的。

  1. # vi ~/.bash_profile
  2. export JAVA_LIBRARY_PATH=/data/apps/hadoop/lib/native
  3. # source ~/.bash_profile

 到此,执行hadoop的命令已无警告

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/387336
推荐阅读
相关标签
  

闽ICP备14008679号