After installing Hadoop, the following warning will appear every time you enter a command:
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Stopping namenodes ...
Prompt hadoop can not load the local library.
You can go $HADOOP_HOME/lib/native
down and check the file libhadoop.so.1.0.0, which will display the number of Hadoop bits. The downloaded display from the official website is 64-bit, as shown below:
[hadoop@dxer hadoop-2.6.4]$ cd lib/native/
[hadoop@dxer native]$ ls
libhadoop.a libhadooppipes.a libhadoop.so libhadoop.so.1.0.0 libhadooputils.a libhdfs.a libhdfs.so libhdfs.so.0.0.0
[hadoop@dxer native]$ file libhadoop.so.1.0.0
libhadoop.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=b3b5e812c2a91fa4b28aa33eb76dc6889d3b91e9, not stripped
[hadoop@dxer native]$
The file and operating system are both 64-bit, so why does such a warning still appear? There must be some configuration missing and the library file is not loaded.
Only a simple configuration is required.
The configuration is as follows:
- First add the following configuration to bashrc:
vim ~/.bashrc
The configuration is as follows
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_HOME=/home/hadoop/hadoop-2.6.4
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib:$HADOOP_COMMON_LIB_NATIVE_DIR"
- Make the above configuration take effect:
source ~/.bashrc
ok, there will be no more prompts when you start dfs/yarn or run hadoop-related commands.
Author: digger30
Link: https://www.jianshu.com/p/f25a0caafcc6
Source: Jianshu The
copyright belongs to the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.