一、修改操做系統的/etc/hosts文件,添加IP與主機名映射:node
# vim /etc/hostsspring
#zookeeper cluster serverapache
192.168.1.135 server-zk-01vim
192.168.1.135 server-zk-02學習
192.168.1.135 server-zk-03ui
二、下載安裝zookeeper操作系統
wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz.net
tar -zxvf zookeeper-3.4.8.tar.gz視頻
cd ./zookeeper-3.4.8server
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
三、建立myid文件
四、啓動zookeeper
zkServer.sh start
zkServer.sh status
zkServer.sh stop
鏈接zookeeper(server-zk-01爲/etc/hosts配置的hostname)
zkCli.sh -server server-zk-01:2181
五、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/
關注公衆號獲取各類學習視頻 spring dubbo