Created
June 5, 2018 22:24
-
-
Save navidurrahman/1281059269eae4ba9a265e6d3b2ee19e to your computer and use it in GitHub Desktop.
Migrate data etcd to consul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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