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:
- 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.
- 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?
Other Common Redis Questions (and Answers)
- What is the default port used by Redis?
- How to start Redis server?
- Is Redis persistent?
- How fast is Redis?
- How to install Redis on Mac?
- How to check if Redis is running?
- How to restart Redis?
- Does Redis persist data?
- How to install Redis on Ubuntu?
- How to stop Redis server?
- How to see Redis version?
- Does Redis have tables?
Free System Design on AWS E-Book
Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.
Switch & save up to 80%
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost