安装JDK
yum install -y java-1.8.0-openjdk
安装ZooKeeper
下载
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
tar -zxvf zookeeper-3.4.10.tar.gz
配置zoo.cfg
cp conf/zoo_sample.cfg conf/zoo.cfg
vi conf/zoo.cfg
修改(本)
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/data/solr/zookeeper
# the port at which the clients will connect
clientPort=2181
server.211=dt211.corp:2888:3888
server.212=0.0.0.0:2888:3888
server.214=dt214.corp:2888:3888
创建数据目录和myid
mkdir /data/solr/zookeeper
vi /data/solr/zookeeper/myid
myid 文件中只有一个数字,与server id对应
212
防火墙配置
firewall-cmd --permanent --add-port=2181/tcp
firewall-cmd --permanent --add-port=2888/tcp
firewall-cmd --permanent --add-port=3888/tcp
firewall-cmd --reload
同步到其它机器
修改zoo.cfg,本机IP地址:0.0.0.0
启动集群
启动
bin/zkServer.sh start
查看状态
bin/zkServer.sh status
停止
bin/zkServer.sh stop
异常处理
1.java.net.ConnectException: 拒绝连接 (Connection refused)
本机IP要改成0.0.0.0,无法识别别名,127.0.0.1也只能有一台