前提
已经在/opt/etcd
存在可执行的etcd程序
操作步骤
- 新建配置文件
vim /usr/lib/systemd/system/etcd.service
- 添加内容
[Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.targe [Service] Type=notify WorkingDirectory=/opt/etcd ExecStart=/bin/bash -c "./etcd --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2371 --listen-peer-urls http://0.0.0.0:2380" Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target
- 启动服务
systemctl start etcd systemctl status etcd