I have one Redis instance that has two databases. Now I want to set up a second instance and replicate the first instance, but the second instance should only have one database and replicate only db 0 from the first instance.
When I try to do it (set slaveof ... for the second instance) I get the following error message in the Redis log file:
FATAL: Data file was created with a Redis server configured to handle more than 1 databases. Exiting
I tried using redis-dump but I get an error when I try to import the generated dump into the new instance. (not related to 2 dbs vs. 1 db I think, rather a bug in redis-dump, which is still in alpha.
What to do?
This is how I achieved it (with help of Gurpartap Singh):
databases 2just like the first onedatabases 1At this point you should have a running Redis instance with only one db (db 0 from the original Redis instance)
The key here is that when we delete all keys in the second db and then save the dataset to disk, the resulting dump only has one db. (Thanks for the hint to Gurpartap Singh)