一臺Centos7的服務器,個人IP:172.16.4.67linux
登錄到服務器,切換到root用戶git
#cd /tmpgithub
下載安裝包,下載地址:https://github.com/etcd-io/etcd/releasesvim
# wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz服務器
解壓文件測試
# tar -zxvf etcd-v3.3.13-linux-amd64.tar.gzspa
# cd etcd-v3.3.13-linux-amd64code
目錄下有兩個可執行文件etcd 和 etcdctlip
# cp etcd /usr/bin/get
# cp etcdctl /usr/bin/
配置服務:
# vim /usr/lib/systemd/system/etcd.service (添加如下內容)
[Unit]
Description=Etcd Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/lib/etcd/
EnvironmentFile=-/etc/etcd/etcd.conf
ExecStart=/usr/bin/etcd
[Install]
WantedBy=multi-user.target
# mkdir -p /var/lib/etcd
# mkdir -p /etc/etcd
# vim /etc/etcd/etcd.conf (添加如下內容)
#[member]
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://172.16.4.67:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://172.16.4.67:2379"
# systemctl daemon-reload
# systemctl enable etcd.service
# systemctl start etcd.service
測試服務狀態:
# etcdctl cluster-health