Page tree

如需转载请标注内容地址为: https://wiki.shileizcc.com/confluence/display/etcd/Etcd+Systemd

Skip to end of metadata
Go to start of metadata

请在使用站内资源的同时不要恶意进行爬取或倒链等行为,感谢支持!

Etcd Systemd

写入 Systemd 启动脚本:

/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Service
After=syslog.target network.target

[Service]
Type=notify
ExecStart=/usr/local/bin/etcd --name=onfra0 \
    --listen-client-urls=https://0.0.0.0:2379 \
    --listen-peer-urls=https://0.0.0.0:2380 \
    --advertise-client-urls=https://192.168.111.201:2379 \
    --initial-advertise-peer-urls=https://192.168.111.201:2380 \
    --client-cert-auth \
    --peer-client-cert-auth \
    --auto-tls \
    --peer-auto-tls \
    --cert-file=/certs/etcd-server.pem \
    --key-file=/certs/etcd-server-key.pem \
    --trusted-ca-file=/certs/etcd-ca.pem \
    --peer-cert-file=/certs/etcd-server.pem \
    --peer-key-file=/certs/etcd-server-key.pem \
    --peer-trusted-ca-file=/certs/etcd-ca.pem \
    --initial-cluster=onfra0=https://192.168.111.201:2380,onfra1=https://192.168.111.202:2380,onfra2=https://192.168.111.203:2380 \
    --initial-cluster-token=etcd-cluster \
    --initial-cluster-state=new \
    --data-dir=/etcd-data

ExecReload=/bin/kill -s HUP $MAINPID
Environment=
TimeoutSec=0
RestartSec=2
Restart=always

[Install]
WantedBy=multi-user.target

执行命令:

$ systemctl daemon-reload
$ systemctl start etcd
$ systemctl enable etcd
$ systemctl status etcd

文档创建于 最后一次更新于  , 文档当前的状态 正式版 , 当前编写页面的版本 V1.3.1 。

  • No labels