• consul kv导出和导入(备份)


    导出

    consul kv export -http-addr=ip:8500  -token="xxxx-xxxx-xxxx-xxxx-xxxxxx" > consul-kv.json

    导入
    consul kv import -http-addr=ip:8500  -token="xxxx-xxxx-xxxx-xxxx-xxxxxx" @/tmp/consul-kv.json

    cat consul-kv.json | consul kv import  -http-addr=ip:9500 -token="xxxx-xxxx-xxxx-xxxx-xxxxxx" -

    ============未整理

    /root/consul1.2.4 kv get -keys -http-addr=http://192.168.55.122:9500 -token="918c2471-504e-4104-8435-8547d08231e7"
    /root/consul1.2.4 kv get -keys -separator -http-addr=http://192.168.55.122:9500 -token="918c2471-504e-4104-8435-8547d08231e7"


    curl -s http://192.168.55.122:9500/v1/kv/jm?token="918c2471-504e-4104-8435-8547d08231e7"

    curl -s http://192.168.55.122:9500/v1/kv/jm/db1/?token="918c2471-504e-4104-8435-8547d08231e7"
    curl -s http://192.168.55.122:9500/v1/kv/test01/conf/a?token="918c2471-504e-4104-8435-8547d08231e7"

    =====================
    curl -s http://192.168.55.122:9500/v1/kv?/recurse?token="918c2471-504e-4104-8435-8547d08231e7"

    curl -s http://192.168.55.122:9500/v1/kv/test01/conf/a?token="918c2471-504e-4104-8435-8547d08231e7"

    rm -rf test.log
    rm -rf aa
    /root/consul1.2.4 get -keys -separator -http-addr=http://192.168.20.70:8500 | grep ':'| awk -F':' '{print $1}' >> aa
    for i in `cat aa`
    do
    curl -s http://192.168.20.70:8500/v1/kv/$i | tr ',' ' ' | egrep -w 'Key|Value' | xargs -n2 >> test.log
    done

    =========================

    /root/consul1.2.4 kv get -recurse -http-addr=http://192.168.55.122:9500 -token="918c2471-504e-4104-8435-8547d08231e7" > new.log
    /root/consul1.2.4 kv get -recurse -http-addr=http://192.168.55.122:8500 -token="918c2471-504e-4104-8435-8547d08231e7" > old.log
    new_md5=$(md5sum new.log | awk '{print $1}')
    old_md5=$(md5sum old.log | awk '{print $1}')

    if [[ $new_md5 == $old_md5 ]];then
    echo "New and old consul configuration consistent"
    else
    echo "New and old consul configuration inconsistent"
    fi

  • 相关阅读:
    spring aop实现数据库的读写分离
    MySQL主从复制(Master-Slave)实践
    java 注解 Annontation
    java NIO介绍
    为什么你学不会递归?告别递归,谈谈我的一些经验(转)
    maven的安装、路径配置、修改库文件路径和eclipse中的配置、创建maven工程(转)
    Eclipse中创建Maven多模块工程
    Eclipse的Working Set管理项目
    Java使用POI读取和写入Excel指南(转)
    Webpack安装和命令
  • 原文地址:https://www.cnblogs.com/imdba/p/14004277.html
Copyright © 2020-2023  润新知