linux安装zookeeper3.6.1
-
下载 zookeeper3.6.1
(下载页面https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz)
下载:
wget https://mirrors.bfsu.edu.cn/apache/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
解压:
tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz -
创建配置文件
cd apache-zookeeper-3.6.1-bin/conf/
cp zoo_sample.cfg zoo.cfg -
启动服务
cd …
cd bin/
./zkServer.sh start
常用命令:
启动: ./zkServer.sh start
启动查看日志: ./zkServer.sh start-foreground
重启: ./zkServer.sh restart
停止: ./zkServer.sh stop
查看状态: ./zkServer.sh status
连接zk: zkCli.sh -server 127.0.01
查询节点: ls /
删除节点:
delete /path/a/b (一层一层删除)
rmr /path
创建: create /test testdata
获取: get /test
问题
启动zk遇到问题:
1.异常日志: Unable to start AdminServer, exiting abnormally
org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
解决方法:
vim zoo.cfg
新增 admin.serverPort=12181