zookeeper3.5.5集群部署

机器三台做集群

安装配置

下载zookeeper

http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz

解压zookeeper

tar xvf apache-zookeeper-3.5.5-bin.tar.gz
 $ cd apache-zookeeper-3.5.5-bin/
 $ cd conf/
 $ cp zoo_sample.cfg zoo.cfg 
 $ cat zoo.cfg 
 tickTime=2000
 initLimit=10
 syncLimit=5
 dataDir=/usr/local/apache-zookeeper-3.5.5-bin/tmp
 clientPort=2181
 server.1=10.190.200.110:2888:3888
 server.2=10.190.200.111:2888:3888
 server.3=10.190.200.112:2888:3888

然后拷贝到其它机器,修改下myid【每台机器myid要不同】。

$ mkdir  /usr/local/apache-zookeeper-3.5.5-bin/tmp
$ echo 1 >  /usr/local/apache-zookeeper-3.5.5-bin/tmp/myid ##第一台机器
$ echo 2 >  /usr/local/apache-zookeeper-3.5.5-bin/tmp/myid ##第二台机器
$ echo 3 >  /usr/local/apache-zookeeper-3.5.5-bin/tmp/myid ##第三台机器

启动

$ ../bin/zkServer.sh start

查看状态 测试

$  ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/soft/zookeeper-3.5.5/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

执行客户端测试

$ ./zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
	[zookeeper]
	[zk: localhost:2181(CONNECTED) 1] create /zoo hello
	Created /zoo
	[zk: localhost:2181(CONNECTED) 2] ls /
	[zoo, zookeeper]
	
再在其他服务器上使用zkCli.sh
可以查看到刚刚的操作数据
赞(2) 打赏
特别声明:除特殊标注,本站文章均为原创,遵循CC BY-NC 3.0,转载请注明出处。三伏磨 » zookeeper3.5.5集群部署

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏