經過命令行操做web
$ consul kv put hello world # 設置數據 Success! Data written to: hello $ consul kv get hello # 獲取數據 world $ consul kv get -detailed hello # 獲取詳細數據 CreateIndex 1466 Flags 0 Key hello LockIndex 0 ModifyIndex 1466 Session - Value world $ consul kv get -recurse # 獲取全部的數據 foo:bar hello:world $ consul kv delete hello # 刪除數據 Success! Deleted key: hello
同時也可經過 HTTP 操做shell
// http://192.168.56.101:8500/v1/kv/foo [ { "LockIndex": 0, "Key": "foo", "Flags": 0, "Value": "YmFy", "CreateIndex": 1254, "ModifyIndex": 1326 } ] // http://192.168.56.101:8500/v1/kv/?keys [ "foo", "hello" ]
在啓動命令加上 -ui
,默認地址爲 http://localhost:8500/ui
, 官方 demo 例子 hereui