Creating a Configuration File
- On node 1, the node name is etcd01, the IP address is 10.208.71.111, and the configuration file is /usr/local/etcd/conf.yml. Modify the file content based on your requirements.
- Create a configuration file.
vim /usr/local/etcd/conf.yml
- Press i to enter the insert mode and add the following content to the file:
name: etcd01 data-dir: /usr/local/etcd/data initial-advertise-peer-urls: http://10.208.71.111:2380 listen-peer-urls: http://10.208.71.111:2380 listen-client-urls: http://10.208.71.111:2379,http://127.0.0.1:2379 advertise-client-urls: http://10.208.71.111:2379 initial-cluster-token: etcd-cluster initial-cluster: etcd01=http://10.208.71.111:2380,etcd02=http://10.208.107.205:2380,etcd03=http://10.208.72.182:2380 initial-cluster-state: new
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a configuration file.
- On node 2, the node name is etcd02, the IP address is 10.208.107.205, and the configuration file is /usr/local/etcd/conf.yml. Modify the file content based on your requirements.
- Create a configuration file.
vim /usr/local/etcd/conf.yml
- Press i to enter the insert mode and add the following content to the file:
name: etcd02 data-dir: /usr/local/etcd/data initial-advertise-peer-urls: http://10.208.107.205:2380 listen-peer-urls: http://10.208.107.205:2380 listen-client-urls: http://10.208.107.205:2379,http://127.0.0.1:2379 advertise-client-urls: http://10.208.107.205:2379 initial-cluster-token: etcd-cluster initial-cluster: etcd01=http://10.208.71.111:2380,etcd02=http://10.208.107.205:2380,etcd03=http://10.208.72.182:2380 initial-cluster-state: new
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a configuration file.
- On node 3, the node name is etcd03, the IP address is 10.208.72.182, and the configuration file is /usr/local/etcd/conf.yml. Modify the file content based on your requirements.
- Create a configuration file.
vim /usr/local/etcd/conf.yml
- Press i to enter the insert mode and add the following content to the file:
name: etcd03 data-dir: /usr/local/etcd/data initial-advertise-peer-urls: http://10.208.72.182:2380 listen-peer-urls: http://10.208.72.182:2380 listen-client-urls: http://10.208.72.182:2379,http://127.0.0.1:2379 advertise-client-urls: http://10.208.72.182:2379 initial-cluster-token: etcd-cluster initial-cluster: etcd01=http://10.208.71.111:2380,etcd02=http://10.208.107.205:2380,etcd03=http://10.208.72.182:2380 initial-cluster-state: new
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Create a configuration file.
The parameters in the configuration file are described as follows:
- name: name of the current etcd node
- data-dir: data storage directory
- initial-advertise-peer-urls: URLs for other nodes in the cluster to communicate with the current node
- listen-peer-urls: URLs for the current node to monitor information sent by other nodes in the cluster
- listen-client-urls: URLs for the current node to monitor information sent by the client
- advertise-client-urls: URLs for the client to communicate with the current node
- initial-cluster-token: used to differentiate clusters. Set this parameter to the same value for all nodes in the same cluster.
- initial-cluster: information about all nodes in the current cluster. The current node communicates with other nodes based on the information.
- initial-cluster-state: indicates whether the cluster is newly created. The value can be new or existing.
Parent topic: Deploying an etcd Cluster