Deploy etcd cluster in cenots7

Source: Internet
Author: User
Tags etcd

Deploy etcd cluster in cenots7
Ip role 192.168.1.101master192.168.1.102node1194251.103node2

1. Install etcd

yum install -yetcd

2. Configuration File

# Master Configuration ETCD_NAME=etcdmaster ETCD_DATA_DIR= "/var/lib/etcd/etcd-master.etcd" ETCD_LISTEN_PEER_URLS= "http://192.168.1.101:2380" ETCD_LISTEN_CLIENT_URLS= "http://192.168.1.101:2379,http://127.0.0.1:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS= "http://192.168.1.101:2380" ETCD_INITIAL_CLUSTER= "etcdmaster=http://192.168.1.101:2380,etcdnode1=http://192.168.1.102:2380,etcdnode2=http://192.168.1.103:2380" ETCD_INITIAL_CLUSTER_STATE= "new" ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster-00" ETCD_ADVERTISE_CLIENT_URLS= "http://192.168.1.101:2379" #etcdnode01 ETCD_NAME=etcdnode01 ETCD_DATA_DIR= "/var/lib/etcd/etcd-master.etcd" ETCD_LISTEN_PEER_URLS= "http://192.168.1.102:2380" ETCD_LISTEN_CLIENT_URLS= "http://1092.168.1.102:2379,http://127.0.0.1:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS= "http://10.6.74.6:2380" ETCD_INITIAL_CLUSTER= "etcdmaster=http://192.168.1.101:2380,etcdnode1=http://192.168.1.102:2380,etcdnode2=http://192.168.1.103:2380" ETCD_INITIAL_CLUSTER_STATE= "new" ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster-00" ETCD_ADVERTISE_CLIENT_URLS= "http://192.168.1.102:2379" #etcdnode02 ETCD_NAME=etcdnode02 ETCD_DATA_DIR= "/var/lib/etcd/etcd-master.etcd" ETCD_LISTEN_PEER_URLS= "http://192.168.1.103:2380" ETCD_LISTEN_CLIENT_URLS= "http://192.168.1.103:2379,http://127.0.0.1:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS= "http://192.168.1.103:2380" ETCD_INITIAL_CLUSTER= "etcdmaster=http://192.168.1.101:2380,etcdnode1=http://192.168.1.102:2380,etcdnode2=http://192.168.1.103:2380" ETCD_INITIAL_CLUSTER_STATE= "new" ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster-00" ETCD_ADVERTISE_CLIENT_URLS= "http://192.168.1.103:2379"

3. Configure the startup command

Cat/usr/lib/systemd/system/etcd. service

[Unit] Description=EtcdServer 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 ExecStart= /bin/bash -c"GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\"\ --data- dir =\"${ETCD_DATA_DIR}\"\ --listen-peer-urls=\"${ETCD_LISTEN_PEER_URLS}\"\ --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\"\ --advertise-client-urls=\"${ETCD_ADVERTISE_CLIENT_URLS}\"\ --initial-cluster-token=\"${ETCD_INITIAL_CLUSTER_TOKEN}\"\ --initial-cluster=\"${ETCD_INITIAL_CLUSTER}\"\ --initial-cluster-state=\ "${ETCD_INITIAL_CLUSTER_STATE}\"" Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target

4. Management

Start various nodes systemctl start etcd

# Command for viewing cluster status etcdctlmemberlist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.