Skip to content

Instantly share code, notes, and snippets.

@robertkraig-bambee
Forked from sats17/consul-cheatsheet.md
Created March 30, 2022 20:21
Show Gist options
  • Select an option

  • Save robertkraig-bambee/2aeaed388144c9b5e572c0de28e8b964 to your computer and use it in GitHub Desktop.

Select an option

Save robertkraig-bambee/2aeaed388144c9b5e572c0de28e8b964 to your computer and use it in GitHub Desktop.
Contains cheetsheet for consul
1) Start consul cluster -
# consul agent -server -bootstrap-expect=1 -data-dir=consul-data -ui -bind=127.0.0.1
2) put key-values
# consul kv put config/key value
3) get key-values -
# consul kv get config/key
4) get keys from consul with host and acl-token(Your own hosted consul) -
# consul kv get -http-addr=my.consul.test.com -token=0000-0000-0000-00000 config/key
4) export key-values(Will export from config path) -
# consul kv export config
5) export key-values from root path -
# consul kv export
6) export key-values to json file -
# consul kv export config >export.json
7) import key-values -
# consul kv import @import.json
8) Example json file format of consul to import/export -
Example json file -
[
{
"key": "config"
"flags": 0,
"value": "aGVsbG8="
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment