在 CentOS7 上安裝 Zookeeper服務

2022-05-18 20:57:02 字數 3572 閱讀 7499

1、建立 /usr/local/services/zookeeper 資料夾:

mkdir -p /usr/local/services/zookeeper

2、進入到 /usr/local/services/zookeeper 目錄中:

cd /usr/local/services/zookeeper

wget

4、解壓縮 zookeeper-3.4.9.tar.gz:

tar -zxvf zookeeper-3.4.9.tar.gz

5、進入到 /usr/local/services/zookeeper/zookeeper-3.4.9/conf 目錄中:

cd zookeeper-3.4.9/conf/

6、複製 zoo_sample.cfg 檔案的並命名為為 zoo.cfg:

cp zoo_sample.cfg zoo.cfg

7、用 vim 開啟 zoo.cfg 檔案並修改其內容為如下:

# the number of milliseconds of each tick

# zookeeper 定義的基準時間間隔,單位:毫秒

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=/tmp/zookeeper

# 資料資料夾

datadir=/usr/local/services/zookeeper/zookeeper-3.4.9/data

# 日誌資料夾

datalogdir=/usr/local/services/zookeeper/zookeeper-3.4.9/logs

# the port at which the clients will connect

# 客戶端訪問 zookeeper 的埠號

8、儲存並關閉 zoo.cfg 檔案:

9、進入到 /usr/local/services/zookeeper/zookeeper-3.4.9/bin 目錄中:

cd ../bin/

10、用 vim 開啟 /etc/ 目錄下的配置檔案 profile:

vim /etc/profile

並在其尾部追加如下內容:

#idea - zookeeper-3.4.9 config start - 2017-12-09

export zookeeper_home=/usr/local/services/zookeeper/zookeeper-3.4.9/export path=$zookeeper_home/bin:$path

export path

#idea - zookeeper-3.4.9 config end - 2017-12-09

11、使 /etc/ 目錄下的 profile 檔案即可生效:

source /etc/profile

12、啟動 zookeeper 服務:

zkserver.sh start

如列印如下資訊則表明啟動成功:

zookeeper jmx enabled by default

using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg

starting zookeeper ... started

13、查詢 zookeeper 狀態:

zkserver.sh status

14、關閉 zookeeper 服務:

zkserver.sh stop

如列印如下資訊則表明成功關閉:

zookeeper jmx enabled by default

using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg

stopping zookeeper ... stopped

15、重啟 zookeeper 服務:

zkserver.sh restart

如列印如下資訊則表明重啟成功:

zookeeper jmx enabled by default

using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg

zookeeper jmx enabled by default

using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg

stopping zookeeper ... stopped

zookeeper jmx enabled by default

using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg

starting zookeeper ... started

實際操作如下:

集群配置:

在CentOS7上安裝RabbitMQ

首先需要安裝erlang,參考 安裝過程中會有提示,一路輸入 y 即可。完成後安裝rabbitmq yum install rabbitmq server 3.6.6 1.el7.noarch.rpm完成後啟動服務 service rabbitmq server start可以檢視服務狀態 這裡可以...

在CentOS7上安裝RabbitMQ

1.安裝erlang rpm uvh yum install erlang如果出現 error failed dependencies epel release is needed by erlang solutions 1.0 1.noarch表示阿里雲已配置erlang solutions 1....

在CentOS 7上安裝Apache

apache http伺服器是世界上最流行的web伺服器。它是一款免費的開源和跨平台的http伺服器,提供強大的功能,可以通過各種模組進行擴充套件。以下說明介紹如何在centos 7機器上安裝和管理apache web伺服器。安裝apache apache在預設的centos倉庫中可用,安裝非常簡單...