CentOS7 ZooKeeper 集群部署

来源:互联网 发布:可靠性分析软件有哪些 编辑:程序博客网 时间:2024/05/16 12:51

安装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.gztar -zxvf zookeeper-3.4.10.tar.gz

官方地址:http://www.apache.org/dyn/closer.cgi/zookeeper/

配置zoo.cfg

cp conf/zoo_sample.cfg conf/zoo.cfgvi 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 connectclientPort=2181server.211=dt211.corp:2888:3888server.212=0.0.0.0:2888:3888server.214=dt214.corp:2888:3888

创建数据目录和myid

mkdir /data/solr/zookeepervi /data/solr/zookeeper/myid

myid 文件中只有一个数字,与server id对应

212

防火墙配置

firewall-cmd --permanent --add-port=2181/tcpfirewall-cmd --permanent --add-port=2888/tcpfirewall-cmd --permanent --add-port=3888/tcpfirewall-cmd --reload

同步到其它机器

参考NFS共享方案

修改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也只能有一台

原创粉丝点击