如何重新编译hadoop源码
1. 下载hadoop源码(以2.7.2为例子)
https://github.com/apache/hadoop/tree/branch-2.7.2/hadoop-yarn-project/hadoop-yarn
2. 安装protobuf
- 下载release的repo: https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
- 执行以下命令
$ cd /usr/local/src/
$ tar xvf v2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./autogen.sh
$ ./configure --prefix=/usr
$ make
$ make install
$ protoc --version
- Install protobuf for java
$ cd java
$ mvn install
$ mvn package
3. 使用maven编译代码
maven clean package -DskipTests
maven install -DskipTests
编译完成后,把相应的包放在hadoop share文件中
4. 查看替换是否成功
从日志中查看是否替换成功(如:查看logs中nodemanager日志来确认,nodemanager jar包替换是否成功)