zookeeper安裝

安裝軟件其實主要是配置軟件的配置文件。

1、單機安裝

先去zookeeper官網(wǎng)下載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? #數(shù)據(jù)路徑 需要自己創(chuàng)建 并賦權(quán)限

# the port at which the clients will connect

clientPort=2181 #默認(rèn)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?#日志路徑 需要自己創(chuàng)建 并賦權(quán)限

server.1=localhost:2888:3888? #zookeeper 服務(wù)地址 此地是本機。

簡單的配置文件配置結(jié)束。

然后到zookeeper/bin目錄下,運行./zkServer.sh start。因為 zookeeper啟動 默認(rèn)配置文件為conf/zoo.cfg。所以這里注意修改配置文件 zoo_sample.cfg名為? zoo.cfg.

2、集群安裝

集群安裝就是在 conf末尾添加 其他節(jié)點的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? #數(shù)據(jù)路徑 需要自己創(chuàng)建 并賦權(quán)限

# the port at which the clients will connect

clientPort=2181 #默認(rèn)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?#日志路徑 需要自己創(chuàng)建 并賦權(quán)限

server.1=ip1:2888:3888?

server.2=ip2:2888:3888?

server.3=ip3:2888:3888??

配置好后將安裝包發(fā)送到各個目標(biāo)機器。使用上面命令啟動各個機器就ok了。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容