Redis-Transmission

command module
v0.0.0-...-30ccd6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 6 Imported by: 0

README

===========

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL