Can me sync redis's data into db?

58 Views Asked by At

i am creating a ranking system and will using redis zset as solution. We need a backup to avoid data loss. sync the data to another storage is it a best way?

solution that can help us to face other critical issue such as data missing.

1

There are 1 best solutions below

0
On

Instead of using another DB to protect your data, you could use Redis replication and Redis Sentinel.

Replication gives you a master-replica setup where the replica is an exact copy of the master so that your data resides in two (or more) nodes.

Redis Sentinel gives you high availability as Sentinel monitors the master node and elects a new master from one of the replicas in the event of an failure.

You could also look at Redis Cluster where you basically get both of the above. Redis cluster is also interesting if you want to scale your Redis platform as your data will be sharded across multiple nodes.

If you want to sync data from Redis to another DB you could use keyspace notifications where you subscribe to events (commands) and then save the data to your other DB. Keyspace notifications uses Redis Pub/Sub to achieve this.