How to shutdown redis safely without data loss?

by tressie.damore , in category: Third Party Scripts , a year ago

How to shutdown redis safely without data loss?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by kadin , a year ago

@tressie.damore 

To shutdown Redis safely without data loss, you can follow these steps:

  1. Save the data to disk: Before shutting down Redis, you should make sure that all data is saved to disk using the BGSAVE command. This will create a snapshot of the current data in the background.
1
redis-cli bgsave


  1. Check the status of the saving process: You can check the status of the saving process using the INFO persistence command. Wait for the saving process to complete before proceeding to the next step.
1
redis-cli INFO persistence


  1. Shutdown Redis: Once the saving process is complete, you can safely shutdown Redis using the SHUTDOWN command. This will gracefully stop the Redis server without losing any data.
1
redis-cli SHUTDOWN


Following these steps will ensure that your data is safely saved to disk before shutting down Redis, preventing any data loss.

Related Threads:

How to create redis cluster without replica?
How to test redis without using sleep?
How to list keys without serial number in redis?
How to query nested data in redis
How to recover old data from redis?
How to store feed data in redis?