zookeeper安装配置

zookeeper简单的安装配置

准备

新建一个运行用户zookeeper,然后下载zookeeper的稳定版本3.4.5上传到zookeeper用户下,修改环境变量:

[bath]ZOOKEEPER_HOME=$HOME/zookeeper-3.4.5; export ZOOKEEPER_HOME PATH=$PATH:$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf;export PATH[/bath]

修改配置

添加配置zoo.cfg

[bath] mv conf/zoo_sample.cfg conf/zoo.cfg[/bath]

# 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=/tmp/zookeeper # 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

启动

服务端

./zdServer.sh start

客户端

./bin/zkCli.sh -server 127.0.0.1:2181

客户端启动后可以 输入 help 查询相关的命令进行操作

关闭

服务端

./bin/zdServer.sh stop

《zookeeper安装配置》有1个想法

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>