Starting a Redis Cluster with an RDB File

I am trying to create a Redis cluster using an RDB file taken from a Redis server with a single instance. Here is what I tried:

#! /usr/bin/env bash
for i in 6000 6001 6002 6003
do
  redis-server --port $i --cluster-config-file "node-$i.cconf" --cluster-enabled yes --dir "$(pwd)" --dbfilename dump.rdb &
done

That script starts 4 Redis processes that are included in the cluster. It also initializes each node with a dump file.

Then I run redis-trib.rbso that 4 nodes can find each other:

redis-trib.rb create 127.0.0.1:6000 127.0.0.1:6001 127.0.0.1:6002 127.0.0.1:6003

I get the following error:

>>> Creating cluster
[ERR] Node 127.0.0.1:6060 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

I also tried an option in which only the first node / process is initialized with an RDB file and the rest are empty. I can combine 3 empty nodes into a cluster, but not the one that is pre-populated with data.

What is the correct way to import a pre-existing RDB file into a Redis cluster?

If this is an XY problem , this is why I do it:

Redis Elasticache Redis ( ). Elasticache RDB , S3. Elasticache . , , .

create-cluster, , .

+4

Source: https://habr.com/ru/post/1689348/


All Articles