概述
ETCD集群部署(非docker)
1.拷贝证书
mkdir -p /opt/etcd/ssl
cp ca*pem server*pem /opt/etcd/ssl
2.下载etcd包
wget https://github.com/etcd-io/etcd/releases/download/v3.4.14/etcd-v3.4.14-linux-amd64.tar.gz
3.解压
mkdir -p /opt/etcd/{bin,cfg,ssl}
tar -zxvf etcd-v3.4.14-linux-amd64.tar.gz
mv etcd-v3.4.14-linux-amd64/{etcd,etcdctl} /opt/etcd/bin/
4.创建etcd配置文件
cat > /opt/etcd/cfg/etcd.conf << EOF
#[Member]
ETCD_NAME="etcd-1"
ETCD_DATA_DIR="/home/etcd-data-dir"
ETCD_LISTEN_PEER_URLS="https://192.168.221.128:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.221.128:2379"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.221.128:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.221.128:2379"
ETCD_INITIAL_CLUSTER="etcd-1=https://192.168.221.128:2380,etcd-2=https://192.168.221.129:2380,etcd-3=https://192.168.221.130:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"
#为了兼容flannel
ETCD_ENABLE_V2="true"
EOF
5.创建etcd配置文件
cat > /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
EnvironmentFile=/opt/etcd/cfg/etcd.conf
ExecStart=/opt/etcd/bin/etcd
--cert-file=/opt/etcd/ssl/server.pem
--key-file=/opt/etcd/ssl/server-key.pem
--peer-cert-file=/opt/etcd/ssl/server.pem
--peer-key-file=/opt/etcd/ssl/server-key.pem
--trusted-ca-file=/opt/etcd/ssl/ca.pem
--peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
--logger=zap
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
6.启动并设置开机启动
systemctl daemon-reload
systemctl start etcd
systemctl enable etcd
7.查看集群状态
./etcdctl --endpoints="https://192.168.201.128:2379,https://192.168.201.129:2379,https://192.168.201.130:2379"
--cert=/opt/etcd/ssl/server.pem
--key=/opt/etcd/ssl/server-key.pem
--cacert=/opt/etcd/ssl/ca.pem
endpoint status
最后
以上就是仁爱帽子为你收集整理的ETCD集群部署(非docker)ETCD集群部署(非docker)的全部内容,希望文章能够帮你解决ETCD集群部署(非docker)ETCD集群部署(非docker)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复