[root@test-k8s-master-1 ~]# which etcd
/usr/local/bin/etcd
[root@test-k8s-master-1 ~]# etcd --version
etcd Version: 3.5.2
Git SHA: 99018a77b
Go Version: go1.16.3
Go OS/Arch: linux/amd64
[root@test-k8s-master-1 ~]# systemctl status etcd.service
● etcd.service - Etcd Server
Loaded: loaded (/etc/systemd/system/etcd.service; enabled; vendor preset: disabled)
Active: active (running) since 三 2023-03-15 17:36:10 CST; 1 weeks 5 days ago
Docs: https://github.com/coreos
Main PID: 1010 (etcd)
Tasks: 12
Memory: 502.1M
CGroup: /system.slice/etcd.service
└─1010 /usr/local/bin/etcd --name=etcd-test-k8s-master-1 --cert-file=/etc/kubernetes/pki/etcd/server.crt -...
3月 28 16:36:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:36:33.335+0800","caller":"mvc...0783}
3月 28 16:36:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:36:33.350+0800","caller":"mvc...5ms"}
3月 28 16:41:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:41:33.338+0800","caller":"mvc...1258}
3月 28 16:41:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:41:33.351+0800","caller":"mvc...5ms"}
3月 28 16:46:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:46:33.354+0800","caller":"mvc...1745}
3月 28 16:46:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:46:33.367+0800","caller":"mvc...3ms"}
3月 28 16:51:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:51:33.359+0800","caller":"mvc...2226}
3月 28 16:51:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:51:33.372+0800","caller":"mvc...9ms"}
3月 28 16:56:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:56:33.364+0800","caller":"mvc...2712}
3月 28 16:56:33 test-k8s-master-1 etcd[1010]: {"level":"info","ts":"2023-03-28T16:56:33.380+0800","caller":"mvc...1ms"}
Hint: Some lines were ellipsized, use -l to show in full.
[root@test-k8s-master-1 ~]# cat /etc/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos
[Service]
Type=notify
WorkingDirectory=/var/lib/etcd
ExecStart=/usr/local/bin/etcd \
--name=etcd-test-k8s-master-1 \
--cert-file=/etc/kubernetes/pki/etcd/server.crt \
--key-file=/etc/kubernetes/pki/etcd/server.key \
--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt \
--peer-key-file=/etc/kubernetes/pki/etcd/peer.key \
--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt \
--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt \
--initial-advertise-peer-urls=https://10.16.16.111:2380 \
--listen-peer-urls=https://10.16.16.111:2380 \
--listen-client-urls=https://10.16.16.111:2379,http://127.0.0.1:2379 \
--advertise-client-urls=https://10.16.16.111:2379 \
--initial-cluster-token=etcd-cluster-token \
--initial-cluster=etcd-test-k8s-master-1=https://10.16.16.111:2380 \
--initial-cluster-state=new \
--data-dir=/var/lib/etcd \
--snapshot-count=50000 \
--auto-compaction-retention=1 \
--max-request-bytes=10485760 \
--quota-backend-bytes=8589934592
Restart=always
RestartSec=15
LimitNOFILE=65536
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target