[Hadoop] - Protocol Buffer安装

Hadoop从2.x版本开始,底层的RPC远程调用使用ProtocolBuffer格式来传递数据,所以在编译Hadoop的过程中有可能出现提示缺少Protocol服务的异常信息,类似:'protoc --version' did not return a version,具体异常如下:

解决方案即安装对应版本的Protocol Buffer服务

安装步骤如下:

============================================================

一、选择对应版本

ProtocolBuffer官方地址为:https://developers.google.com/protocol-buffers/

Google的所有插件/软件的代码管理全部放到了GitHub上,所以源码相关的下载路径为:https://github.com/google/protobuf

其中Hadoop对ProtoBuf的版本要求一般为[2.5,+), 也就是最少是2.5的版本(hadoop内部使用的是2.5的版本),故这里介绍2.5版本的安装

 

二、软件下载

方式一:进行源码编译

下载对应版本的源码,可以通过git进行源码的下载,然后进行tag的切换,再进行源码编译,最后进行编译好的文件安装操作;但是这个步骤中在进行源码编译的时候,由于需要从Google的服务器下载一些服务,国内的网络基本上没法下载成功,故该方式建议大家不要使用

方式二:直接下载编译的压缩包进行安装(半编译)

对应版本的介绍地址:https://github.com/google/protobuf/releases/tag/v2.5.0

下载地址:https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

下载命令:wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

 

三、软件安装(安装用户root)

1. cd /opt/softwares

2. wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

3. tar -zxvf ./protobuf-2.5.0.tar.gz -C /opt/modules

4. cd /opt/modules/protobuf-2.5.0

5. ./configure

6. make

7. make install

8. protoc --version 

 

四、其他

在安装过程中需要依赖gcc编译环境,所以如果您的环境没有安装过gcc,建议在安装前先安装gcc编译环境

yum install -y autoconf automake libtool curl make g++ unzip

 

==========================================

备注:

安装环境:

  centos 6.5 64位 1核2G

 

posted @ 2017-02-27 15:12  liuming_1992  阅读(2280)  评论(0编辑  收藏  举报