kafka一样的情况,系统一关机,重启,etcd就需要重新启动,所以亟需配置etcd开机自启,避免每次都要手动启动。

1.etcd.service

vi /lib/systemd/system/etcd.service 
[Unit]
Description=etcd service
After=network.target

[Service]
Type=notify
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin"
User=root
Group=root
ExecStart=/home/randyfield/etcd-release/etcd-v3.2.32-linux-amd64/etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380
Restart=on-failure

[Install]
WantedBy=multi-user.target

2.启动服务

#刷新配置
systemctl daemon-reload

#服务加入开机自启
systemctl enable etcd

#启动
systemctl start etcd.service

#查看状态
systemctl status etcd.service