In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
On the basis of introducing the realization of docker multi-segment communication between etcd and flannel, this paper focuses on its concrete steps, which are simple and easy to operate, and the content of the article is compact step by step. I hope you can get something according to this article.
I. brief introduction
Flannel is a third-party solution for multi-segment communication and a container network solution developed by CoreOS. Flannel assigns a subnet to each host, and the container assigns IP from this subnet. These IP can be routed between host, and the containers can communicate across hosts without NAT and port mapping. Each subnet is divided from a larger IP pool, and flannel runs an agent called flanneld on each host, which is responsible for allocating subnet from the pool. In order to share information among hosts, flannel uses etcd (key-value distributed database similar to consul) to store network configuration, allocated subnet, IP of host, and so on. How packets are forwarded between hosts is implemented by backend. Flannel provides a variety of backend, the most commonly used being vxlan and host-gw. Please refer to https://github.com/coreos/flannel for other backend. Flannel supports a variety of backend: currently, data forwarding methods such as UDP, VxLAN, AWS VPC and GCE routing are supported, and udp is used by default.
II. Preparatory work
Three VM virtual machines
One for etcd deployment
The other two are used for flannel deployment
System environment: centOS7.2
Docker version: docker-ce 19.3.5
Etcd version: etcd-3.3.11-2.el7.centos.x86_64
Flannel version: flannel-0.7.1-4.el7.x86_64
Installation, configuration and fault handling
1. Deploy etcd service
1.1 installation
[root@localhost ~] # yum install-y etcd # install etcd
1.2 modify the etcd.conf file
[root@localhost ~] # cd/ etc/etcd/
[root@localhost etcd] # cp-p etcd.conf etcd.conf.bak # back up the configuration file for fallback use.
[root@localhost etcd] # vim etcd.conf
Put the following items:
ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS= "http://localhost:2379"
ETCD_NAME= "default"
ETCD_ADVERTISE_CLIENT_URLS= "http://localhost:2379"
Modified to:
ETCD_DATA_DIR= "/ var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS= "http://172.16.41.251:2379"
ETCD_NAME= "default"
ETCD_ADVERTISE_CLIENT_URLS= "http://172.16.41.251:2379"
[root@localhost ~] # grep ^ [Amurz] / etc/etcd/etcd.conf # View the contents of the file
-- name: the node name that is easy to understand, defaults to default, should be unique in the cluster, and hostname can be used.
-- data-dir: the path where the service running data is saved. Default is ${name} .etcd.
-- listen-client-urls: the address where the service is provided, such as http://ip:2379,http://127.0.0.1:2379, where the client connects to interact with etcd.
-- advertise-client-urls: the publicly announced client listening address of this node, and this value will tell other nodes in the cluster.
1.3 create a new etcd.sh file and add the corresponding content
Create an etcd.sh file in the root directory
[root@localhost ~ # vim etcd.sh
Add the following to the etcd.sh file:
{"Network": "10.2.0.0 vxlan 16", "SubnetLen": 24, "Backend": {"Type": "vxlan"}}
Network: define the IP address pool of host hosts as 10.2.0.0 IP 16. Note: because etcd does not dynamically save the flannel network on host, for example, when a node is deleted, the subnet network in etcd about this node will not be deleted, so use the 10.X.X.X network to ensure that there are enough networks available
SubnetLen: specifies that the subnet size assigned to each host is 24 bits, that is, 10.2.x.0/24
Backend is vxlan, that is, hosts communicate with each other through vxlan. Backend is divided into vxlan and host-gw.
1.4 create new network/config files and add content
[root@localhost ~] # cd / usr/local/bin/
[root@localhost bin] # mkdir network
[root@localhost ~] # systemctl start etcd # start the etcd service, otherwise an error will be reported by running the following command
[root@localhost network] # etcdctl-- endpoints= http://172.16.41.251:2379 set / usr/local/bin/network/config
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.