Introducing Dragonfly Cloud! Learn More

Question: How can you set up a Redis cluster without persistence?

Answer

To setup a Redis cluster without persistence, you need to turn off the default persistence options. Redis supports two forms of persistence: RDB and AOF. By default, Redis uses RDB for persistence.

This is done by modifying the Redis configuration file (redis.conf), particularly the following parts:

  1. RDB Persistence: Turn off RDB snapshotting by removing all save directives from the configuration.
# save 900 1 # save 300 10 # save 60 10000

These lines mean that Redis will automatically save datasets every 15 minutes if at least one key has changed, every five minutes if at least ten keys have changed, and every minute if at least 10,000 keys have changed. Commenting out these lines disables RDB snapshotting.

  1. AOF Persistence: To disable AOF persistence, you need to set appendonly directive to no.
appendonly no

After making these changes, restart your Redis server for the changes to take effect. Be careful, though, as disabling persistence means your data is ephemeral and will be lost if the Redis server crashes or is restarted.

While there are use cases where persistence is not needed, it's usually advisable to keep some form of it enabled to avoid data loss.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.