日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

docker (centOS 7) 使用笔记4 - etcd服务

發布時間:2025/4/16 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 docker (centOS 7) 使用笔记4 - etcd服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本次測試的系統包含centos 7.2 64 bit,centos 7.3 64 bit

1. 安裝

yum -y install etcd

2. 配置

此處一共準備了3臺機器(10.10.10.100, 10.10.10.101,?10.10.10.102)?

(1) etcd服務的配置和啟動方式

啟用etcd服務

systemctl enable etcd

修改服務配置?/etc/systemd/system/multi-user.target.wants/etcd.service,其中的啟動指令(ExecStart=)

修改配置后,裝載配置,重啟服務

systemctl daemon-reload systemctl restart etcd

啟動成功后,可以看到新增加了2個監聽端口:2379, 2380

?

(2) 集群配置

第1個節點(10.10.10.100) (注意:第一次啟動時,--initial-cluster-state new,啟動成功后,集群已經創建,此時需修改為 ?--initial-cluster-state existing。否則下次重啟服務會失敗。):

ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd0\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.100:2379\" --initial-advertise-peer-urls=\"http://10.10.10.100:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" --initial-cluster-state new "?

后面的節點可以先手工添加信息:

etcdctl member add etcd1 http://10.10.10.101:2380
etcdctl member add etcd2 http://10.10.10.102:2380??

第2個節點(10.10.10.101):

ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd1\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.101:2379\" --initial-advertise-peer-urls=\"http://10.10.10.101:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" "

第3個節點(10.10.10.102):

ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"etcd2\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"http://0.0.0.0:2379\" --listen-peer-urls=\"http://0.0.0.0:2380\" --advertise-client-urls=\"http://10.10.10.102:2379\" --initial-advertise-peer-urls=\"http://10.10.10.102:2380\" --initial-cluster-token=\"etcd-cluster-1\" --initial-cluster=\"etcd0=http://10.10.10.100:2380,etcd1=http://10.10.10.101:2380,etcd2=http://10.10.10.102:2380\" "

啟動成功后可以查看集群狀態,member 列表

# etcdctl cluster-health member 17294cb126466d4d is healthy: got healthy result from http://10.10.10.100:2379 member a17abe451cf50cbd is healthy: got healthy result from http://10.10.10.101:2379 member f4a143b3a5f1cdf7 is healthy: got healthy result from http://10.10.10.102:2379 cluster is healthy # etcdctl member list 17294cb126466d4d: name=etcd2 peerURLs=http://10.10.10.100:2380 clientURLs=http://10.28.148.46:2379 isLeader=false a17abe451cf50cbd: name=etcd0 peerURLs=http://10.10.10.101:2380 clientURLs=http://10.28.148.61:2379 isLeader=true f4a143b3a5f1cdf7: name=etcd1 peerURLs=http://10.10.10.102:2380 clientURLs=http://10.28.148.57:2379 isLeader=false

?

轉載于:https://www.cnblogs.com/got-my-way/p/7520449.html

總結

以上是生活随笔為你收集整理的docker (centOS 7) 使用笔记4 - etcd服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。