etcd
etcd集群部署
Etcd安全配置之Basic Auth认证
etcd 客户端
本文档使用 MrDoc 发布
-
+
首页
etcd集群部署
etcd github 3.5.0 版本 https://github.com/etcd-io/etcd/releases/tag/v3.5.0 ``` wget https://github.com/etcd-io/etcd/releases/download/v3.5.0/etcd-v3.5.0-linux-amd64.tar.gz ``` ## 集群配置文件 /etc/目录下建立etcd.conf ``` name: 'etcd2' #每个节点名称不一样 data-dir: '/data' wal-log: '/wal' snapshot-count: 10000 heartbeat-interval: 100 election-timeout: 1000 listen-peer-urls: 'http://192.168.198.101:2380' #本机ip listen-client-urls: 'http://192.168.198.101:2379' #本机ip max-snapshots: 5 max-wals: 5 cors: initial-advertise-peer-urls: 'http://192.168.198.101:2380' #本机ip advertise-client-urls: 'http://192.168.198.101:2379' #本机ip initial-cluster: 'etcd1=http://192.168.198.100:2380,etcd2=http://192.168.198.101:2380,etcd3=http://192.168.198.102:2380' initial-cluster-token: 'etcd' initial-cluster-state: 'new' strict-reconfig-check: false enable-v2: true enable-pprof: true debug: false logger: zap log-outputs: [stderr] # 启用身份验证 auth: simple # 用户名和密码 user: your_username password: your_password ``` ## 启动方式 ### 命令 ``` etcd --config-file /etc/etcd.conf > /wal/etcd1.log 2>&1 & ``` ### service ``` cat << EOF > /lib/systemd/system/etcd.service [Unit] Description=etcd service Documentation=https://github.com/coreos/etcd [Service] User=root Type=notify ExecStart=/usr/local/etcd \\ --name etcd-3 \\ --data-dir /data \\ --initial-advertise-peer-urls http://192.168.198.102:2380 \\ --listen-peer-urls http://192.168.198.102:2380 \\ --listen-client-urls http://192.168.198.102:2379,http://127.0.0.1:2379 \\ --advertise-client-urls http://192.168.198.102:2379 \\ --initial-cluster-token etcd-cluster \\ --initial-cluster etcd-1=http://192.168.198.100:2380,etcd-2=http://192.168.198.101:2380,etcd-3=http://192.168.198.102:2380 \\ --initial-cluster-state new \\ --heartbeat-interval 1000 \\ --election-timeout 5000 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF ``` ``` sudo systemctl daemon-reload sudo systemctl enable etcd sudo systemctl start etcd ``` ``` cat << EOF > /lib/systemd/system/etcd.service [Unit] Description=etcd service Documentation=https://github.com/coreos/etcd [Service] User=root Type=notify ExecStart=/root/etcd/etcd --config-file /etc/etcd.conf Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF ```
admin
2023年6月29日 17:30
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码