Ends in

Get up to $10 DISCOUNT on our AWS Solutions Architect Associate Reviewers!

Redis Append-Only Files vs Redis Replication

Redis Append-Only Files (AOF)

Redis Replication

  • You can enable the Redis append-only file feature (AOF) for data durability. It is similar to creating manual backups. When enabled, the node writes all of the commands that change cache data to an append-only file.

  • When a node is rebooted and the cache engine starts, Redis goes through an AOF to replay the actions that were performed before the crash; the result is a warm Redis cache with all of the data intact.

  • To enable AOF for a cluster running Redis, you must create a parameter group with the appendonly parameter set to yes, and then assign that parameter group to your cluster. Modify the appendfsync parameter to control how often Redis writes to the AOF file.

  • For Multi-AZ replication groups, AOF is disabled. You cannot have both features enabled.

  • AOF cannot protect against all failure scenarios. For example, if a node fails due to a hardware fault in an underlying physical server, ElastiCache will provision a new node on a different server. In this case, the AOF file will no longer be available and cannot be used to recover the data. Thus, Redis will restart with a cold cache.

  • Because AOF is a file, you could run into an “Out of Disk Space” error. For greater reliability and faster recovery, AWS recommends that you create a replication group with one or more read replicas in different Availability Zones and enable Multi-AZ instead of using AOF.

  • AOF advantages

    • You can have different fsync policies: no fsync at all, fsync every second, fsync at every query.

    • The AOF log is an append only log, so you would not have to worry about seeks, nor corruption problems if a power outage happens.

    • Redis is able to automatically rewrite the AOF in background when it gets too big. The rewrite is a safe operation. While Redis continues appending to the old file, a completely new one is produced with the minimal set of operations needed to create the current data set, and once this second file is ready Redis switches the two and starts appending to the new one.

    • AOF contains a log of all the operations one after the other in an easy to understand and parse format.
  • Redis implements replication in two ways:

    • Redis (cluster mode disabled)

    • Redis (cluster mode enabled)

  • Each shard in a replication group has a single read/write primary node and up to 5 read-only replica nodes. Read replicas enhance read scalability and guard against data loss.

  • You can create up to 250 shards per Redis cluster (collection of Redis shards). The node or shard limit can be increased to a maximum of 500 per cluster if the Redis engine version is 5.0.6 or higher.

  • Redis Cluster mode disabled

    • There is a single shard (collection of Redis nodes) that contains all of the cluster’s data in each node one primary, up to 5 secondary, read-only replica nodes. Data cannot be partitioned between nodes.

    • Asynchronous replication mechanisms are used to keep the read replicas synchronized with the primary.

    • All of the nodes in the cluster must reside in the same region, but can be spread across different AZs.

    • You can enable Multi-AZ with Automatic Failover for your Redis cluster with replicas.

    • If you have no replicas and the node fails, you experience total data loss.

    • Cluster mode disabled is best used for read-intensive applications or supporting large numbers of simultaneous reads from the same cluster.

  • Redis Cluster mode enabled

    • Data is partitioned across 1 up to 250 shards or 500 per cluster if the Redis engine version is 5.6.0 or higher.

    • Each read replica in a shard maintains a copy of the data from the shard’s primary.

    • You can dynamically change the number of shards to meet needs.

    • Asynchronous replication mechanisms are used to keep the read replicas synchronized with the primary.

    • All of the nodes in a Redis (cluster mode enabled) cluster must reside in the same region, but nodes can spread across different AZs.

    • Multi-AZ with Automatic Failover is required for all Redis (cluster mode enabled) clusters.

    • If you have no replicas and a node fails, you experience loss of all data in that shard.

    • You cannot manually promote any of the replica nodes to primary.

Note: If you are studying for the AWS Certified Database Specialty exam, we highly recommend that you take our AWS Certified Database – Specialty Practice Exams and read our Database Specialty exam study guide.

AWS Certified Database Specialty Practice Exams


Tutorials Dojo portal

FREE AWS Exam Readiness Digital Courses

Tutorials dojo strip

Enroll Now – Our Azure Certification Exam Reviewers

azure reviewers tutorials dojo

Enroll Now – Our Google Cloud Certification Exam Reviewers

Tutorials Dojo Exam Study Guide eBooks

tutorials dojo study guide eBook

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

FREE Intro to Cloud Computing for Beginners

FREE AWS, Azure, GCP Practice Test Samplers

Browse Other Courses

Generic Category (English)300x250

Recent Posts

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?