Skip to content

Instantly share code, notes, and snippets.

@shanielh
Created March 8, 2016 14:22
Show Gist options
  • Save shanielh/828d9750dd3a082df9f9 to your computer and use it in GitHub Desktop.
Save shanielh/828d9750dd3a082df9f9 to your computer and use it in GitHub Desktop.
consul migrate
# Consul KVP migration tool requires jq, base64 and curl
# sudo apt-get update && sudo apt-get install -y curl jq # coreutils (Comes with ubuntu)
echo "Migrating consul from $1 to $2"
curl "http://$1:8500/v1/kv/?recurse" | jq 'map("curl \"http://NEW_ADDR:8500/v1/kv/\(.Key)\" -XPUT -d \"$(echo \"\(.Value)\" | base64 --decode)\"")[]' -r | sed "s/NEW_ADDR/$2/g" | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment