Git Product home page Git Product logo

redis-transmission's Introduction

===========

Due to that cloud provider usually does not support live data migration of a cloud redis service, this tool aims to dump data from one redis-server and restore the dumped data into another redis-server.

  • RESTORE import dumped file to target redis-server
redis-transmission -mode=restore -host=127.0.0.1:6379 [-password=Auth] [-input=/path/to/file]
  • DUMP export file from source redis-server
redis-transmission -mode=dump -host=127.0.0.1:6379 [-password=Auth] [-output=/path/to/file] [-database-count=16] [-thread-count=4]
  • SYNC synchronize data from source redis-server to destination redis-server
redis-transmission -mode=sync -source=127.0.0.1:6379 -destination=127.0.0.1:6378 [-source-password=Auth] [-destination-password=Auth] [-database-count=16] [-sync-times=Count] [-thread-count=4]

Options

  • -mode=Mode

Select dump mode, or restore mode. Options: Dump, Restore.

  • -host=HostAndPort

The redis instance (host:port).

  • -password=PASSWORD

specify the redis auth password, if empty then no use this parameter.

  • -input=INPUT

use INPUT as input file

  • -output=OUTPUT

use OUTPUT as output file

  • -database-count=DATABASE-COUNT

Specify the redis database count

  • -source=NODE

The source redis instance (host:port).

  • -destination=NODE

The destination redis instance (host:port).

  • -source-password=PASSWORD

The source redis authorization password, if empty then no use this parameter.

  • -destination-password=PASSWORD

The destination redis authorization password, if empty then no use this parameter.

  • -sync-times=TIMES

synchronization times, default loop execution. Do not fill in this parameter if you need to execute it in a loop

  • -thread-count=THREAD-COUNT

Number of concurrent executions, if emtpy then use cpu cores count.

  • -replace-restore=[1|0]

If the destination-side not support restore command use replace option, please use 0 to off this feature, when off this feature, it will remove key before restore command executive, if empty then use replace option.

Examples

  • RESTORE
$ redis-transmission -mode=restore -input=./dump.json -host=127.0.0.1:6378
2018/09/17 23:22:30 Restored 9 Record(s).
  • DUMP
$ redis-transmission -mode=dump -output=./dump.json
2018/09/17 23:45:55 Dumped 9 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).
2018/09/17 23:45:55 Dumped 0 Record(s).

$ redis-transmission -mode=dump -host=127.0.0.1:6379 -output=./dump.json
2018/09/17 23:46:57 DB 0 dumped 9 Record(s).
2018/09/17 23:46:57 DB 1 dumped 0 Record(s).
2018/09/17 23:46:57 DB 2 dumped 0 Record(s).
2018/09/17 23:46:57 DB 3 dumped 0 Record(s).
2018/09/17 23:46:57 DB 4 dumped 0 Record(s).
2018/09/17 23:46:57 DB 5 dumped 0 Record(s).
2018/09/17 23:46:57 DB 6 dumped 0 Record(s).
2018/09/17 23:46:57 DB 7 dumped 0 Record(s).
2018/09/17 23:46:57 DB 8 dumped 0 Record(s).
2018/09/17 23:46:57 DB 9 dumped 0 Record(s).
2018/09/17 23:46:57 DB 10 dumped 0 Record(s).
2018/09/17 23:46:57 DB 11 dumped 0 Record(s).
2018/09/17 23:46:57 DB 12 dumped 0 Record(s).
2018/09/17 23:46:57 DB 13 dumped 0 Record(s).
2018/09/17 23:46:57 DB 14 dumped 0 Record(s).
2018/09/17 23:46:57 DB 15 dumped 0 Record(s).
  • SYNC
$ redis-transmission -mode=sync -source=127.0.0.1:6379 -destination=127.0.0.1:6378
2018/09/20 16:42:48 Starting synchronizer
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
^C

$ redis-transmission -mode=sync -source=127.0.0.1:6379 -destination=127.0.0.1:6378 -database-count=1
2018/09/20 16:42:48 Starting synchronizer
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
^C

$ redis-transmission -mode=sync -source=127.0.0.1:6379 -destination=127.0.0.1:6378 -database-count=1 -sync-times=4
2018/09/20 16:42:48 Starting synchronizer
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.
2018/09/20 16:42:48 Start 0 database thread
2018/09/20 16:42:48 Synchronized database(0) 1 records.

redis-transmission's People

Contributors

luckyboys avatar

Watchers

 avatar

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.