CentOS7 部署高可用 ETCD 3.5.0 (TLS) + ETCD UI 管理
CentOS7 部署高可用 ETCD 3.5.0 (TLS) + ETCD UI 管理
下载地址:
- ETCD 3.5.0: https://github.com/etcd-io/etcd/releases/tag/v3.5.0
- ETCD UI: https://github.com/etcd-io/etcd/releases/tag/v3.5.0
部署步骤:
- 下载并解压 ETCD 3.5.0
wget https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz
tar -xvf etcd-v3.5.0-linux-amd64.tar.gz
cd etcd-v3.5.0-linux-amd64
- 生成证书 首先需要生成 CA 证书,然后使用 CA 证书签名 etcd 证书。
生成 CA 证书:
openssl genrsa -out ca-key.pem 2048
openssl req -x509 -new -nodes -key ca-key.pem -days 10000 -out ca.pem -subj "/CN=etcd-ca"
生成 etcd 证书:
openssl genrsa -out server-key.pem 2048
openssl req -new -key server-key.pem -out server.csr -subj "/CN=etcd-server" -config openssl.cnf
openssl x509 -req -in server.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server.pem -days 3650 -extensions v3_req -extfile openssl.cnf
- 配置 etcd 集群
./etcd --name node1 --initial-advertise-peer-urls https://192.168.1.101:2380 \
--listen-peer-urls https://192.168.1.101:2380 \
--listen-client-urls https://192.168.1.101:2379,https://127.0.0.1:2379 \
--advertise-client-urls https://192.168.1.101:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster node1=https://192.168.1.101:2380,node2=https://192.168.1.102:2380,node3=https://192.168.1.103:2380 \
--initial-cluster-state new \
--cert-file=/path/to/server.pem --key-file=/path/to/server-key.pem --trusted-ca-file=/path/to/ca.pem --peer-cert-file=/path/to/server.pem --peer-key-file=/path/to/server-key.pem --peer-trusted-ca-file=/path/to/ca.pem
注意: 需要将上述命令中的 IP 地址和路径替换为实际情况。
- 部署 etcd UI
wget https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz
tar -xvf etcd-v3.5.0-linux-amd64.tar.gz
cd etcd-v3.5.0-linux-amd64
修改 etcd-ui 的配置文件 config.json:
{
"etcd": {
"hosts": [
"https://192.168.1.101:2379",
"https://192.168.1.102:2379",
"https://192.168.1.103:2379"
],
"ca": "/path/to/ca.pem",
"cert": "/path/to/server.pem",
"key": "/path/to/server-key.pem"
},
"server": {
"port": 8080,
"tls": {
"ca": "/path/to/ca.pem",
"cert": "/path/to/server.pem",
"key": "/path/to/server-key.pem"
}
}
}
- 启动 etcd UI
./etcd-ui -config-file=config.json
- 访问 etcd UI
在浏览器中输入
https://ip:8080即可访问 etcd UI。
注意: 请根据实际情况修改以上命令中的 IP 地址、端口号和路径。
其他说明:
- 本指南仅供参考,具体部署步骤可能根据您的环境有所不同。
- 建议您阅读官方文档以获取更多详细的信息。
- 在进行实际部署之前,请做好备份工作,以防数据丢失。
原文地址: https://www.cveoy.top/t/topic/ndAB 著作权归作者所有。请勿转载和采集!