美文网首页
zookeeper安装

zookeeper安装

作者: 进击的码奴 | 来源:发表于2018-09-18 20:32 被阅读0次

安装软件其实主要是配置软件的配置文件。

1、单机安装

先去zookeeper官网下载zookeeper压缩包加压到安装目录。然后修改配置文件。配置文件如下:

# 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/zookeeper/data  #数据路径 需要自己创建 并赋权限

# the port at which the clients will connect

clientPort=2181 #默认zookeeper端口 尽量不改

# 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

dataLogDir=/opt/zookeeper/logs #日志路径 需要自己创建 并赋权限

server.1=localhost:2888:3888  #zookeeper 服务地址 此地是本机。

简单的配置文件配置结束。

然后到zookeeper/bin目录下,运行./zkServer.sh start。因为 zookeeper启动 默认配置文件为conf/zoo.cfg。所以这里注意修改配置文件 zoo_sample.cfg名为  zoo.cfg.

2、集群安装

集群安装就是在 conf末尾添加 其他节点的ip和端口。例如修改 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/zookeeper/data  #数据路径 需要自己创建 并赋权限

# the port at which the clients will connect

clientPort=2181 #默认zookeeper端口 尽量不改

# 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

dataLogDir=/opt/zookeeper/logs #日志路径 需要自己创建 并赋权限

server.1=ip1:2888:3888 

server.2=ip2:2888:3888 

server.3=ip3:2888:3888  

配置好后将安装包发送到各个目标机器。使用上面命令启动各个机器就ok了。

相关文章

网友评论

      本文标题:zookeeper安装

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