欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

etcd的使用详解

程序员文章站 2022-07-13 22:39:35
...

etcd的使用详解

安装



wget https://github.com/etcd-io/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-amd64.tar.gz
tar -xzvf etcd-v3.3.10-linux-amd64.tar.gz
cp -av ./etcd-v3.3.10-linux-amd64 /usr/local/etcd
cd  /usr/local/etcd
mkdir data
mkdir config
cd config
cat <<EOF | sudo tee /opt/etcd/config/etcd.conf
#节点名称
ETCD_NAME=$(hostname -s)
#数据存放位置
ETCD_DATA_DIR=/var/lib/etcd
EOF

 vim  /etc/systemd/system/etcd.service
#写入
[Unit]
Description=Etcd Server
Documentation=https://github.com/coreos/etcd
After=network.target


[Service]
User=root
Type=notify
EnvironmentFile=/usr/local/etcd/config/etcd.conf
ExecStart=/usr/local/etcd/etcd
Restart=on-failure
RestartSec=10s
LimitNOFILE=40000

[Install]
WantedBy=muilt-user.target
# 写入配置结束

#注册到系统服务
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
systemctl status etcd.service
 
 ln -s /usr/local/etcd/etcdctl /usr/local/bin/etcdctl
 ln -s /usr/local/etcd/etcd /usr/local/bin/etcd