我正在尝试将etcd配置为在4台计算机上作为集群运行。显然,etcd不会同时出现,但是我没有得到一个集群,而是得到了四个不同的集群。
我正在使用the clustering guide来配置机器,但是似乎无法正常工作。
/ etc / default / etcd(c3po)如下:
ETCD_LISTEN_PEER_URLS="http://192.168.160.202:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379,http://192.168.160.202:2379"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.160.202:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.160.202:2379"
ETCD_INITIAL_CLUSTER_TOKEN="pgcluster"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER="c3po=http://192.168.160.202:2380,rogue1=http://192.168.144.243:2380,rogue2=http://192.168.149.219:2380,rogue3=http://192.168.150.120:2380"
/ etc / default / etcd(rogue2):
ETCD_LISTEN_PEER_URLS="http://192.168.149.219:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379,http://192.168.149.219:2379"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.149.219:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.149.219:2379"
ETCD_INITIAL_CLUSTER_TOKEN="pgcluster"
ETCD_INITIAL_CLUSTER_STATE="existing"
ETCD_INITIAL_CLUSTER="c3po=http://192.168.160.202:2380,rogue1=http://192.168.144.243:2380,rogue2=http://192.168.149.219:2380,rogue3=http://192.168.150.120:2380"
ETCD_NAME="rogue2"
etcd.service是Ubuntu 18.04的标准打包版本
[Unit]
Description=etcd - highly-available key value store
Documentation=https://github.com/coreos/etcd
Documentation=man:etcd
After=network.target
Wants=network-online.target
[Service]
Environment=DAEMON_ARGS=
Environment=ETCD_NAME=%H
Environment=ETCD_DATA_DIR=/var/lib/etcd/default
EnvironmentFile=-/etc/default/%p
Type=notify
User=etcd
PermissionsStartOnly=true
#ExecStart=/bin/sh -c "GOMAXPROCS=$(nproc) /usr/bin/etcd $DAEMON_ARGS"
ExecStart=/usr/bin/etcd $DAEMON_ARGS
Restart=on-abnormal
#RestartSec=10s
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
Alias=etcd2.service
Runnint etcd版本3.2.17
P.S。可能更适合超级用户。