1、修改操作系统的/etc/hosts文件,添加IP与主机名映射:
# vim /etc/hosts
#zookeeper cluster server
192.168.1.135 server-zk-01
192.168.1.135 server-zk-02
192.168.1.135 server-zk-03
2、下载安装zookeeper
wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
tar -zxvf zookeeper-3.4.8.tar.gz
cd ./zookeeper-3.4.8
cp -R zookeeper-3.4.8 zookeeper-node-01
mkdir data
mkdir
logs
将zookeeper-node-01/conf目录下的zoo_sample.cfg文件拷贝一份,命名为为zoo.cfg
cp zoo_sample.cfg zoo.cfg
修改zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/home/leantaot/zookeeper/zookeeper-node-01/data
dataLogDir=/home/leantaot/zookeeper/zookeeper-node-01/logs
clientPort=2181
server.1=leantaot-zk-01:2881:3881
server.2=leantaot-zk-02:2882:3882
server.3=leantaot-zk-03:2883:3883
3、创建myid文件
4、启动zookeeper
zkServer.sh start
zkServer.sh status
zkServer.sh stop
连接zookeeper(server-zk-01为/etc/hosts配置的hostname)
zkCli.sh -server server-zk-01:2181
5、dubbo配置方式
dubbo.registry.address=zookeeper://192.168.1.135:2181?backup=192.168.1.135:2182,192.168.1.135:2183
参考
https://my.oschina.net/wushuicheng/blog/518196
http://blog.csdn.net/icoudsoft_saas/article/details/50429390
http://blog.csdn.net/shirdrn/article/details/7183503/
关注公众号获取海量视频:
- class='magplus' title='点击查看原始大小图片' />
- 大小: 39.9 KB