-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcentos7安装zookeeper.txt
46 lines (31 loc) · 1.78 KB
/
centos7安装zookeeper.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
下载zookeeper
http://mirror.bit.edu.cn/apache/zookeeper/
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
mkdir /mnt/zookeeper
tar -xzvf zookeeper-3.4.6.tar.gz -C /mnt/zookeeper/
vim zoo.cfg
initLimit: zookeeper集群中的包含多台server, 其中一台为leader, 集群中其余的server为follower. initLimit参数配置初始化连接时, follower和leader之间的最长心跳时间. 此时该参数设置为5, 说明时间限制为5倍tickTime, 即5*2000=10000ms=10s.
syncLimit: 该参数配置leader和follower之间发送消息, 请求和应答的最大时间长度. 此时该参数设置为2, 说明时间限制为2倍tickTime, 即4000ms.
server.X=A:B:C 其中X是一个数字, 表示这是第几号server.
A是该server所在的IP地址. B配置该server和集群中的leader交换消息所使用的端口. C配置选举leader时所使用的端口.
由于配置的是伪集群模式, 所以各个server的B, C参数必须不同.
mkdir /mnt/zookeeper/zookeeper-3.4.6/data
mkdir /mnt/zookeeper/zookeeper-3.4.6/logs
在data目录下生成myid文件,写入服务器编号
vim /etc/profile
export ZOOKEEPER_HOME=/mnt/zookeeper/zookeeper-3.4.6
export PATH=${ZOOKEEPER_HOME}/bin:${PATH}
source /etc/profile
firewall-cmd --permanent --zone=public --add-port=2181/tcp
firewall-cmd --permanent --zone=public --add-port=2180/tcp
firewall-cmd --permanent --zone=public --add-port=3180/tcp
参考:
http://blog.csdn.net/huangjin0507/article/details/51645061
ZK客户端
https://github.com/DeemOpen/zkui
https://github.com/DeemOpen/zkui.git
1/mvn clean install
2/Copy the config.cfg to the folder with the jar file. Modify it to point to the zookeeper instance. Multiple zk instances are coma separated. eg: server1:2181,server2:2181. First server should always be the leader.
3/Run the jar. ( nohup java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar & )
4/http://localhost:9090
username: admin, pwd: manager