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文件耸峭,里面寫入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