Giter VIP home page Giter VIP logo

consul-kv-migrate's Introduction

consul-kv-migrate

一个简单的小工具,用于在两个独立的 Consul 集群之间迁移 KV 数据和比较 KV 差异。

命令行参数

$ consul-kv-migrate -h
Usage of consul-kv-migrate:
  -action string
    	执行动作:diff-对比源和目标 Consul 配置差异,migrate-迁移源到目标并覆盖目标, 目标服务器的多余的 Key 不会被删除 (default "diff")
  -src-addr string
    	源 Consul 服务地址 (default "source-ip:8500")
  -src-token string
    	源 Consul Token
  -target-addr string
    	目标 Consul 服务地址 (default "target-ip:8500")
  -target-token string
    	目标 Consul Token

使用示例

将 192.168.1.10 的 Consul 集群上的所有 KV 同步到 192.168.2.10 的集群。

consul-kv-migrate \
    -target-addr 192.168.2.10:8500 \
    -target-token xxxxx-xxxxx-xxxxx-xxxx-xxxx \
    -src-addr 192.168.1.10:8500 \
    -src-token yyyy-yyyy-yyyyy-yyyyy-yyyy \
    -action migrate

对比 192.168.1.10 和 192.168.2.10 两个 Consul 集群的 KV 差异。

consul-kv-migrate \
    -target-addr 192.168.2.10:8500 \
    -target-token xxxxx-xxxxx-xxxxx-xxxx-xxxx \
    -src-addr 192.168.1.10:8500 \
    -src-token yyyy-yyyy-yyyyy-yyyyy-yyyy \
    -action diff

在命令行下,可以通过管道符连接 sed 's/^-/\x1b[1;31m-/;s/^+/\x1b[1;32m+/;s/^@/\x1b[1;34m@/;s/$/\x1b[0m/' 实现 diff 输出高亮显示

consul-kv-migrate's People

Contributors

mylxsw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

strongant

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.