zookeeper集群搭建

2021-09-26 08:06:34 字數 1886 閱讀 2131

zookeeper集群搭建過程小記

zookeeper集群搭建相對來說比較簡單和容易實現。

環境:阿里雲主機

系統:centos7.2

zookeeper:zookeeper-3.4.6.tar.gz

jdk:jdk1.8.0_45

wget  --no-check-certificate
ln -s zookeeper-3.4.6/ zookeeper

三,修改配置

# cd zookeeper/conf

# cp zoo_sample.cfg zoo.cfg

# vi 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=/home/hadoop/data/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

...server.1=hadoop001:2888:3888

server.2=hadoop002:2888:3888

server.3=hadoop003:2888:3888

四,建立上面配置中的datadir目錄,執行

# touch data/myid

# echo 1 > data/myid

五,將zookeeperscp到其他兩台機器

六,建立myid檔案

[hadoop@hadoop002 zookeeper]# echo 2 > data/myid

[hadoop@hadoop003 zookeeper]# echo 3 > data/myid

###切記不可 echo 3>data/myid,將》前後空格保留,否則無法將 3 寫入 myid 檔案

七,匯入個人環境變數

export path=$path:$zookeeper_home/bin

驗證:

[hadoop@hadoop001 ~]#source .bash_profile

[hadoop@hadoop001 ~]$ which zkserver.sh

[hadoop@hadoop001 ~]$ zkserver.sh start

[hadoop@hadoop001 ~]$ zkserver.sh status

jmx enabled by default

mode: follower

安裝成功!

zookeeper集群搭建

接觸zookeeper集群已有很長很長一段時間了,zookeeper在專案中的使用相當的頻繁,如dubb服務 amq集群 大資料領域hadoop等。zookeeper的集群建立非常簡單,一直想寫一篇文章來對集群使用的介紹,但一直沒能抽出空,今天正好閒來無事,就重新實踐一遍來整理記錄,下文是基本的集群...

zookeeper集群搭建

zookeeper環境搭建需要保證奇數臺機器,以保證演算法能選舉出乙個leader。一 環境準備 datadir dir ticktime 2000 initlimit 5 synclimit 2 clientport 2181 server.0 192.168.1.100 2888 3888 se...

zookeeper集群搭建

1.準備工作 tomcat zookeeper 最少三個結點搭乙個集群,所以複製三份 2.搭建並配置三個zookeeper例項 cd usr local solr cloud zookeeper01 進zookeeper01目錄,mkdir data 該目錄下建立data資料夾,放置zookeepe...