Zookeeper安装

来源:互联网 发布:intent传递数据 编辑:程序博客网 时间:2024/06/02 05:10

参考官方文档:http://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html

zookeeper完全分布式的安装

1、下载zookeeper-3.4.6
2、解压到安装目录
3、编辑配置文件{ZOOKEEPER_HOME/conf/zoo.cfg}
dataDir:指定内存数据库的路径
server.x中序号是为了区分zookeeper集群,当zookeeper集群启动, 会在myid文件找到对应的序号。

[chb@TEST conf]$ cat zoo.cfg tickTime=2000dataDir=/usr/local/zookeeper-3.4.6/zookeeperclientPort=2181initLimit=5syncLimit=2server.1=TEST:2888:3888server.2=TEST1:2888:3888server.3=TEST2:2888:3888[chb@TEST conf]$ 

tickTime
  the basic time unit in milliseconds used by ZooKeeper. It is used to do heartbeats and the minimum session timeout will be twice
dataDir
  the location to store the in-memory database snapshots and, unless specified otherwise, the transaction log of updates to the database.
clientPort
  the port to listen for client connection

4、创建myid文件, 对应server.x的序号

这里写图片描述

5、将zookeeper配置到环境变量中

添加如下:

#zookeeperexport ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6export PATH=$PATH:$ZOOKEEPER_HOME/bin

使/etc/profile有效:

source /etc/profile

6、启动zookeeper server

zkServer.sh start

7、会在当前目录下生成一个zookeeper.out的日志文件:

确保没有错误出现

8、查看zookeeper的内存数据库

这里写图片描述

9问题:zookeeper错误记录一;Cannot open channel to 2 at election address s1ave1/192.168.10.225:3888 java.net.Connection.

修改zookeeper配置如下:

端口

server.1=192.168.10.224:2878:3878server.2=192.168.10.225:2898:3898server.3=192.168.10.226:2889:3889clientPort=3384
0 0
原创粉丝点击