Etcd v3.3.10 버전 배포(클러스터 3대)

Etcd v3.3.10 버전 배포(클러스터 3대)


계획


etcd01
etcd02
etc03
192.168.100.100
192.168.100.101
192.168.100.102

소프트웨어 패키지

 cfssl:

mkdir /data/ssl -p

cd /data/
wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
wget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64

chmod +x cfssl_linux-amd64 cfssljson_linux-amd64 cfssl-certinfo_linux-amd64

mv cfssl_linux-amd64 /usr/local/bin/cfssl
mv cfssljson_linux-amd64 /usr/local/bin/cfssljson
mv cfssl-certinfo_linux-amd64 /usr/bin/cfssl-certinfo

cd /data/ssl/
 :https://github.com/etcd-io/etcd/releases/tag/v3.3.10
  etcd-v3.3.10-linux-amd64.tar.gz

키 생성

mkdir /data/ssl/etcd
cd /data/ssl/etcd

vim etcd.sh
# etcd
# cat ca-config.json
cat > ca-config.json < ca-csr.json < server-csr.json <

배치하다


3개 노드 모두 작동
mkdir /data/src/
cd /data/src/

mkdir /opt/etcd/{bin,cfg,ssl} -p
tar xf etcd-v3.3.10-linux-amd64.tar.gz
mv etcd-v3.3.10-linux-amd64/{etcd,etcdctl} /opt/etcd/bin/

vim /opt/etcd/cfg/etcd   
# 3  ETCD_NAME     IP  
#[Member]
ETCD_NAME="etcd01"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.100.100:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.100.100:2379"

#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.100.100:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.100.100:2379"
ETCD_INITIAL_CLUSTER="etcd01=https://192.168.100.100:2380,etcd02=https://192.168.100.101:2380,etcd03=https://192.168.100.102:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"

* ETCD_NAME  
* ETCD_DATA_DIR  
* ETCD_LISTEN_PEER_URLS  
* ETCD_LISTEN_CLIENT_URLS  
* ETCD_INITIAL_ADVERTISE_PEER_URLS  
* ETCD_ADVERTISE_CLIENT_URLS  
* ETCD_INITIAL_CLUSTER  
* ETCD_INITIAL_CLUSTER_TOKEN  Token
* ETCD_INITIAL_CLUSTER_STATE  ,new ,existing 

vim   /usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd
ExecStart=/opt/etcd/bin/etcd \
--name=${ETCD_NAME} \
--data-dir=${ETCD_DATA_DIR} \
--listen-peer-urls=${ETCD_LISTEN_PEER_URLS} \
--listen-client-urls=${ETCD_LISTEN_CLIENT_URLS},http://127.0.0.1:2379 \
--advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} \
--initial-advertise-peer-urls=${ETCD_INITIAL_ADVERTISE_PEER_URLS} \
--initial-cluster=${ETCD_INITIAL_CLUSTER} \
--initial-cluster-token=${ETCD_INITIAL_CLUSTER_TOKEN} \
--initial-cluster-state=new \
--cert-file=/opt/etcd/ssl/server.pem \
--key-file=/opt/etcd/ssl/server-key.pem \
--peer-cert-file=/opt/etcd/ssl/server.pem \
--peer-key-file=/opt/etcd/ssl/server-key.pem \
--trusted-ca-file=/opt/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

cp /data/ssl/etcd/ca*pem  /opt/etcd/ssl/
cp /data/ssl/etcd/server*pem  /opt/etcd/ssl/

scp  /data/ssl/etcd/ca*pem  root@node01:/opt/etcd/ssl/
scp  /data/ssl/etcd/ca*pem  root@node02:/opt/etcd/ssl/
scp  /data/ssl/etcd/server*pem  root@node01:/opt/etcd/ssl/
scp  /data/ssl/etcd/server*pem  root@node02:/opt/etcd/ssl/

##  
systemctl enable etcd
systemctl start etcd

검열

 :  
cd /data/ssl/etcd/
/opt/etcd/bin/etcdctl --ca-file=ca.pem --cert-file=server.pem --key-file=server-key.pem --endpoints="https://192.168.100.100:2379,https://192.168.100.101:2379,https://192.168.100.102:2379" cluster-health
member 65f49728d3d54972 is healthy: got healthy result from https://192.168.100.100:2379
member d94ba21c17c75ffb is healthy: got healthy result from https://192.168.100.101:2379
member dc51f874259f7894 is healthy: got healthy result from https://192.168.100.102:2379
cluster is healthy

#  :/var/log/message   journalctl -u etcd

좋은 웹페이지 즐겨찾기