Docker?ZooKeeper3.4.10集群安裝配置過(guò)程
一. 服務(wù)器規(guī)劃
主機(jī) | IP | 端口 | 備注 |
b-mid-24 | 172.16.0.24 | 2181, 2888, 3888 | 2181:對(duì)cline端提供服務(wù) 3888:選舉leader使用 2888:集群內(nèi)機(jī)器通訊使用(Leader監(jiān)聽(tīng)此端口) |
b-mid-25 | 172.16.0.25 | 2181, 2888, 3888 | |
b-mid-26 | 172.16.0.26 | 2181, 2888, 3888 |
二. 集群部署
注:以下步驟需要分別在三臺(tái)主機(jī)操作
1. 配置
1.1 創(chuàng)建宿主機(jī)映射目錄
mkdir /data/docker/zookeeper-home/{conf,data,logs,datalog} -p1.2. 創(chuàng)建配置文件(3臺(tái)zk節(jié)點(diǎn)配置文件一樣)
vi /data/docker/zookeeper-home/conf/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=/data dataLogDir=/datalog # 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 # # 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 server.24=172.16.0.24:2888:3888 server.25=172.16.0.25:2888:3888 server.26=172.16.0.26:2888:3888
1.3. 配置zookeeper主機(jī)id,每個(gè)機(jī)器id不能相同,需要對(duì)應(yīng)配置文件server后面的值:
echo "24" > /data/docker/zookeeper-home/data/myid echo "25" > /data/docker/zookeeper-home/data/myid echo "26" > /data/docker/zookeeper-home/data/myid
1.4 修改 zookeeper-home 目錄及子目錄所屬用戶為 yunwei :
chown -R yunwei:yunwei /data/docker/zookeeper-home
2. 啟動(dòng)
2.1 開(kāi)啟端口
firewall-cmd --permanent --add-port=2181/tcp firewall-cmd --permanent --add-port=2888/tcp firewall-cmd --permanent --add-port=3888/tcp firewall-cmd --reload firewall-cmd --list-all
2.2 啟動(dòng)服務(wù)(用 yunwei 賬號(hào)執(zhí)行)
拉取鏡像:
docker pull zookeeper:3.4.10
啟動(dòng)服務(wù):
docker run -d \ --name zookeeper \ --network host \ --restart=unless-stopped \ -v /data/docker/zookeeper-home/data:/data \ -v /data/docker/zookeeper-home/conf:/conf \ -v /data/docker/zookeeper-home/datalog:/datalog \ -v /data/docker/zookeeper-home/logs:/logs \ -v /etc/localtime:/etc/localtime \ zookeeper:3.4.10
2.3 查看服務(wù)器狀態(tài)
docker exec -it zookeeper bash zkServer.sh status echo mntr | nc 127.0.0.1 2181 zkCli.sh -server 127.0.0.1:2181 ls /
到此這篇關(guān)于Docker ZooKeeper3.4.10集群安裝配置過(guò)程的文章就介紹到這了,更多相關(guān)Docker ZooKeeper集群內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
在Ubuntu15.04上安裝Docker的步驟以及基本用法
Docker是一種輕量型的的類虛擬機(jī)的平臺(tái),在開(kāi)發(fā)項(xiàng)目上還是很有優(yōu)勢(shì)的,這僅是我的一種直觀理解。所以這篇文章主要給大家介紹了在Ubuntu15.04上安裝Docker的步驟以及基本用法,有需要的朋友們可以參考借鑒。2016-10-10
Docker compose部署SpringBoot項(xiàng)目連接MySQL及遇到的坑
這篇文章主要介紹了Docker compose部署SpringBoot項(xiàng)目連接MySQL,文中給大家強(qiáng)調(diào)了如果在使用的過(guò)程中修改了Dockerfile,一定要把之前的鏡像刪掉,具體內(nèi)容詳情跟隨小編一起看看吧2021-09-09
docker實(shí)踐之容器的導(dǎo)入與導(dǎo)出
Docker技術(shù)為IT界帶來(lái)了巨大的改變,它使得云服務(wù)可以用來(lái)共享應(yīng)用和工作流程自動(dòng)化,使得應(yīng)用可以用組件快速組合,消除了開(kāi)發(fā)、品質(zhì)保證、產(chǎn)品環(huán)境間的摩擦。這篇文章我們將詳細(xì)的介紹docker容器的導(dǎo)入與導(dǎo)出,感興趣的朋友們下面來(lái)一起看看吧。2016-10-10
docker部署golang http服務(wù)時(shí)端口無(wú)法訪問(wèn)的問(wèn)題解決
本文主要介紹了docker部署golang http服務(wù)時(shí)端口無(wú)法訪問(wèn)的問(wèn)題解決,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08
如何使用Docker搭建pypi私有倉(cāng)庫(kù)
這篇文章主要介紹了如何使用Docker搭建pypi私有倉(cāng)庫(kù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-11-11

