In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of how to deploy etcd nodes, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to deploy etcd nodes. Let's take a look.
One environment preparation
1.1 basic environment
Ntp configuration: slightly # it is recommended to configure ntp service to ensure time consistency
Etcd version: v3.3.9
Firewall and selinux: turn off firewall and selinux
Name
Address
Hostnam
Remarks
Etcd1
172.24.8.71
Etcd1.example.com
Used to save relevant ip information
Docker01
172.24.8.72
Docker01.example.com
Docker02
172.24.8.73
Docker02.example.com
# hostnamectl set-hostname etcd1.example.com# hostnamectl set-hostname docker01.example.com# hostnamectl set-hostname docker02.example.com
Tip: hostname is not required.
1.2 docker environment
All the above nodes are installed with docker, see "002.docker version and installation" for details.
Deployment of two etcd nodes
Tip: this environment is all dockerized, that is, etcd services also exist in the form of docker.
2.1 etcd basic configuration
# mkdir-p / var/log/etcd/ # it is recommended to create an etcd log directory # mkdir-p / data/etcd # it is recommended to create a separate etcd data directory # export host_1=172.24.8.71 # set up the ip# export data_dir=/data/etcd of the etcd node # set up the cluster etcd data node # registry=quay.io/coreos/etcd # suggest using this warehouse # etcd_version=latest # set etcd version # export name_1=etcd1 # set the name# docker volume create of etcd node-- name etcd-data
Tip: all of the above operations need to be done on all nodes.
2.3 start the docker etcd cluster
[root@etcd1] # docker run\-p 2379 name 2379\-- volume=$ {data_dir}: / etcd-data\-- name etcd ${registry}: ${etcd_version}\ / usr/local/bin/etcd\-- data-dir=/etcd-data-- name ${name_1}\-- initial-advertise-peer-urls http://${host_1}:2380-- listen-peer-urls http:/ / 0.0.0.0 listen-client-urls 2380\-- advertise-client-urls http://${host_1}:2379-- listen-client-urls http://0.0.0.0:2379\-- initial-cluster ${name_1} = http://${host_1}:2380
Note: quay.io/coreos/etcd images may not be pull in China. You can pull them on foreign nodes, and then scp them to the cluster nodes.
2.4 confirm validation
[root@etcd1 ~] # docker ps
[root@etcd1 ~] # docker exec-it bcb96fb0f987 / usr/local/bin/etcdctl cluster-health
[root@etcd1] # docker exec-it bcb96fb0f987 / usr/local/bin/etcdctl-- endpoints= http://${host_1}:2379 member list
Three docker host node configuration
3.1 docker01 configuration
[root@docker01] # vi / etc/sysconfig/dockeroptions='--cluster-store=etcd://172.24.8.71:2379-- cluster-advertise=172.24.8.72:2379' [root@docker01 ~] # systemctl restart docker
3.2 docker02 configuration
[root@docker02] # vi / etc/sysconfig/dockeroptions='--cluster-store=etcd://172.24.8.71:2379-- cluster-advertise=172.24.8.73:2379' [root@docker02 ~] # systemctl restart docker
3.3.Create overlay network
[root@docker01 ~] # docker network create-d overlay overlaynet1418654e0092f5d1c3e4bf2b9ee73cdd22932dd60fecf12d7a3b024818118244b [root@docker01 ~] # docker network inspect overlaynet1
[root@docker02 ~] # docker network inspect overlaynet1
Tip: view the overlay network created on docker01 in docker01 and docker02 host respectively. If both exist, it means that the network data is distributed rather than local through etcd.
3.4 Test the network
[root@docker01] # docker run-d-- name container01-- network overlaynet1 training/webapp python app.py [root@docker02 ~] # docker run-d-- name container02-- network overlaynet1 training/webapp python app.py [root@docker01 ~] # docker exec-it 73e984a5528a / bin/bashroot@73e984a5528a:/opt/webapp# ifconfig
Root@73e984a5528a:/opt/webapp# route-n
[root@docker02 ~] # docker exec-it 89eac9521743 / bin/bashroot@89eac9521743:/opt/webapp# ifconfig
Description:
There will be two network cards for all container pairs, eth0 and eth1
The eth1 network is an internal network segment, that is, the ordinary nat mode.
Where eth0 is the ip address assigned on the overlay segment, that is, the overlay network, and the mtu is 1450 instead of 1500
Only communications between containers in the same overlay network pass through the eth0, and all other communications go through the eth1.
[root@docker01 ~] # brctl show
[root@docker01 ~] # docker network ls
Other references:
Docker creates two linux bridge on each node, one for the overlay network and one for the non-overlay nat network (docker_gwbridge)
The network traffic from the container to other containers of the overlay network goes through the container's overlay network card (eth0), and other network traffic goes through the container's nat network card (eth1).
The current id range for docker to create vxlan tunnels is 256 to 1000, so a maximum of 745 networks can be created, so the id used for this vxlan tunnel in this example is 256
Docker vxlan driver uses 4789 udp port
The underlying layer of the overlay network model requires a kv storage system like consul or etcd for message synchronization
Docker overlay does not use Multicast
The container in overlay network is in a virtual layer 2 network.
This is the end of the article on "how to deploy etcd nodes". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to deploy etcd nodes". If you want to learn more, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.