Skip to content

Instantly share code, notes, and snippets.

@navidurrahman
Created June 5, 2018 22:24
Show Gist options
  • Save navidurrahman/1281059269eae4ba9a265e6d3b2ee19e to your computer and use it in GitHub Desktop.
Save navidurrahman/1281059269eae4ba9a265e6d3b2ee19e to your computer and use it in GitHub Desktop.
Migrate data etcd to consul
#!/bin/bash
# Migrate data from etcd to consul
for k in $(etcdctl --peers http://<etcd_url>:4001 ls --recursive -p | grep -v "/$") ;\
do v=$(etcdctl --peers http://<etcd_url>:4001 get $k);\
curl --header "X-Consul-Token: <consul_toker>" \
--request PUT \
--data "$v" http://<consul_url>:8500/v1/kv$k;\
echo "$k = [$v]";\
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment