问题描述
我目前正在运行 CentOs 的服务器上配置 hadoop.当我运行 start-dfs.sh
或 stop-dfs.sh
时,出现以下错误:
I'm currently configuring hadoop on a server running CentOs. When I run start-dfs.sh
or stop-dfs.sh
, I get the following error:
WARN util.NativeCodeLoader: 无法加载 native-hadoop 库您的平台...在适用的情况下使用内置 Java 类
我正在运行 Hadoop 2.2.0.
在网上进行搜索会找到这个链接:http://balanceandbreath.blogspot.ca/2013/01/utilnativecodeloader-unable-to-load.html
Doing a search online brought up this link: http://balanceandbreath.blogspot.ca/2013/01/utilnativecodeloader-unable-to-load.html
然而,hadoop 2.x 上 /native/
目录的内容似乎不同,所以我不知道该怎么做.
However, the contents of /native/
directory on hadoop 2.x appear to be different so I am not sure what to do.
我还在hadoop-env.sh
中添加了这两个环境变量:
I've also added these two environment variables in hadoop-env.sh
:
导出 HADOOP_OPTS="$HADOOP_OPTS-Djava.library.path=/usr/local/hadoop/lib/"
导出 HADOOP_COMMON_LIB_NATIVE_DIR="/usr/local/hadoop/lib/native/"
export HADOOP_COMMON_LIB_NATIVE_DIR="/usr/local/hadoop/lib/native/"
有什么想法吗?
推荐答案
我假设您在 64 位 CentOS 上运行 Hadoop.您看到该警告的原因是本机 Hadoop 库 $HADOOP_HOME/lib/native/libhadoop.so.1.0.0
实际上是在 32 位上编译的.
I assume you're running Hadoop on 64bit CentOS. The reason you saw that warning is the native Hadoop library $HADOOP_HOME/lib/native/libhadoop.so.1.0.0
was actually compiled on 32 bit.
无论如何,这只是一个警告,不会影响 Hadoop 的功能.
Anyway, it's just a warning, and won't impact Hadoop's functionalities.
如果你确实想消除这个警告,这里是一种方法,下载Hadoop的源代码并在64位系统上重新编译libhadoop.so.1.0.0
,然后替换32位的.
Here is the way if you do want to eliminate this warning, download the source code of Hadoop and recompile libhadoop.so.1.0.0
on 64bit system, then replace the 32bit one.
此处包含有关如何为 Ubuntu 重新编译源代码的步骤:
Steps on how to recompile source code are included here for Ubuntu:
祝你好运.
这篇关于Hadoop“无法为您的平台加载本机Hadoop库"警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!