consulcli
help
# consul kv --help
Usage: consul kv <subcommand> [options] [args]
This command has subcommands for interacting with Consul's key-value
store. Here are some simple examples, and more detailed examples are
available in the subcommands or the documentation.
Create or update the key named "redis/config/connections" with the value "5":
$ consul kv put redis/config/connections 5
Read this value back:
$ consul kv get redis/config/connections
Or get detailed key information:
$ consul kv get -detailed redis/config/connections
Finally, delete the key:
$ consul kv delete redis/config/connections
For more examples, ask for subcommand help or view the documentation.
Subcommands:
delete Removes data from the KV store
export Exports a tree from the KV store as JSON
get Retrieves or lists data from the KV store
import Imports a tree stored as JSON to the KV store
put Sets or updates data in the KV store
- 通过 -recurse 选项可以递归查询子键,结果按字典序排列
$ consul kv get -recurse
redis/config/maxconns:25
redis/config/minconns:1
redis/config/users/admin:abcd1234