首页 > 代码库 > etcd集群开机启动
etcd集群开机启动
1. 安装最新版本
使用官方最新版本
https://github.com/coreos/etcd/releases
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-reload
systemctl start etcd
systemctl enable etcd
4. 校验状态
etcdctl member list
etcdctl cluster-health
etcd集群开机启动
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。