【问题标题】:Can not get data with etcdctl but Can do with curl无法使用 etcdctl 获取数据,但可以使用 curl
【发布时间】:2016-08-13 14:15:32
【问题描述】:

我可以使用 curl 从 etcd 获取数据,如下所示:

core ~ $ curl http://10.12.1.105:2379/v2/keys/zk/codis/db_test
       {"action":"get","node":   {"key":"/zk/codis/db_test","dir":true,"expiration":"2016-09-   18T06:35:35.892545267Z","ttl":31535019,"nodes":    [{"key":"/zk/codis/db_test/ActionResponse","dir":true,"expiration":"2016-09-   18T06:40:45.162912721Z","ttl":31535328,"modifiedIndex":10,"createdIndex":10},
{"key":"/zk/codis/db_test/LOCK","dir":true,"expiration":"2016-09-18T06:48:07.460467703Z","ttl":31535770,"modifiedIndex":5130,"createdIndex":5130},
{"key":"/zk/codis/db_test/servers","dir":true,"modifiedIndex":5132,"createdIndex":5132},
{"key":"/zk/codis/db_test/dashboard","value":"{\"addr\": \"10.12.1.101:18087\", \"pid\": 9}","expiration":"2016-09-18T06:35:35.90202187Z","ttl":31535019,"modifiedIndex":6,"createdIndex":6},{"key":"/zk/codis/db_test/migrate_tasks","dir":true,"expiration":"2016-09-18T06:35:35.909309855Z","ttl":31535019,"modifiedIndex":7,"createdIndex":7},
{"key":"/zk/codis/db_test/slots","dir":true,"modifiedIndex":8,"createdIndex":8},
{"key":"/zk/codis/db_test/actions","dir":true,"expiration":"2016-09-18T06:40:45.15502607Z","ttl":31535328,"modifiedIndex":9,"createdIndex":9}],"modifiedIndex":5,"createdIndex":5}}

但我无法使用 etcdctl 从 etcd2 获取数据:

core@hack-day-master ~ $ etcdctl -C 10.12.1.105:2379 ls
/coreos.com

谁能帮帮我?

【问题讨论】:

  • 试试--no-sync。如果这有帮助,那么您的 etcd 集群成员身份就搞砸了。至少,领导者没有你本地代理的数据。

标签: etcd


【解决方案1】:

试试

etcdctl -C 10.12.1.105:2379 ls --recursive

--recursive 将有助于列出所有键。

【讨论】:

  • 递归与否,我的 ls 回来是空的。出于某种原因,使用etcdctl [...] get /openshift.io --prefix --keys-only 似乎可行...
  • 是的,这是 etcd v3 客户端的命令。您可以使用etcdctl version 来查看。 --recursive 应用于 v2 的 etcdctl。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-11
相关资源
最近更新 更多