Environment :
etcd01:192.168.93.201,centos7.2
etcd02:192.168.93.203,centos7.2
etcd03:192.168.93.203,centos7.2
Software version:
etcd:2.3.7
Implementation steps:
With ETCD1 deployment as an example, the other 2 host steps are the same:
Installing ETCD
[email protected] ~]# Yum install etcd-y
Modifying a configuration file
Vi/etc/etcd//etcd.conf
Etcd_name=etcd01
Etcd_data_dir= "/VAR/LIB/ETCD/ETCD01"
Etcd_listen_peer_urls= "http://192.168.93.201:2380"
Etcd_listen_client_urls= "http://192.168.93.201:2379,http://127.0.0.1:2379"
Etcd_initial_advertise_peer_urls= "http://192.168.93.201:2380"
Etcd_initial_cluster= "etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http:// 192.168.93.203:2380 "
Etcd_initial_cluster_state= "New"
Etcd_initial_cluster_token= "etcd-cluster-00"
Etcd_advertise_client_urls= "http://192.168.93.201:2379"
###########################################################################
Etcd_name=etcd02
Etcd_data_dir= "/VAR/LIB/ETCD/ETCD01"
Etcd_listen_peer_urls= "http://192.168.93.202:2380"
Etcd_listen_client_urls= "http://192.168.93.202:2379,http://127.0.0.1:2379"
Etcd_initial_advertise_peer_urls= "http://192.168.93.202:2380"
Etcd_initial_cluster= "etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http:// 192.168.93.203:2380 "
Etcd_initial_cluster_state= "New"
Etcd_initial_cluster_token= "etcd-cluster-00"
Etcd_advertise_client_urls= "http://192.168.93.202:2379"
####################################################################
Etcd_name=etcd03
Etcd_data_dir= "/VAR/LIB/ETCD/ETCD01"
Etcd_listen_peer_urls= "http://192.168.93.203:2380"
Etcd_listen_client_urls= "http://192.168.93.203:2379,http://127.0.0.1:2379"
Etcd_initial_advertise_peer_urls= "http://192.168.93.203:2380"
Etcd_initial_cluster= "etcd01=http://192.168.93.201:2380,etcd02=http://192.168.93.202:2380,etcd03=http:// 192.168.93.203:2380 "
Etcd_initial_cluster_state= "New"
Etcd_initial_cluster_token= "etcd-cluster-00"
Etcd_advertise_client_urls= "http://192.168.93.203:2379"
##################################################################################
Be careful not to make the cluster stop because you are copying less content
Confirm Etcd Startup file
Less/usr/lib/systemd/system/etcd.service
[Unit]
Description=etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=notify
workingdirectory=/var/lib/etcd/
Environmentfile=-/etc/etcd/etcd.conf
User=etcd
# set Gomaxprocs to number of processors
Execstart=/bin/bash-c "gomaxprocs=$ (nproc)/usr/bin/etcd--name=\" ${etcd_name}\ "--data-dir=\" ${ETCD_DATA_DIR}\ "-- Listen-client-urls=\ "${etcd_listen_client_urls}\" "
Restart=on-failure
limitnofile=65536
[Install]
Wantedby=multi-user.target
Update Startup:
Systemctl daemon-reloadsystemctl start Etcdsystemctl enable ETCD
Check Status:
ETCDCTL member List Etcdctl cluster-health
Jin Yong Martial arts "seven wounds fist"--ETCD cluster construction