4 搭建ZooKeeper環境

2021-08-01 01:43:53 字數 1955 閱讀 2185

安裝目錄為:/usr/local

1.配置基本環境變數

對zookeeper-3.4.5.tar.gz進行解壓縮:tar-zxvf zookeeper-3.4.5.tar.gz

對zookeeper目錄進行重新命名:mvzookeeper-3.4.5 zk

配置zookeeper相關的環境變數

vi .bashrc

export zookeeper_home=/usr/local/zk

export path=$zookeeper_home/bin

source .bashrc

修改配置檔案zk/conf

2.修改zoo.cfg

mv zoo_sample.cfg zoo.cfg

vi zoo.cfg

修改:datadir=/usr/local/zk/data

新增:server.0=spark1:2888:3888 

server.1=spark2:2888:3888

server.2=spark3:2888:3888

3.設定zookeeper節點標識

cd zk

mkdir data

cd data

vi myid 0

4.設定zookeeper集群

1、在spark2、spark3節點上按照上述步驟配置zookeeper,使用scp將zk和.bashrc拷貝到spark2和spark3上即可。

2、唯一的區別是spark2和spark3的標識號分別設定為1和2

5.檢測是否安裝成功

1、分別在三颱機器上執行:zkserver.sh start。

2、檢查zookeeper狀態:zkserver.sh status。

[root@spark1 conf]# zkserver.sh start

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

starting zookeeper ... started

[root@spark1 conf]# zkserver.sh status

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

mode: follower

[root@spark2 zookeeper]# zkserver.sh start

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

starting zookeeper ... started

[root@spark2 zookeeper]# zkserver.sh status

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

mode: leader

[root@spark3 zookeeper]# zkserver.sh start

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

starting zookeeper ... started

[root@spark3 zookeeper]# zkserver.sh status

jmx enabled by default

using config: /usr/local/spark/zookeeper/bin/../conf/zoo.cfg

mode: follower

以上提示表示安裝成功

ZooKeeper集群環境搭建

主機名 ip位址 myid hadoop101 192.168.88.101 1hadoop102 192.168.88.102 2hadoop103 192.168.88.103 3注 需要修改三颱虛擬機器的主機名,並關閉防火牆 在三颱虛擬機器中安裝jdk8,並設定環境變數 centos7安裝jd...

zookeeper環境搭建簡記

一 準備3臺機器執行一下操作 tar xzf tmp zookeeper 3.4.8.tar.gz c usr local chown r hadoop hadoop usr local zookeeper 3.4.8 chmod r 770 usr local zookeeper 3.4.8 ln...

Zookeeper集群環境搭建

需要注意zookeeper安裝的目錄,我是放在 usr local zookeeper 目錄下。用如下的解壓命令進行解壓,注意解壓後的目錄層次。sudo tar zxvf apache zookeeper 3.6.2 bin.tar.gz c usr local zookeeper 首先是zoo.c...