ntp configuration: omitted # It is recommended to configure the ntp service to ensure time consistency

etcd version: v3.3.9

Firewall and SELinux: Turn off firewall and SELinux

Name

addr

Host 

note

etcd1

172.24.8.71

etcd1.example.com

 

etcd2

172.24.8.72

etcd2.example.com

 

etcd3

172.24.8.73

etcd3.example.com

 

  1 # hostnamectl set-hostname etcd1.example.com
  2 # hostnamectl set-hostname etcd2.example.com
  3 # hostnamectl set-hostname etcd3.example.com

Two docker etcd cluster deployment

2.1 Install docker

See "docker version and installation".

2.2 etcd basic configuration

  1 # mkdir -p /var/log/etcd/			        #It is recommended to create the etcd log storage directory
  2 # mkdir -p /data/etcd				
  3 # REGISTRY=gcr.io/etcd-development/etcd		
  4 # REGISTRY=quay.io/coreos/etcd			#This warehouse is recommended
  5 # ETCD_VERSION=latest			
  6 # TOKEN=my-etcd-01				      
  7 # CLUSTER_STATE=new				     
  8 # NAME_1=etcd1
  9 # NAME_2=etcd2
 10 # NAME_3=etcd3				
 11 # HOST_1=172.24.8.71
 12 # HOST_2=172.24.8.72
 13 # HOST_3=172.24.8.73			
 14 # CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380					                        #Set all node information for the cluster
 15 # DATA_DIR=/data/etcd				

Tip: All the above operations need to be operated on all nodes.

2.3 Start the docker etcd cluster

  1 [[email protected] ~]# THIS_NAME=${NAME_1}
  2 [[email protected] ~]# THIS_IP=${HOST_1}
  3 [[email protected] ~]# docker run \
  4   -p 2379:2379 \
  5   -p 2380:2380 \
  6   --volume=${DATA_DIR}:/etcd-data \
  7   --name etcd ${REGISTRY}:${ETCD_VERSION} \
  8   /usr/local/bin/etcd \
  9   --data-dir=/etcd-data --name ${THIS_NAME} \
 10   --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://0.0.0.0:2380 \
 11   --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://0.0.0.0:2379 \
 12   --initial-cluster ${CLUSTER} \
 13   --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN}
 14 
 15 [[email protected] ~]# THIS_NAME=${NAME_2}
 16 [[email protected] ~]# THIS_IP=${HOST_2}
 17 [[email protected] ~]# docker run \
 18   -p 2379:2379 \
 19   -p 2380:2380 \
 20   --volume=${DATA_DIR}:/etcd-data \
 21   --name etcd ${REGISTRY}:${ETCD_VERSION} \
 22   /usr/local/bin/etcd \
 23   --data-dir=/etcd-data --name ${THIS_NAME} \
 24   --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://0.0.0.0:2380 \
 25   --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://0.0.0.0:2379 \
 26   --initial-cluster ${CLUSTER} \
 27   --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN}
 28 
 29 [[email protected] ~]# THIS_NAME=${NAME_3}
 30 [[email protected] ~]# THIS_IP=${HOST_3}
 31 [[email protected] ~]# docker run \
 32   -p 2379:2379 \
 33   -p 2380:2380 \
 34   --volume=${DATA_DIR}:/etcd-data \
 35   --name etcd ${REGISTRY}:${ETCD_VERSION} \
 36   /usr/local/bin/etcd \
 37   --data-dir=/etcd-data --name ${THIS_NAME} \
 38   --initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://0.0.0.0:2380 \
 39   --advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://0.0.0.0:2379 \
 40   --initial-cluster ${CLUSTER} \
 41   --initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN}

 

2.4 Confirm Verification

  1 [[email protected] ~]# docker ps
 
  1 [[email protected] ~]# docker ps
 
  1 [[email protected] ~]# docker ps
 
  1 [[email protected] ~]# docker exec -it 21e6cf6e5e89 /usr/local/bin/etcdctl cluster-health
 
  1 [[email protected] ~]# netstat -nltp | grep 2380
 

Related articles

Solr Example

Lucene is an open source full-text search engine provided by the Apache Software Foundation.Solr is an easy-to-use full-text search server that is packaged on top of lucene and provides related api. This article uses solr3.4 as an example of use, which ha

Use CobaltStrike

CobaltStrike is a penetration testing tool, known by the industry people as CS gods. cobaltStrike is divided into client and server, the server is one, the client can have more than one, can be distributed by the team to collaborate group operations. Coba

Use force index to force the use of indexes

1. When testing a query according to the time range, although the index is added, it is found that the index cannot be used. You can use this to force the use of the index The test process is to create the following table and create a joint index create

Install Cobbler

Cobbler is a Linux system installation and configuration software surroundings [[email protected] ~]# hostnamectl Static hostname: 56-201 Icon name: computer-vm Chassis: vm

CPU Load and CPU Utilization

Insufficient system resources such as storage, memory, and CPU (central processing unit) can significantly impact application performance. Therefore, it is critical to monitor these components.