zookeeper安装配置-Linux

2019-12-04  本文已影响0人  大大大大橙子呦

声明:本文是我参考网络学习,总结得出。参考文献见文末。
环境:centos 7 + zookeeper 3.4.9

ZooKeeper服务器是用Java创建的,它在JVM上运行。你需要使用JDK 6或更高版本。
现在,按照以下步骤在你的机器上安装ZooKeeper框架。

  1. 步骤一:确定正确安装java环境,配置环境变量。
  1. 步骤二:
# The number of milliseconds of each 
ticktickTime=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
# 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

配置项说明如下:

  1. 步骤三:单机模式
ticketTime=2000
clientPort=2181
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/logs
[root@localhost zookeeper-3.4.9]# bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.9/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost zookeeper-3.4.9]# 
Connecting to localhost:2181
...省略...
Welcome to ZooKeeper!
...省略...
WATCHER::
WatchedEvent state:SyncConnected type: None path:null
[zk: localhost:2181(CONNECTED) 0]
  1. 步骤四:集群模式
    见文末第二个链接吧。

参考文献:

  1. https://www.w3cschool.cn/zookeeper/zookeeper_installation.html

  2. https://www.jianshu.com/p/de90172ea680

上一篇 下一篇

猜你喜欢

热点阅读