etcd集群开机启动
本文内容纲要:
- 1. 使用yum安装etcd- 2. 更新配置文件
- 3. 更新启动
- 4. 校验状态
1. 使用yum安装etcd
yum -y install etcd
2. 更新配置文件
tee /etc/etcd/etcd.conf <<-'EOF'ETCD_NAME=etcd03
ETCD_DATA_DIR="/var/lib/etcd/etcd03"
ETCD_LISTEN_PEER_URLS="http://192.168.2.46:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.2.46:2379,http://127.0.0.1:2379"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.2.46:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.2.46:2379"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster1"
ETCD_INITIAL_CLUSTER="etcd01=http://192.168.2.44:2380,etcd02=http://192.168.2.45:2380,etcd03=http://192.168.2.46:2380"
EOF
tee /usr/lib/systemd/system/etcd.service <<-'EOF'
[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}\" --listen-peer-urls=\"${ETCD_LISTEN_PEER_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
EOF
3. 更新启动
systemctl daemon-reloadsystemctl start etcd
systemctl enable etcd
4. 校验状态
etcdctl member list etcdctl cluster-health
本文内容总结:1. 使用yum安装etcd,2. 更新配置文件,3. 更新启动,4. 校验状态,
原文链接:https://www.cnblogs.com/vipmint/p/5694114.html
以上是 etcd集群开机启动 的全部内容, 来源链接: utcz.com/z/297019.html