Skip to content
鼓励作者:欢迎打赏犒劳

ETCD注册中心

官网:https://etcd.io/

windows安装

下载地址 :https://github.com/etcd-io/etcd/releases/

解压,双击执行etcd.exe即可

默认情况下,etcd 会监听:

  • 客户端连接:127.0.0.1:2379
  • 对等节点通信:127.0.0.1:2380

常用命令

  1. 设置键值对
bash
etcdctl.exe put mykey "Hello etcd"

成功会返回:OK

  1. 获取键值
bash
etcdctl.exe get mykey

会返回:

mykey
Hello etcd
  1. 删除键
bash
etcdctl.exe del mykey

会返回删除的数量:1

  1. 查看所有键
bash
etcdctl.exe get --prefix ""
  1. 设置带过期时间的键(例如 60 秒后过期)
bash
etcdctl.exe put --ttl 60 tempkey "I will expire in 60s"

如有转载或 CV 的请标注本站原文地址