一、简介
etcd is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines. It gracefully handles leader elections during network partitions and can tolerate machine failure, even in the leader node
二、下载
官网地址:https://etcd.io/ 点击quickStart 点击截图链接 下载最新windows版本即可
三、集群配置
属性配置文件可查看各版本的configuration.md文件,此处以3.4为例 https://github.com/etcd-io/etcd/tree/release-3.4/Documentation/op-guide 单节点集群配置,其他节点修改指定的几个变量即可
etcd1.bat(此处的配置是直接加在启动命令后,也可将配置写在指定的文件中–具体查看configuration.md)
-- On each etcd node, specify the cluster members
set TOKEN=token-01
set CLUSTER_STATE=new
set NAME_1=etcd1
set NAME_2=etcd2
set NAME_3=etcd3
set HOST_1=127.0.0.1:2379
set LISTEN_HOST_1=127.0.0.1:2380
set HOST_2=127.0.0.1:2479
set LISTEN_HOST_2=127.0.0.1:2480
set HOST_3=127.0.0.1:2579
set LISTEN_HOST_3=127.0.0.1:2580
set CLUSTER=%NAME_1%=http://%LISTEN_HOST_1%,%NAME_2%=http://%LISTEN_HOST_2%,%NAME_3%=http://%LISTEN_HOST_3%
-- Run this on each machine
-- node1
set THIS_NAME=%NAME_1%
set THIS_IP=%HOST_1%
set THIS_LISTEN_IP=%LISTEN_HOST_1%
D:\Users\zhiqiangzhou\Desktop\etcd-v3.2.32-windows-amd64\etcd.exe --data-dir=%THIS_NAME% --name=%THIS_NAME% --initial-advertise-peer-urls=http://%THIS_LISTEN_IP% --listen-peer-urls=http://%THIS_LISTEN_IP% --advertise-client-urls=http://%THIS_IP% --listen-client-urls=http://%THIS_IP% --initial-cluster=%CLUSTER% --initial-cluster-state=%CLUSTER_STATE% --initial-cluster-token=%TOKEN% --log-package-levels=info
-- node2
-- set THIS_NAME=%NAME_2%
-- set THIS_IP=%HOST_2%
-- set THIS_LISTEN_IP=%LISTEN_HOST_2%
-- D:\Users\zhiqiangzhou\Desktop\etcd-v3.2.32-windows-amd64\etcd.exe --data-dir=%THIS_NAME% --name=%THIS_NAME% --initial-advertise-peer-urls=http://%THIS_LISTEN_IP% --listen-peer-urls=http://%THIS_LISTEN_IP% --advertise-client-urls=http://%THIS_IP% --listen-client-urls=http://%THIS_IP% --initial-cluster=%CLUSTER% --initial-cluster-state=%CLUSTER_STATE% --initial-cluster-token=%TOKEN% --log-package-levels=info
-- node3
-- set THIS_NAME=%NAME_3%
-- set THIS_IP=%HOST_3%
-- set THIS_LISTEN_IP=%LISTEN_HOST_3%
-- D:\Users\zhiqiangzhou\Desktop\etcd-v3.2.32-windows-amd64\etcd.exe --data-dir=%THIS_NAME% --name=%THIS_NAME% --initial-advertise-peer-urls=http://%THIS_LISTEN_IP% --listen-peer-urls=http://%THIS_LISTEN_IP% --advertise-client-urls=http://%THIS_IP% --listen-client-urls=http://%THIS_IP% --initial-cluster=%CLUSTER% --initial-cluster-state=%CLUSTER_STATE% --initial-cluster-token=%TOKEN% --log-package-levels=info
四、验证
安装etcdmanager客户端 验证效果如下图
|