[大数据]Zookeeper 配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u014679456/article/details/80182778

Zookeeper 环境配置

1 版本选择

因为要和后面的hive kafka集成 所以选择了 zookeeper-3.4.5-cdh5.10.0

2 文件配置

  1. 复制并修改配置文件:
cp conf/zoo_sample.cfg conf/zoo.cfg
vi conf/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=/opt/modules/zookeeper-3.4.5-cdh5.10.0/zkData
# the port at which the clients will connect
clientPort=2181
#
# 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
#集群环境 id 及端口设置
server.1=bigdata01.com:2888:3888
server.2=bigdata02.com:2888:3888
server.3=bigdata03.com:2888:3888
  1. 创建数据存储目录:
mkdir /opt/modules/zookeeper-3.4.5-cdh5.10.0/zkData
  1. 在存储目录中创建myid 文件 并修改文件:
touch zkData/myid
vi zkData/myid
----------------------------------
#在这里写在刚才的集群环境中的id
1

3 运行

要两台机器的Server启动才能使用Zookeeper 因为它的是2N+1 N是可损坏的数量

bin/zkServer.sh start

4 测试

bin/zkServer.sh status 

出现一下信息说明此节点是follower节点

JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Mode: follower

使用这个命令进入Client 端

bin/zkCli.sh 

可使用的命令有ls,get,create,delete,set

猜你喜欢

转载自blog.csdn.net/u014679456/article/details/80182778