You are previewing Resilience and Reliability on AWS.

Resilience and Reliability on AWS

Cover of Resilience and Reliability on AWS by Jasper Geurtsen... Published by O'Reilly Media, Inc.
  1. Resilience & Reliability on AWS
  2. Foreword
  3. Preface
    1. Audience
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
  4. 1. Introduction
  5. 2. The Road to Resilience and Reliability
    1. Once Upon a Time, There Was a Mason
    2. Rip. Mix. Burn.
    3. Cradle to Cradle
    4. In Short
  6. 3. Crash Course in AWS
    1. Regions and Availability Zones
      1. Route 53: Domain Name System Service
      2. IAM (Identity and Access Management)
    2. The Basics: EC2, RDS, ElastiCache, S3, CloudFront, SES, and CloudWatch
      1. CloudWatch
      2. EC2 (et al.)
      3. RDS
      4. ElastiCache
      5. S3/CloudFront
      6. SES
    3. Growing Up: ELB, Auto Scaling
      1. ELB (Elastic Load Balancer)
      2. Auto Scaling
    4. Decoupling: SQS, SimpleDB & DynamoDB, SNS, SWF
      1. SQS (Simple Queue Service)
      2. SimpleDB
      3. SNS (Simple Notification Service)
      4. SWF (Simple Workflow Service)
  7. 4. Top 10 Survival Tips
    1. Make a Choice
    2. Embrace Change
    3. Everything Will Break
    4. Know Your Enemy
    5. Know Yourself
    6. Engineer for Today
    7. Question Everything
    8. Don’t Waste
    9. Learn from Others
    10. You Are Not Alone
  8. 5. elasticsearch
    1. Introduction
    2. EC2 Plug-in
    3. Missing Features
    4. Conclusion
  9. 6. Postgres
    1. Pragmatism First
    2. The Challenge
      1. Tablespaces
    3. Building Blocks
      1. Configuration with userdata
      2. IAM Policies (Identity and Access Management)
      3. Postgres Persistence (backup/restore)
      4. Self Reliance
    4. Monitoring
    5. Conclusion
  10. 7. MongoDB
    1. How It Works
      1. Replica Set
      2. Backups
    2. Auto Scaling
    3. Monitoring
    4. Conclusion
  11. 8. Redis
    1. The Problem
    2. Our Approach
    3. Implementation
      1. userdata
      2. Redis
      3. Chaining (Replication)
    4. In Practice
  12. 9. Logstash
    1. Build
    2. Shipper
      1. Output Plug-in
    3. Reader
      1. Input Plug-in
      2. Grok
    4. Kibana
  13. 10. Global (Content) Delivery
    1. CloudFront
      1. (Live) Streaming
      2. CloudFormation
      3. Orchestration
    2. Route 53
      1. Global Database
  14. 11. Conclusion
  15. Copyright

Chapter 8. Redis

Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets.

Redis has a very novel approach to being a datastore. Actually, its own data structure server is a very apt description: it is a server.

As with all our infrastructure components, we aim for resilience (does not break easily) and reliability (does what you expect it to do). For Redis, we have to figure out how to do the following:

  • Backup/restore
  • Failover
  • Scaling (up and down)
  • Monitoring

This project is available on github at ReDiS.

The Problem

Redis as a data structure server finds its limits in the server. The core idea is that it exposes the memory on an instance as a variety of structured data through an API. This is fast but very fragile. Memory is not persisted.

This feature has two consequences we have to deal with:

  1. Persistence (how to make backups)
  2. Replication

Both these problems would go away if Redis were available in a distributed manner. In the next chapter, we’ll see how elasticsearch elegantly solves this shortcoming. But the distributed Redis is a work in progress and we don’t know when it will be available. In the meantime, we have our own workaround.

Our Approach

Redis has the notion of master-slave replication. In Redis anything can be a master, and masters are almost completely unaware of existing slaves. A slave has only one master, which is slaveof.

This simple approach to replication ...

The best content for your career. Discover unlimited learning on demand for around $1/day.