zookeeper集群搭建

今天通过搭建教程搭建了一个zookeeper的集群,由于条件限制,所以就利用本机中的三台虚拟机来进行搭建的。

首先三台机器分别为CenterOS 7,IP分别为192.168.0.88/192.168.0.89/192.168.0.90;三台机器配备的JDK均为JDK8。

第一步、配置JDK,由于是本机的虚拟机的环境,直官网下载JDK通过rz命令(文件弹窗按钮,选择本地文件上传)分别上传至各个虚拟机中解压,然后修改/etc下的profile文件并重启即可安装完成。

export JAVA_HOME=/usr/local/jvm/jdk1.8.0_60

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

配置好配置文件,利用source profile命令进行保存并生效。

第二步、编写zookeeper解压过后的conf下zoo.cfg文件。
server.3=zookeeper-yum003:2188:3888
server.2=zookeeper-yum002:2188:3888
server.1=zookeeper-yum001:2188:3888 

#autopurge.purgeInterval=1
# Set to "0" to disable auto purge feature
# Purge task interval in hours
#autopurge.snapRetainCount=3
# The number of snapshots to retain in dataDir
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
# administrator guide before turning on autopurge.
# Be sure to read the maintenance section of the 
#maxClientCnxns=60
# increase this if you need to handle more clients
# the maximum number of client connections.
clientPort=2181
# the port at which the clients will connect
dataDir=/tmp/zookeeper
# example sakes.
# do not use /tmp for storage, /tmp here is just 
# the directory where the snapshot is stored.
syncLimit=5
# sending a request and getting an acknowledgement
# The number of ticks that can pass between 
initLimit=10
# synchronization phase can take
# The number of ticks that the initial 
tickTime=2000
# The number of milliseconds of each tick

其中zookeeper-yum001、zookeeper-yum002、zookeeper-yum003分别对应的就是三台虚拟的IP地址,只是我在/etc下的hosts文件配置了相应的映射。

 

192.168.0.90 zookeeper-yum003
192.168.0.89 zookeeper-yum002
192.168.0.88 zookeeper-yum001

注意:对应的dataDir=/tmp/zookeeper 文件夹下面需要对应相应的myid文件,myid文件中只有对应的zookeeper的server.后面的ID

server.3=zookeeper-yum003:2188:3888
server.2=zookeeper-yum002:2188:3888
server.1=zookeeper-yum001:2188:3888 

 最后确定相应的防火墙是否关闭,可以利用iptables -F进行清除相应的规则。

一切准备就绪,到zookeeper文件夹下的bin文件中使用 ./zkServer.sh start进行启动zookeeper。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值