zookeeper

发布时间 2023-07-28 16:16:36作者: 吾执青剑向天涯

安装zookeeper

创建放data文件夹

mkdir -p /export/data/zookeeper

复制zookeeper zook文件

cp zoo_sample.cfg zoo.cfg

修改文件配置

vi 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=/export/data/zookeeper
dataLogDir=/export/data/zookeeper/dataLog
# 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=Master:2888:3888
server.2=Slave01:2888:3888
server.3=Slave02:2888:3888

创建 myid文件(在/export/data/zookeeper下)

echo 1 > myid     

配置环境变量(可以在任意路径启动zookeeper) 配置很关键变量

export ZK_HOME=/export/servers/zookeeper-3.4.10

export PATH = $PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$ZK_HOME/bin

在windows 下一样通用

  1. 解压
  2. 修改zkserver.cmd 文件 加上pause 等待输入 不然会闪退
  3. 添加 zoo.cfg 文件