Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of Building docker zookeeper Cluster

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the method of building docker zookeeper cluster". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the method of building docker zookeeper clusters".

Prepare the tool

First, install docker

Second, obtain the image from the docker library: zookeeper (tips: the version I downloaded is 3.4.13)

Set up

First, start zookeeper single point, which is usually used in development environment.

Docker run-d-p 2181 name zookeeper 2181-- restart always-- name zookeeper\-v $PWD/volume/data:/data\-v $PWD/volume/datalog:/datalog\ zookeeper:3.4.13

2. Build a zookeeper cluster. Here I intend to use three zookeeper nodes to form a cluster, and the three nodes are all on the same host. If you need the node prototype to be on different hosts, you can modify the corresponding ip and port.

-- create a node folder mkdir cluster/node1-p & & mkdir cluster/node2-p & & mkdir cluster/node3-p muri-machine ipmachine_ip=10.82.12.95-- running node 1docker run-d-p 2181-p 2887 purl 2888-p 3887 purl 3888-- name zookeeper_node1-- restart always\-v $PWD/cluster/node1/volume/data:/data\-v $PWD/cluster/node1/volume/datalog:/datalog\-e "TZ=Asia/Shanghai" \-e "ZOO_MY_ID=1"\-e "ZOO_SERVERS=server.1=0.0.0.0:2888:3888 server.2=$machine_ip:2888:3888 server.3=$machine_ip:2889:3889"\ zookeeper:3.4.13-- Operation Node 2docker run-d-p 2182 zookeeper:3.4.13-- 2181-p 2888 name zookeeper_node2-- restart always\-v $PWD/cluster/node2/volume/data:/data\-v $PWD/cluster/node2/volume / datalog:/datalog\-e "TZ=Asia/Shanghai"\-e "ZOO_MY_ID=2"\-e "ZOO_SERVERS=server.1=$machine_ip:2887:3887 server.2=0.0.0.0:2888:3888 server.3=$machine_ip:2889:3889"\ zookeeper:3.4.13-- Operation Node 3docker run-d-p 2183-p 2889 ZOO_SERVERS=server.1=$machine_ip:2887:3887 server.2=0.0.0.0:2888:3888 server.3=$machine_ip:2889:3889 2888-- name zookeeper_node3-- restart always\-v $PWD/cluster/node3/volume/data : / data\-v $PWD/cluster/node3/volume/datalog:/datalog\-e "TZ=Asia/Shanghai"\-e "ZOO_MY_ID=3"\-e "ZOO_SERVERS=server.1=$machine_ip:2887:3887 server.2=$machine_ip:2888:3888 server.3=0.0.0.0:2888:3888"\ zookeeper:3.4.13

Open the zookeeper link tool ZooInspector to test, there is no problem.

At this point, I believe you have a deeper understanding of the "method of building docker zookeeper clusters". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report