分布式協(xié)調(diào)框架zookeeper分布式部署

1、首先是到http://zookeeper.apache.org/releases.html官網(wǎng)下載安裝包,這里下載的版本為3.4.12
2、解壓到相應(yīng)的目錄
3、在zookeeper文件夾下新建zookeeper存放數(shù)據(jù)的目錄
mkdid -p data/zkdata

創(chuàng)建好后整個(gè)文件路徑如下:

[T2YZL3SVW984C%T9_R2]GD.png
4、重命名conf下的zoo-sample.cfg為zoo.cfg
5、修改zoo.cfg,主要配置數(shù)據(jù)存放路徑和znode所在服務(wù)器
# 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.
###############1、配置zookeeper數(shù)據(jù)存放位置#############
dataDir=/home/luozheng/tools/zookeeper-3.4.12/data/zkdata
# the port at which the clients will connect
clientPort=2181
###############2、分布式集群添加節(jié)點(diǎn)####################
server.1=luozheng.bigdata:2888:3888
server.2=luozheng.bigdata1:2888:3888
server.3=luozheng.bigdata2:2888:3888
######################################################
# 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
6、在zookeeper文件夾下新建myid文件,里面寫(xiě)入1,對(duì)應(yīng)zoo.cfg中server.1中的1
7、zookeeper同步到其他服務(wù)器
scp -r zookeeper-3.4.12/ luozheng@luozheng.bigdata1:~/tools/
scp -r zookeeper-3.4.12/ luozheng@luozheng.bigdata2:~/tools/
image.png
image.png
8、分別修改其他兩個(gè)節(jié)點(diǎn)myid文件中的值
9、zookeeper服務(wù)啟動(dòng),這個(gè)要每臺(tái)服務(wù)器都要運(yùn)行啟動(dòng)命令
bin/zkServer.sh start
image.png

image.png

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

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

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