【Apache ZooKeeper】安装文档

安装zookeeper
版本:3.4.5+23-1.cdh4.4.0.p0.24~precise-cdh4.4.0 
在虚拟机Storage3: 192.168.255.133

首先添加cloudera源到ubuntu12.04 server 64位中

vi /etc/apt/sources.list.d/cloudera.list

deb [arch=amd64] http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh precise-cdh4 contrib 
deb-src http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh precise-cdh4 contrib
获取key
$ curl -s http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh/archive.key | sudo apt-key add -
安装

apt-get install zookeeper zookeeper-server

若不能通过apt-get方式安装,则需要如下deb包,使用dpkg安装:

bigtop-utils_0.6.0+140-1.cdh4.4.0.p0.24~precise-cdh4.4.0_all.deb
libapr1_1.4.6-1_amd64.deb
libaprutil1_1.3.12+dfsg-3_amd64.deb
liblog4cxx10_0.10.0-1.2ubuntu2_amd64.deb
libzookeeper-mt2_3.3.5+dfsg1-1ubuntu1_amd64.deb
zookeeper_3.4.5+23-1.cdh4.4.0.p0.24~precise-cdh4.4.0_all.deb
zookeeper-bin_3.3.5+dfsg1-1ubuntu1_amd64.deb
zookeeper-server_3.4.5+23-1.cdh4.4.0.p0.24~precise-cdh4.4.0_all.deb

安装完成后在/usr/lib/zookeeper/bin文件夹下可以使用C语言或Java语言的ZooKeeper客户端。

修改配置文档
vi /etc/zookeeper/conf/zoo.cf
修改以下两个字段
dataDir=/var/lib/zookeeper
dataLogDir=/var/log/zookeeper
如果没有这两个目录就自己创建,创建完再修改木兰的owner为zookeeper:zookeeper
初始化
service zookeeper-server init --myid=1
如果初始化失败可以强制初始化
service zookeeper-server init --myid=1 --force

启动

ZooKeeper三台机器都配好了,在自己的机器上通过secureCRT登录就可以了。三台机器已经实现了同步。
在安装好ZooKeeper之后要使用bash /usr/lib/zookeeper/bin/zkServer.sh start来启动ZooKeeper,而不是直接
用service方式启动。

service zookeeper-server restart
参考文档:
http://archive.cloudera.com/cdh4/cdh/4/zookeeper/zookeeperAdmin.html
http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/4.2.0/CDH4-Installation-Guide/cdh4ig_topic_4_4.html
http://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html

http://blog.csdn.net/Apache012/article/details/9265707

http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper/

你可能感兴趣的:(【Apache ZooKeeper】安装文档)