-
宿主机:Windows 11
-
虚拟机:VMware Pro 17
[muyi@hadoop103 lib]$ hostnamectl
Static hostname: hadoop103
Icon name: computer-vm
Chassis: vm
Machine ID: 05ae79827e67409f906ab7a8593446b4
Boot ID: aa61d0ca03764cb7a878fe3c14944d99
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.119.1.el7.x86_64
Architecture: x86-64
- hadoop版本: 3.1.3
问题描述
在我编写了一个hadoop启停脚本并使用它时,在启动过程中出现了下面这个警告
util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
NativeCodeLoader:无法为您的平台加载本机hadoop库。。。在适用的情况下使用内置的java类
这个警告通常不会阻止 Hadoop 的正常运行,但它可能意味着 Hadoop 无法利用某些性能优化。
解决
在hadoop下/etc/hadoop/hadoop-env.sh
文件下第92行
后面添加下方配置:
export HADOOP_OPTS="-Djava.library.path=${HADOOP_HOME}/lib/native"
重新启动脚本后,警告没有再出现了!
以防后续出现其他问题,将更改过的文件分发到其他主机上
[muyi@hadoop102 hadoop]$ xsync hadoop-env.sh
==================== hadoop102 ====================
sending incremental file list
sent 64 bytes received 12 bytes 50.67 bytes/sec
total size is 15,972 speedup is 210.16
==================== hadoop103 ====================
sending incremental file list
hadoop-env.sh
sent 968 bytes received 173 bytes 760.67 bytes/sec
total size is 15,972 speedup is 14.00
==================== hadoop104 ====================
sending incremental file list
hadoop-env.sh
sent 968 bytes received 173 bytes 2,282.00 bytes/sec
total size is 15,972 speedup is 14.00
[muyi@hadoop102 hadoop]$