etcd集群部署

2021-08-21 08:42:58 字數 1163 閱讀 8792

1、需要至少兩台伺服器,

節點1:etd-1 192.168.0.1

節點2:etd-2 192.168.0.2

2、系統版本:centos7

3、埠2379、2380、4001的開放

一、重複以上步驟,不同的是配置檔案vim /etc/etcd/conf.yml,為

name: etcd-2

data-dir: /opt/etcd/data

listen-client-urls:

advertise-client-urls:

listen-peer-urls:

initial-advertise-peer-urls:

initial-cluster-token: etcd-cluster-token

initial-cluster-state: new

initial-cluster: etcd-1=,etcd-2=

1、檢視集群的節點列表

etcdctl member list

27bff32661a83e07: name=etcd-1 peerurls= clienturls= isleader=true

34dgg34dfdsf2e32: name=etcd-2 peerurls= clienturls= isleader=true

2、檢視集群節點健康狀態

etcdctl cluster-health

3、ectd讀寫操作

基於http協議的api使用起來比較簡單,這裡主要通過etcdctl和curl兩種方式來做簡單介紹。

下面通過給message key設定hello值示例:

etcdctl set /message hello

hello

$ curl -x put -d value="hello"

}讀取message的值:

etcdctl  get /message

hello

$ curl

}刪除message key:

部署ETCD集群

環境介紹 10.0.0.179 etcd01 10,0,0,180 etcd02 10,0,0.181 etcd03 1.安裝cfssl證書生成工具 yum install y wget wget wget wget chmod x cfssl linux amd64 cfssljson linux...

etcd集群部署

提取碼 7571 etcd v3.4.13 linux amd64.tar.gz root localhost ansible tree etcd install etcd install conf run.sh etcd.yml id rsa inv readme.txt run.shetcd.y...

linux centos 部署etcd集群

本文是在單台機器上搭建集群,多台搭建同理且更簡單,因為不用考慮埠以及各種目錄衝突問題,配置幾乎大多一樣,細微差別會在文中指出。cd opt wget tar zxvf etcd v3.3.10 linux amd64.tar.gz mv etcd v3.3.10 linux amd64 etcd c...