Linux下zookeeper的搭建

饮水思源:https://www.cnblogs.com/expiator/p/9853378.html

下载:

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz 

wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

解压:tar -zxvf zookeeper-3.4.14.tar.gz

进入解压后的 conf 目录: cd zookeeper-3.4.14/conf

复制配置文件:cp zoo_sample.cfg zoo.cfg

编辑配置文件:vi zoo.cfg    如果不能编辑,配置读写可执行权限:chmod 7 zoo.cfg

dataDir=/usr/local/zookeeper/zookeeper-3.4.14/data

dataLogDir=/usr/local/zookeeper/zookeeper-3.4.14/log

创建上边配置的目录:

cd /usr/local/zookeeper/zookeeper-3.4.14/

mkdir data

mkdir log

配置环境变量:

export ZOOKEEPER_INSTALL=/usr/local/zookeeper/zookeeper-3.4.14/

export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

进入bin目录启动zk

服务端启动:./zkServer.sh start

客户端启动:./zkCli.sh 

安装完成,可以操作了!

阿里云伪集群爬坑:

一直选举节点的时候拒绝连接,安全组的出入也都配置了,就是不通,蛋疼,最后将IP改为127.0.0.1后居然通了,why!!!

配置如下:


tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/zookeeper-3.4.14/data
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.14/log
clientPort=2181
maxClientCnxns=60
server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3882
server.3=127.0.0.1:2883:3883

posted @ 2019-11-08 16:50  小哥的吃喝玩乐  阅读(249)  评论(0编辑  收藏  举报