WARN util.NativeCodeLoader: Unable to load native-hadoop library for your
platform... using builtin-java classes where applicable
是因為預設的 Hadoop 執行檔使用 32-bit x86 native libraries, 如果要解決這 warning 就要自己 build, 步驟如下
安裝 maven 還有很多後面編譯會用到的 lib
sudo apt-get install -y maven build-essential g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libfuse-dev libsnappy-dev libsnappy-java libbz2-dev
使用的 Java 版本
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
安裝 protobuf 2.5.0
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz下載 Hadoop 與 patch
tar zxvf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure --prefix=/usr
make
sudo make install
cd ~
wget ftp://apache.belnet.be/mirrors/ftp.apache.org/hadoop/common/hadoop-2.7.1/hadoop-2.7.1-src.tar.gz
tar -xvzf hadoop-2.7.1-src.tar.gz
安裝 patch
cd hadoop-2.7.1-src/hadoop-common-project/hadoop-common/src
wget https://issues.apache.org/jira/secure/attachment/12570212/HADOOP-9320.patch
patch < HADOOP-9320.patch
編譯 Hadoop, 在 Pi 3 大概要等一個半小時左右, 預設會安裝到 /opt 目錄下
cd ../../..
mvn package -Pdist,native -DskipTests -Dtar
將 native lib 複製到
cd hadoop-dist/target/hadoop-2.7.1/lib/native/
cp * /opt/hadoop-2.7.1/lib/native/
之後就和一般的 Hadoop 使用設定一樣了
reference:
* Building the native Hadoop library for Raspberry Pi's ARMv7 processor
沒有留言:
張貼留言