一 zookeeper的搭建
1.1 上传zkjar包
1.2 搭建配置
1.解压压缩包
[root@localhost export]# tar -zxvf zookeeper-3.7.0-bin.tar.gz
2.创建data文件夹
[root@localhost export]# cd apache-zookeeper-3.7.0-bin/
[root@localhost apache-zookeeper-3.7.0-bin]# ls
bin conf docs lib LICENSE.txt NOTICE.txt README.md README_packaging.md
[root@localhost apache-zookeeper-3.7.0-bin]# pwd
/root/export/apache-zookeeper-3.7.0-bin
[root@localhost apache-zookeeper-3.7.0-bin]# pwd
/root/export/apache-zookeeper-3.7.0-bin
[root@localhost apache-zookeeper-3.7.0-bin]# ls
bin conf docs lib LICENSE.txt NOTICE.txt README.md README_packaging.md
[root@localhost apache-zookeeper-3.7.0-bin]# mkdir -p data
[root@localhost apache-zookeeper-3.7.0-bin]# pwd
/root/export/apache-zookeeper-3.7.0-bin
3.修改配置
[root@localhost apache-zookeeper-3.7.0-bin]# ls
bin conf data docs lib LICENSE.txt NOTICE.txt README.md README_packaging.md
[root@localhost apache-zookeeper-3.7.0-bin]# cd conf
[root@localhost conf]# ls
configuration.xsl log4j.properties zoo_sample.cfg
[root@localhost conf]# mv zoo_sample.cfg zoo.cfg
[root@localhost conf]# ls
configuration.xsl log4j.properties zoo.cfg
[root@localhost conf]# pwd
/root/export/apache-zookeeper-3.7.0-bin/conf
4.通过vim修改配置文件夹,将dataDir 修改成刚才所建的data文件夹
1.3 启动zk服务
[root@localhost bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /root/export/apache-zookeeper-3.7.0-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /root/export/apache-zookeeper-3.7.0-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone
1.4 启动zk客户端
1.启动服务端
./zkCli.sh # 查看zk客户端
2.其它常用命令文章来源:https://www.toymoban.com/news/detail-752663.html
./zkServer.sh start
./zkServer.sh status # 查看启动状态
./zkServer.sh stop # 停止
./zkServer.sh restart # 重启文章来源地址https://www.toymoban.com/news/detail-752663.html
到了这里,关于zookeeper单机版的搭建的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!