etcd单节点部署
环境:
OS:Centos 7
etcd:etcd-v3.5.15
1.下载地址
https://github.com/etcd-io/etcd/releases/tag/v3.5.15
直接下载编译好的二进制文件包,下载文件如下:
etcd-v3.5.15-linux-amd64.tar.gz
2.解压安装
[root@host135 milvus]# tar -xvf etcd-v3.5.15-linux-amd64.tar.gz
[root@host135 milvus]# cd etcd-v3.5.15-linux-amd64
[root@host135 etcd-v3.5.15-linux-amd64]# cp etcd /usr/local/bin/
[root@host135 etcd-v3.5.15-linux-amd64]# cp etcdctl /usr/local/bin/
[root@host135 etcd-v3.5.15-linux-amd64]# cp etcdutl /usr/local/bin/
3.设置配置文件
vi /etc/etcd.conf
内容如下:
[root@host135 etcd-v3.5.15-linux-amd64]# more /etc/etcd.conf
ETCD_NAME=default
ETCD_DATA_DIR="/home/middle/etcd/data"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.1.135:2379"
创建目录
mkdir -p /home/middle/etcd/data
4.创建开机启动文件
[root@host135 etcd-v3.5.15-linux-amd64]# more /usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
User=root
Type=notify
EnvironmentFile=-/etc/etcd.conf
ExecStart=/usr/local/bin/etcd
Restart=on-failure
RestartSec=10s
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target
5.重新加载配置 && 开机启动 && 启动etcd
依次输入以下三个命令
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
systemctl stop etcd
6.单机测试
[root@host135 etcd-v3.5.15-linux-amd64]# etcdctl put mykey "test"
OK
[root@host135 etcd-v3.5.15-linux-amd64]# etcdctl get mykey
mykey
test