以下笔记为简略记录,详细实战内容待补充。
zookeeper高度可靠的分布式协调框架。【下载,解压安装zookeeper】
http://archive.cloudera.com/cdh5/
【配置zookeeper】
dataDir=/opt/modules/zookeeper-3.4.5-cdh5.10.0/zkData
server.1=data1.zeal.name:2888:3888
server.2=data2.zeal.name:2888:3888
server.3=data3.zeal.name:2888:3888
[zeal@data1 zkData]$ touch myid
[zeal@data1 zkData]$ vi myid
【启动zoo服务】
[zeal@data3 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh start
[zeal@data2 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh start
[zeal@data1 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh start
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[zeal@data1 zookeeper-3.4.5-cdh5.10.0]$ jps
2350 Jps
2332 QuorumPeerMain
[zeal@data1 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh status
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Mode: follower
【客户端连接测试】
[zeal@data1 zookeeper-3.4.5-cdh5.10.0]$ bin/zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 1] create /zeal zou
Created /zeal
[zk: localhost:2181(CONNECTED) 2] ls /
[zeal, zookeeper]
[zk: localhost:2181(CONNECTED) 3] get /zeal
zou
[zk: localhost:2181(CONNECTED) 4] quit
补充:zookeeper集群部署遵循2n+1原则(n可损坏机器数量)
[zeal@data1 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh stop
[zeal@data2 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh stop
[zeal@data3 zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh stop
Copyright ©2017-2024 uzen.zone
湘ICP备17013178号-3