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 > Servers >
Share
Shulou(Shulou.com)06/02 Report--
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 hostname remarks etcd1172.24.8.71etcd1.example.com is used to save relevant IP information docker01172.24.8.72docker01.example.comdocker02172.24.8.73docker02.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 eth2;, in which the network of eth2 is an internal network segment, that is, the normal NAT mode; where eth0 is the IP address assigned on the overlay segment, that is, overlay network, and the MTU is 1450 instead of 1500; only communications between containers in the same overlay network will go through eth0, and all other communications will go through eth2. [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 the 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 (eth2) Currently, the ID range for Docker to create vxlan tunnels is 256 to 1000, so a maximum of 745 networks can be created. Therefore, the ID used in this vxlan tunnel in this example is 256 etcd Docker vxlan driver using 4789 UDP port; the bottom layer of the overlay network model requires a KV storage system like consul or etcd for message synchronization; Docker overlay does not use multicast; containers in Overlay networks are in a virtual layer 2 network.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.