Cluster Manager (redis-cli): new "backup" command #5888
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the new "backup" command to redis-cli's cluster manager.
As its name suggests, it basically saves a backup of the cluster to a local directory.
The backup can be launched with:
redis-cli --cluster backup NODE_IP:NODE_PORT BACKUP_DIRECTORYwhere NODE_IP:NODE_PORT is the entry point address of the cluster (as usual).
ie.
redis-cli --cluster backup 127.0.0.1:7000 /tmp/mycluster_backupThe backup will consist of:
The nodes.json file will contain something like this:
The command will perform an preliminary check on the cluster. If the cluster has some problem,
the backup will be saved anyway, but it will display a warning message and the number of errors found will be saved inside every node in nodes.json (ie.
"cluster_errors": 2).In the next days I'll add more info to nodes.json (ie. migrating/importing slots), and in the near future I'll also implement a "restore" command. Anyway, at the moment, the backup can be manually restored by using the saved rdb files and info taken from the node.json.