My aim is to try in case of disaster for one of the sentinel installation, I’d like to restore that dataset on the second redis-sentinel installation. So, it’s basically a geographical redundancy and multiple datacenter kind of work.
There are 2 sentinel installation within a kubernetes environment in my local using minikube, where for each sentinel there are 1 master and 2 worker nodes. Snapshot is enabled for both installation, for the sake of explanation A and B will be the locations of those installations.
I did some test in my local computer, I copied the dataset of A’s snapshot into the default directory of B’s master instance which is /data
. When I did that, I also noticed same file appeared within the minikube vm, which is the mounted directory I guess, which is in the path of tmp/hostpath-provisioner/default/{redis-instance-name}
.
B’s redis instances had no key added yet, hence, empty dataset. Now I did try couple of different techniques to dump/restore this rdb file into B’s master instance.
I did try such a command;
redis-cli --rdb dump.rdb
, as I was following logs of the master instance, I executed this command and logs appeared as follows;
1:M 06 Jun 2024 13:05:22.811 * Replica 127.0.0.1:<unknown-replica-port> asks for synchronization
1:M 06 Jun 2024 13:05:22.811 * Delay next BGSAVE for diskless SYNC
1:M 06 Jun 2024 13:05:27.914 * Starting BGSAVE for SYNC with target: replicas sockets
1:M 06 Jun 2024 13:05:27.914 * Background RDB transfer started by pid 69396
1:M 06 Jun 2024 13:05:27.916 * Connection with replica 127.0.0.1:<unknown-replica-port> lost.
69396:C 06 Jun 2024 13:05:27.917 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
1:M 06 Jun 2024 13:05:27.917 * Diskless rdb transfer, done reading from pipe, 0 replicas still up.
1:M 06 Jun 2024 13:05:28.015 * Background RDB transfer terminated with success
It did not add the keys within the dump.rdb file into redis.
Main aim is to actually not to disturb existing redis. So, uninstalling redis and installing it again with helm or since it’s inside k8s environment, scaling out to 0 and scaling it to 3 again are not option. Because while keys are added to the redis through dump.rdb file, I also want existing Redis to server incoming requests.