Zookeeper
下载安装包
mkdir -p /opt/zookeeper /opt/zookeeper/data /opt/zookeeper/dataLog
cd /opt/zookeeper
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz --no-check-certificate
关于 --no-check-certificate
因为网站限制了只能用浏览器下载文件,如果不添加该参数可能会遇到以下问题。
- 错误1:
错误1可以通过下面的命令解决ERROR: cannot verify apache.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’: Issued certificate has expired.
yum install -y ca-certificates
- 错误2:
错误2可以通过添加代理参数user-agent解决,例如:Unable to establish SSL connection.
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz --user-agent="Mozilla/5.0 (X11;U;Linux i686;en-US;rv:1.9.0.3) Geco/2008092416 Firefox/3.0.3"
解压
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
ln -s apache-zookeeper-3.8.3-bin zookeeper
修改配置
cd /opt/zookeeper/zookeeper/conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
注释
#dataDir=/tmp/zookeeper
添加
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/dataLog
启动,查看状态,停止,重启
cd /opt/zookeeper/zookeeper/bin
启动
./zkServer.sh start
查看状态
./zkServer.sh status
停止
./zkServer.sh stop
重启
./zkServer.sh restart
查看日志
cd /opt/zookeeper/zookeeper/logs
客户端 zkCli.sh
cd /opt/zookeeper/zookeeper/bin
./zkCli.sh
执行上面的命令后,会进入对话框
查看目录
ls /
ls /zookeeper
ls /dubbo
get /dubbo
编辑目录
#创建了一个新的 znode 节点 zk 以及与它关联的字符串
create /zk "myData"
#修改值
set /zk "newVal"
#删除
delete /zk