美文网首页
安装zookeeper

安装zookeeper

作者: xc2023 | 来源:发表于2019-03-04 21:16 被阅读0次

单机版

       cd /usr/local
  • 下载zookeeper的安装包,放入local目录
       http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.10.tar.gz
  • 解压zookeeper
      tar -xvf  zookeeper-3.4.10.tar.gz
      rm -rf zookeeper-3.4.10.tar.gz
  • 改个名字
      mv zookeeper-3.4.10.tar.gz  zookeeper
  • 改配置文件
      cd zookeeper/conf
      cp  zoo_sample.cfg  zoo.cfg
      vim zoo.cfg

启动

cd bin 
sh zkServer.sh start/status/stop

集群
zookeeper集群, 包含三种角色: leader / follower /observer
observer 是一种特殊的zookeeper节点。不参与投票。 只接收投票结果。
修改两台虚拟机
修改zoo.cfg

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

分别增加配置文件
vim /usr/local/zoo1/zookeeper/data

1
2

查看状态

Using config: /usr/local/zoo1/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[root@localhost bin]# 

[root@localhost bin]# sh zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zoo1/zookeeper/bin/../conf/zoo.cfg
Mode: follower

相关文章

网友评论

      本文标题:安装zookeeper

      本文链接:https://www.haomeiwen.com/subject/apywuqtx.html