Skip to content

Instantly share code, notes, and snippets.

@sats17
Last active December 23, 2024 06:36
Show Gist options
  • Save sats17/d5abad018745185c2f702b4709888068 to your computer and use it in GitHub Desktop.
Save sats17/d5abad018745185c2f702b4709888068 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

  1. put key-values

consul kv put config/key value

  1. get key-values -

consul kv get config/key

  1. 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

  1. export key-values(Will export from config path) -

consul kv export config

  1. export key-values from root path -

consul kv export

  1. export key-values to json file -

consul kv export config >export.json

  1. import key-values -

consul kv import @import.json

  1. 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