1 Star 0 Fork 1

范钟 / etcd-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
客户端命令行.md 598 Bytes
一键复制 编辑 原始数据 按行查看 历史
范钟 提交于 2019-03-12 23:12 . 基础练习

ETCD命令行

必须加的前缀

ETCDCTL_API=3

基本命令

  • 新增字段
==> etcdctl put "name" "zhangsan"
OK
  • 查询字段
==> etcdctl get "name"
name
zhangsan
  • 删除字段
==> etcdctl del name
1
  • 查询某一个目录下的所有类容

当带有某个前缀的内容全部返回

==> etcdctl get /cron/jobs --prefix
/cron/jobs/job1
{hi:hello job1}
/cron/jobs/job2
{hi:hello world!!!}
  • watch机制

会自动监听key值得变化

==> etcdctl watch "/cron/jobs/" --prefix
PUT
/cron/jobs/job3
zhangsan

DELETE
/cron/jobs/job3
Go
1
https://gitee.com/zfan_codes/etcd-demo.git
git@gitee.com:zfan_codes/etcd-demo.git
zfan_codes
etcd-demo
etcd-demo
master

搜索帮助