Redis 4.x Cookbook

Book description

Leverage the power of Redis 4.x to develop, optimize and administer your Redis solutions with ease

About This Book

  • Build, deploy and administer high performance and scalable applications in Redis
  • Covers a range of important tasks - including development and administration of Redis
  • A practical guide that takes your understanding of Redis to the next level

Who This Book Is For

This book is for database administrators, developers and architects who want to tackle the common and not so common problems associated with the different development and administration-related tasks in Redis. A fundamental understanding of Redis is expected to get the best out of this book.

What You Will Learn

  • Install and configure your Redis instance
  • Explore various data types and commands in Redis
  • Build client-side applications as well as a Big Data framework with Redis
  • Manage data replication and persistence in Redis
  • Implement high availability and data sharding in Redis
  • Extend Redis with Redis Module
  • Benchmark, debug, fine-tune and troubleshoot various issues in Redis

In Detail

Redis is considered the world's most popular key-value store database. Its versatility and the wide variety of use cases it enables have made it a popular choice of database for many enterprises. Based on the latest version of Redis, this book provides both step-by-step recipes and relevant the background information required to utilize its features to the fullest. It covers everything from a basic understanding of Redis data types to advanced aspects of Redis high availability, clustering, administration, and troubleshooting. This book will be your great companion to master all aspects of Redis.

The book starts off by installing and configuring Redis for you to get started with ease. Moving on, all the data types and features of Redis are introduced in detail. Next, you will learn how to develop applications with Redis in Java, Python, and the Spring Boot web framework. You will also learn replication tasks, which will help you to troubleshoot replication issues. Furthermore, you will learn the steps that need to be undertaken to ensure high availability on your cluster and during production deployment. Toward the end of the book, you will learn the topmost tasks that will help you to troubleshoot your ecosystem efficiently, along with extending Redis by using different modules.

Style and approach

This book is a rich collection of recipes that will come in handy when you are working with Redis. It addresses your common and not-so-common pain points, so this is a book of Redis that you must have on the shelf.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Redis 4.x Cookbook
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Foreword
  6. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Sections
      1. Getting ready…
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Get in touch
      1. Reviews
  8. Getting Started with Redis
    1. Introduction
    2. Downloading and installing Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Starting and shutting down Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Connecting to Redis with redis-cli
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Getting server information
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more…
      5. See also
    6. Understanding the Redis Event Model
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Understanding the Redis protocol
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
  9. Data Types
    1. Introduction
    2. Using the string data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Using the list data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Using the hash data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Using the set data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
    6. Using the sorted set data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Using the HyperLogLog data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Using the Geo data type
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    9. Managing keys
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  10. Data Features
    1. Introduction
    2. Using bitmaps
      1. Getting ready…
      2. How to do it…
      3. How it works…
      4. There's more...
      5. See also
    3. Setting expiration on keys
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Using SORT
      1. Getting ready…
      2. How to do it…
      3. There's more...
      4. See also
    5. Using pipelines
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Understanding Redis transactions
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Using PubSub
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Using Lua
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    9. Debugging Lua
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  11. Developing with Redis
    1. Introduction
    2. When to use Redis in your application
      1. Session store
      2. Analytics
      3. Leaderboards
      4. Queues
      5. Latest N records
      6. Caching
      7. There's more…
      8. See also
    3. Using the correct data types
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Using the correct Redis APIs
      1. Getting ready…
      2. How to do it
      3. How it works...
      4. There's more...
      5. See also
    5. Connecting to Redis with Java
      1. Getting ready…
      2. How to do it...
        1. Connecting to the Redis Server
        2. Using pipeline in Jedis
        3. Using transactions in Jedis
        4. Running Lua scripts in Jedis
        5. Using a connection pool in Jedis
      3. How it works...
      4. See also
    6. Connecting to Redis with Python
      1. Getting ready…
      2. How to do it...
        1. Connecting to the Redis Server
        2. Using pipelines
        3. Running Lua scripts
      3. How it works...
      4. There's more...
      5. See also
    7. Connecting to Redis with Spring Data Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
    8. Writing a MapReduce job for Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
    9. Writing a Spark job for Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  12. Replication
    1. Introduction
    2. Setting up Redis replication
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Optimizing replication
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Troubleshooting replication
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  13. Persistence
    1. Introduction
    2. Manipulating RDB
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Exploring RDB
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Manipulating AOF
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Exploring AOF
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Combining RDB and AOF
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
  14. Setting Up High Availability and Cluster
    1. Introduction
    2. Setting up Sentinel
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more…
      5. See also
    3. Testing Sentinel
      1. Getting ready…
      2. How to do it...
      3. How it works...
        1. Triggering a master failover manually
        2. Simulating a master down
        3. Simulating two slaves down
        4. Simulating one Sentinel down
        5. Simulating two Sentinels down
      4. There's more…
    4. Administrating Sentinel
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
    5. Setting up Redis Cluster
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Testing Redis Cluster
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Administrating Redis Cluster
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  15. Deploying to a Production Environment
    1. Introduction
    2. Deploying Redis on Linux
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Securing Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Setting client connection options
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
    5. Configuring memory policy
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Benchmarking
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Logging
      1. Getting ready…
      2. How to do it...
      3. How it works...
  16. Administrating Redis
    1. Introduction
    2. Managing Redis Server configurations
      1. Getting ready…
      2. How to do it...
      3. How it works...
    3. Operating Redis using bin/redis-cli
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Backup and restore
      1. Getting ready…
      2. How to do it...
        1. Backing up Redis data
        2. Restoring Redis data from an RDB file
      3. How it works...
    5. Monitoring memory
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There is more...
      5. See also
    6. Managing clients
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Data migration
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  17. Troubleshooting Redis
    1. Introduction
    2. Health checking in Redis
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
    3. Identifying slow queries using the SLOWLOG
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more…
      5. See also
    4. Troubleshooting latency issues
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more…
      5. See also
    5. Troubleshooting memory issues
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more…
      5. See also
    6. Troubleshooting crash issues
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
  18. Extending Redis with Redis Modules
    1. Introduction
    2. Loading a Redis module
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. See also
    3. Writing a Redis module
      1. Getting ready…
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  19. The Redis Ecosystem
    1. Introduction
    2. The Redisson client
      1. See also
    3. Twemproxy
      1. See also
    4. Codis – a proxy-based high-performance Redis Cluster solution
      1. See also
    5. The CacheCloud Redis management system
      1. See also
    6. Pika – a Redis-compatible NoSQL database
      1. See also
  20. Windows Environment Setup
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Redis 4.x Cookbook
  • Author(s): Pengcheng Huang, Zuofei Wang
  • Release date: February 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781783988167