下载地址:Releases · etcd-io/etcd (github.com)

解压

tar zxvf etcd-v3.5.13-linux-amd64.tar.gz

添加到环境变量目录

cd etcd-v3.5.13-linux-amd64
mv etcd etcdctl etcdutl /usr/local/bin/

创建配置文件目录与数据目录

mkdir -p /etc/etcd
mkdir -p /data/etcd

注册系统服务

vim /etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
​
[Service]
Type=notify
EnvironmentFile=/etc/etcd/etcd.conf
ExecStart=/usr/local/bin/etcd --config-file=/etc/etcd/etcd.conf
Restart=on-failure
LimitNOFILE=65536
​
[Install]
WantedBy=multi-user.target

修改配置文件

# 节点名称
name: 'etcd-1'
# 指定节点的数据存储目录
data-dir: '/data/etcd'
# 对外提供服务的地址,客户端会连接到这里和 etcd 交互
listen-client-urls: 'http://10.20.13.10:2379,http://127.0.0.1:2379'

设置开机自启并启动

systemctl daemon-reload
systemctl enable etcd --now

测试

etcdctl endpoint status --cluster -w table