1

我可以使用 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

谁能帮我?

4

1 回答 1

0

尝试

etcdctl -C 10.12.1.105:2379 ls --recursive

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

于 2016-08-13T06:15:32.597 回答