本文演示windows10环境zookeeper伪集群模式安装,linux安装参考:https://dubbo.apache.org/zh/docs/v2.7/admin/install/zookeeper/
1、zookeeper下载地址:
http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.6.2/apache-zookeeper-3.6.2-bin.tar.gz
2、下载之后解压,复制三份
D:softzookeeper-clusterapache-zookeeper-3.6.2-12181
D:softzookeeper-clusterapache-zookeeper-3.6.2-12182
D:softzookeeper-clusterapache-zookeeper-3.6.2-12183
3、拷贝D:softzookeeper-clusterapache-zookeeper-3.6.2-12181confzoo_sample.cfg到当前目录,命名为拷贝D:softzookeeper-clusterapache-zookeeper-3.6.2-12181confzoo.cfg
修改zoo.cfg配置,节点1配置
tickTime=2000 initLimit=5 syncLimit=2 dataDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12181\data dataLogDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12181\logs clientPort=2181 server.1=127.0.0.1:2182:3800 server.2=127.0.0.1:2183:3801 server.3=127.0.0.1:2184:3802
节点2配置
tickTime=2000 initLimit=5 syncLimit=2 dataDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12182\data dataLogDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12182\logs clientPort=2182 server.1=127.0.0.1:2182:3800 server.2=127.0.0.1:2183:3801 server.3=127.0.0.1:2184:3802
节点3配置
tickTime=2000 initLimit=5 syncLimit=2 dataDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12183\data dataLogDir=D:\soft\zookeeper-cluster\apache-zookeeper-3.6.2-12183\logs clientPort=2183 server.1=127.0.0.1:2182:3800 server.2=127.0.0.1:2183:3801 server.3=127.0.0.1:2184:3802
4、创建myid文件
在D:softzookeeper-clusterapache-zookeeper-3.6.2-12181data目录下创建myid文件,文件内容1
在D:softzookeeper-clusterapache-zookeeper-3.6.2-12182data目录下创建myid文件,文件内容2
在D:softzookeeper-clusterapache-zookeeper-3.6.2-12183data目录下创建myid文件,文件内容3
以节点1为例,如下图:
5、启动zookeeper集群
依次启动三个节点
D:softzookeeper-clusterapache-zookeeper-3.6.2-12181inzkServer.sh start;
D:softzookeeper-clusterapache-zookeeper-3.6.2-12182inzkServer.sh start;
D:softzookeeper-clusterapache-zookeeper-3.6.2-12183inzkServer.sh start;
6、验证
telnet localhost 2181
telnet localhost 2182
telnet localhost 2183
7、zkui安装
下载地址:git clone https://github.com/DeemOpen/zkui.git
8、zkui编译
mvn clean install
9、zkui启动
编译后,将zkui-2.0-SNAPSHOT-jar-with-dependencies.jar和config.cfg文件拷贝到D:softzookeeper-clusterzkui目录
执行启动命令:java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar
10、ziui预览
打开浏览器,输入:http://localhost:9090/login,默认用户名密码:admin/manager,账号配置在config.cfg文件下。
登录后