首页 > 代码库 > zookeeper 安装

zookeeper 安装

下载地址:

http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz

解压:tar -zxvf zookeeper-3.3.6.tar.gz

进入zookeeper 解压目录: cd zookeeper-3.3.6/

创建zookper 数据目录:  mkdir data

进入zookeeper 的配置目录: cd conf

编辑文件:vim zoo.cfg

写入如下: 

tickTime=2000

dataDir=/root/soft/zookeeper-3.3.6/data

clientPort=2181

initLimit=5

syncLimit=2

server.1=air00:2888:3888  

server.2=air01:2888:3888 

server.3=air02:2888:3888

 进入zookeeper 数据目录:cd  /root/soft/zookeeper-3.3.6/data

  运行:echo "1"> myid  ##因为是第一个服务器,所以写入1,第二个则写入2,第三个则写入3

运行:

bin/zkServer.sh start

显示:

[root@air00 zookeeper-3.3.6]# bin/zkServer.sh start

JMX enabled by default

Using config: /root/soft/zookeeper-3.3.6/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

[root@air00 zookeeper-3.3.6]# jps

9597 Jps

9578 QuorumPeerMain (zookeeper 的进程)


 bin/zkCli.sh -server air00:2181 启动zookeeper 客户端




zookeeper 安装