企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# etcd集群部署 ```shell 1.下载etcd(https://github.com/coreos/etcd/releases/) 至 /root/ # cd # tar -xvf etcd-v3.3.9-linux-amd64.tar.gz # cp etcd-v3.3.9-linux-amd64/etcd /opt/kubernetes/bin/ # cp etcd-v3.3.9-linux-amd64/etcdctl /opt/kubernetes/bin/ 2.创建 etcd 的 systemd unit 文件 # vim /usr/lib/systemd/system/etcd.service [Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.target [Service] Type=notify EnvironmentFile=-/opt/kubernetes/cfg/etcd ExecStart=/opt/kubernetes/bin/etcd \ --name=${ETCD_NAME} \ --data-dir=${ETCD_DATA_DIR} \ --listen-peer-urls=${ETCD_LISTEN_PEER_URLS} \ --listen-client-urls=${ETCD_LISTEN_CLIENT_URLS},http://127.0.0.1:2379 \ --advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} \ --initial-advertise-peer-urls=${ETCD_INITIAL_ADVERTISE_PEER_URLS} \ --initial-cluster=${ETCD_INITIAL_CLUSTER} \ --initial-cluster-token=${ETCD_INITIAL_CLUSTER} \ --initial-cluster-state=new \ --cert-file=/opt/kubernetes/ssl/kubernetes.pem \ --key-file=/opt/kubernetes/ssl/kubernetes-key.pem \ --peer-cert-file=/opt/kubernetes/ssl/kubernetes.pem \ --peer-key-file=/opt/kubernetes/ssl/kubernetes-key.pem \ --trusted-ca-file=/opt/kubernetes/ssl/ca.pem \ --peer-trusted-ca-file=/opt/kubernetes/ssl/ca.pem Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target 3.环境变量配置文件/opt/kubernetes/cfg/etcd /*注意集群IP*/ # vim /opt/kubernetes/cfg/etcd #[Member] ETCD_NAME="etcd1" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="https://192.168.11.212:2380" ETCD_LISTEN_CLIENT_URLS="https://192.168.11.212:2379" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.11.212:2380" ETCD_ADVERTISE_CLIENT_URLS="https://192.168.11.212:2379" ETCD_INITIAL_CLUSTER="etcd1=https://192.168.11.212:2380,etcd2=https://192.168.11.213:2380,etcd3=https://192.168.11.214:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" ETCD_INITIAL_CLUSTER_STATE="new" 4.启动ETCD集群 # systemctl daemon-reload # systemctl start etcd # systemctl enable etcd 5.验证集群 etcdctl memeber list etcdctl cluster-health ```