当我写好我的
etcd.service
文件,并使用systemctl start etcd.service
命令运行时,它给出了这个错误:
etcd.service - ve489 etcd service
Loaded: loaded (/lib/systemd/system/etcd.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2022-06-18 20:59:50 PDT; 3s ago
Docs: https://github.com/etcd-io/etcd
Process: 13415 ExecStart=/usr/local/bin/etcd --name ubuntu20 --data-dir /var/lib/etcd --initial-advertise-peer-urls http://192.168.159.128:2380 --listen-peer-urls http://192.168.159.128:2380 --listen-client-urls http://192.168.159.128:2379,http://127.0.0.1:2379 --advertise-client-urls http://192.168.159.128:2379 --initial-cluster-token etcd-cluster-1 --initial-cluster etcd-1=http://192.168.159.128:2380,etcd-2=http://192.168.159.129:2380 --initial-cluster-state new --heartbeat-interval 1000 --election-timeout 5000 (code=exited, status=1/FAILURE)
Main PID: 13415 (code=exited, status=1/FAILURE)
而文件中的源代码
etcd.service
是
[Unit]
Description=ve489 etcd service
Documentation=https://github.com/etcd-io/etcd
[Service]
User=root
Type=notify
ExecStart=/usr/local/bin/etcd \
--name ubuntu20 \
--data-dir /var/lib/etcd \
--initial-advertise-peer-urls http://192.168.159.128:2380 \
--listen-peer-urls http://192.168.159.128:2380 \
--listen-client-urls http://192.168.159.128:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://192.168.159.128:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd-1=http://192.168.159.128:2380,etcd-2=http://192.168.159.129:2380 \
--initial-cluster-state new \
--heartbeat-interval 1000 \
--election-timeout 5000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
和
journalctl -xe
命令给出了这个:
Jun 18 21:03:57 ubuntu systemd[1]: etcd.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit etcd.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jun 18 21:03:57 ubuntu systemd[1]: etcd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit etcd.service has entered the 'failed' state with result 'exit-code'.
Jun 18 21:03:57 ubuntu systemd[1]: Failed to start ve489 etcd service.
-- Subject: A start job for unit etcd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit etcd.service has finished with a failure.
--
-- The job identifier is 38547 and the job result is failed.
我是一个新人,需要与
etcd
取得联系,所以我不知道出了什么问题,有人可以帮我解决这个问题吗?
我有同样的问题。这是我的解决方案。
首先使用 systemctl 停止 etcd 服务
systemctl stop etcd.service
然后,查看端口是否被占用
lsof -i:2380
如果被占用杀死pid
kill -9 xxx
最后,启动etcd服务
systemctl start etcd.service