win10上安装nginx的方法步骤
五、安装配置etcd (三主节点)
5.1:安装etcd(01、02、03节点)
yum install etcd -y
mkdir -p /var/lib/etcd
node01的etcd.service
cat <<EOF >/etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/bin/etcd \
--name node01 \
--cert-file=/etc/etcd/ssl/etcd.pem \
--key-file=/etc/etcd/ssl/etcd-key.pem \
--peer-cert-file=/etc/etcd/ssl/etcd.pem \
--peer-key-file=/etc/etcd/ssl/etcd-key.pem \
--trusted-ca-file=/etc/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ssl/ca.pem \
--initial-advertise-peer-urls https://10.8.1.101:2380 \
--listen-peer-urls https://10.8.1.101:2380 \
--listen-client-urls https://10.8.1.101:2379,http://127.0.0.1:2379 \
--advertise-client-urls https://10.8.1.101:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster node01=https://10.8.1.101:2380,node02=https://10.8.1.102:2380,node03=https://10.8.1.103:2380 \
--initial-cluster-state new \
--data-dir=/var/lib/etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
node02的etcd.service
cat <<EOF >/etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/bin/etcd \
--name node02 \
--cert-file=/etc/etcd/ssl/etcd.pem \
--key-file=/etc/etcd/ssl/etcd-key.pem \
--peer-cert-file=/etc/etcd/ssl/etcd.pem \
--peer-key-file=/etc/etcd/ssl/etcd-key.pem \
--trusted-ca-file=/etc/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ssl/ca.pem \
--initial-advertise-peer-urls https://10.8.1.102:2380 \
--listen-peer-urls https://10.8.1.102:2380 \
--listen-client-urls https://10.8.1.102:2379,http://127.0.0.1:2379 \
--advertise-client-urls https://10.8.1.102:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster node01=https://10.8.1.101:2380,node02=https://10.8.1.102:2380,node03=https://10.8.1.103:2380 \
--initial-cluster-state new \
--data-dir=/var/lib/etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
node03的etcd.service
cat <<EOF >/etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd/
ExecStart=/usr/bin/etcd \
--name node03 \
--cert-file=/etc/etcd/ssl/etcd.pem \
--key-file=/etc/etcd/ssl/etcd-key.pem \
--peer-cert-file=/etc/etcd/ssl/etcd.pem \
--peer-key-file=/etc/etcd/ssl/etcd-key.pem \
--trusted-ca-file=/etc/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ssl/ca.pem \
--initial-advertise-peer-urls https://10.8.1.103:2380 \
--listen-peer-urls https://10.8.1.103:2380 \
--listen-client-urls https://10.8.1.103:2379,http://127.0.0.1:2379 \
--advertise-client-urls https://10.8.1.103:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster node01=https://10.8.1.101:2380,node02=https://10.8.1.102:2380,node03=https://10.8.1.103:2380 \
--initial-cluster-state new \
--data-dir=/var/lib/etcd
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
5.2:添加自启动(etc集群最少2个节点才能启动,启动报错看mesages日志)
#mv etcd.service /usr/lib/systemd/system/ 不用执行?
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
systemctl status etcd
5.3:在三个etcd节点执行一下命令检查
etcdctl --endpoints=https://10.8.1.101:2379,https://10.8.1.102:2379,https://10.8.1.103:2379 \
--ca-file=/etc/etcd/ssl/ca.pem \
--cert-file=/etc/etcd/ssl/etcd.pem \
--key-file=/etc/etcd/ssl/etcd-key.pem cluster-health
精彩评论