Book Image

Redis 4.x Cookbook

Book Image

Redis 4.x Cookbook

Overview of this book

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.
Table of Contents (21 chapters)
Title Page
Dedication
Packt Upsell
Foreword
Contributors
Preface
13
Windows Environment Setup
Index

Index

A

  • AOF
    • about / Introduction
    • manipulating / Manipulating AOF, How it works..., There's more...
    • AOF rewrite / There's more...
    • reference / See also, See also
    • exploring / Exploring AOF, How to do it..., How it works...
    • combining, with RDB / Combining RDB and AOF, How to do it..., How it works...
    • and RDB, enabling together / There's more...
  • AOF rewrite, configuration parameters
    • auto-aof-rewrite-min-size / There's more...
    • auto-aof-rewrite-percentage / There's more...
  • appendfsync parameter, options
    • always* fsync() / How it works...
    • everysec* fsync() / How it works...
    • no* fsync() / How it works...
  • ASCII table
    • URL / Getting ready…, How it works...
  • Atomicity, Consistency, Isolation, and Durability (ACID)
    • about / There's more…
    • reference / See also

B

  • backup
    • about / Backup and restore
    • Redis data, backing up / Backing up Redis data
  • benchmarking
    • about / Benchmarking, How to do it...
    • reference / See also
  • Big O notation
    • reference / See also
  • bin/redis-cli
    • used, for operating Redis / Operating Redis using bin/redis-cli, How to do it..., There's more...
    • reference / See also
  • bitmap
    • about / Using bitmaps
    • using / Using bitmaps, There's more...
    • reference / See also

C

  • CacheCloud
    • about / Introduction, The CacheCloud Redis management system
    • features / The CacheCloud Redis management system
    • reference / See also
  • CLIENT commands
    • reference / See also
  • client connection options
    • setting / Setting client connection options, How it works...
  • CLIENT LIST command, fields
    • id / How it works...
    • addr / How it works...
    • fd / How it works...
    • age / How it works...
    • idle / How it works...
    • flags / How it works...
    • db / How it works...
    • sub / How it works...
    • psub / How it works...
    • multi / How it works...
    • qbuf / How it works...
    • qbuf-free / How it works...
    • obl / How it works...
    • oll / How it works...
    • omen / How it works...
    • events / How it works...
    • cmd / How it works...
  • clients
    • managing / Managing clients, How it works...
    • output buffer / There's more...
    • query buffer / There's more...
  • Cluster / Introduction
  • CLUSTER INFO command
    • URL / See also
  • CLUSTER NODES command
    • URL / See also
  • CMake
    • URL / See also
  • Codis
    • about / Introduction, Codis – a proxy-based high-performance Redis Cluster solution
    • architecture / Codis – a proxy-based high-performance Redis Cluster solution
    • reference / See also
  • codis-dashboard / Codis – a proxy-based high-performance Redis Cluster solution
  • codis-group / Codis – a proxy-based high-performance Redis Cluster solution
  • codis-proxy / Codis – a proxy-based high-performance Redis Cluster solution
  • codis-server / Codis – a proxy-based high-performance Redis Cluster solution
  • Copy-On-Write (COW)
    • about / How it works..., How it works..., How it works...
    • reference / See also
  • correct data types
    • using / Using the correct data types
    • performance considerations / There's more...
  • correct Redis APIs
    • using / Using the correct Redis APIs
    • time complexity / There's more...
  • crash issues
    • troubleshooting / Troubleshooting crash issues
  • create/read/update/delete (CRUD) operations / Connecting to Redis with Spring Data Redis

D

  • data migration
    • about / Data migration, How to do it...
    • redis-port tool / There's more...
    • redis-migrate-tool / There's more...
    • reference / See also
  • data persistence options
    • RDB / Introduction
    • AOF / Introduction
  • data types
    • about / Introduction
    • string data type, using / Using the string data type
    • list data type, using / Using the list data type
    • hash data type, using / Using the hash data type
    • Sorted Set data type, using / Using the set data type
    • HyperLogLog (HLL) data type / Using the HyperLogLog data type
    • Geo data type, using / Using the Geo data type
  • debugging
    • reference / See also
  • debugging, Lua
    • about / Debugging Lua, How to do it..., There's more...
    • reference / See also
  • DUMP command / There's more...

E

  • event library
    • reference / See also
  • EXPIRE command
    • reference / See also
  • expiring passively / How it works...

F

  • format specifiers
    • c -- / How it works...
    • b -- / How it works...
    • s -- / How it works...
    • l -- / How it works...
    • v -- / How it works...
    • ! -- / How it works...

G

  • Geo data type
    • using / Using the Geo data type
    • ZREM command / There's more...
    • GEOHASH command / There's more...
    • GEORADIUS command / There's more...
    • reference / See also
  • GEOHASH command
    • reference / See also
  • GNU Project Debugger (GDB)
    • about / How to do it...
    • reference / See also

H

  • hash data type
    • using / Using the hash data type
    • HSCAN command / There's more...
  • hash objects, encodings
    • ziplist / There's more...
    • hashtable / There's more...
  • health status
    • checking, in Redis / Health checking in Redis
  • HexFriend
    • URL / Getting ready…
  • high availability (HA) / Introduction
  • HyperLogLog (HLL) data type
    • using / Using the HyperLogLog data type
    • sparse presentation / There's more...
    • dense presentation / There's more...
    • reference / See also

I

  • INFO CLIENTS command, metrics
    • connected_clients / How it works...
    • client_longest_output_list / How it works...
    • client_biggest_input_buf / How it works...
    • blocked_clients / How it works...
  • INFO command
    • used, for obtaining server information / Getting server information, How to do it..., There's more…
    • URL / See also
    • reference / See also
  • INFO MEMORY command
    • metrics / How it works...
    • reference / See also
  • INFO STATS command, metrics
    • total_connections_received / How it works...
    • instantaneous_ops_per_sec / How it works...
    • rejected_connections / How it works...
    • sync_full / How it works...
    • sync_partial_ok / How it works...
    • sync_partial_err / How it works...
    • evicted_keys / How it works...
    • keyspace_misses / How it works...
    • latest_fork_usec / How it works...
    • client_longest_output_list / How it works...
    • client_biggest_input_buf / How it works...
    • blocked_clients / How it works...
  • Intellij
    • URL / Getting ready…
    • using / Getting ready…
  • iptables command
    • URL / See also

J

  • Java
    • Redis, connecting to / Connecting to Redis with Java
    • Jedis, using / How to do it...
  • Java Development Kit (JDK) / Getting ready…
  • Jedis
    • using / How to do it...
    • Redis Server, connecting to / Connecting to the Redis Server
    • pipeline, using / Using pipeline in Jedis
    • transactions, using / Using transactions in Jedis
    • Lua scripts, executing / Running Lua scripts in Jedis
    • connection pool, using / Using a connection pool in Jedis
    • reference / See also
  • jodis-client / Codis – a proxy-based high-performance Redis Cluster solution

K

  • keys
    • managing / Managing keys
    • expiration, setting / Setting expiration on keys, How it works...
    • timeout, clearing / There's more...

L

  • latency issues
    • troubleshooting / Troubleshooting latency issues
    • internal latency detection / There's more…
    • reference / See also
  • Least Frequently Used (LFU) algorithm / How it works...
  • Least Recently Used (LRU) algorithm
    • about / Caching, How it works...
    • reference / See also
  • Linux
    • Redis, deploying / Deploying Redis on Linux, How to do it..., How it works...
  • Linux sockets
    • reference / See also
  • list commands
    • reference / See also
  • list data type
    • using / Using the list data type
    • LPUSH command / How it works...
    • RPUSH command / How it works...
    • LINSERT command / How it works...
    • BLPOP command / There's more...
    • BRPOP / There's more...
  • list objects, configuration options
    • list-max-ziplist-size / There's more...
    • list-compress-depth / There's more...
  • logging / Logging, How it works...
  • Lua
    • about / Using Lua
    • using / How it works...
    • selecting / There's more...
    • reference / See also
    • debugging / Debugging Lua, How to do it..., There's more...

M

  • MapReduce job
    • writing, for Redis / Writing a MapReduce job for Redis
    • reference / See also
  • maxmemory-policy directive, options
    • noeviction / How it works...
    • allkeys-lru / How it works...
    • volatile-lru / How it works...
    • allkeys-lfu / How it works...
    • volatile-lfu / How it works...
    • allkeys-random / How it works...
    • volatile-random / How it works...
    • volatile-ttl / How it works...
  • memory
    • monitoring / Monitoring memory, How to do it..., How it works...
  • MEMORY command
    • reference / See also
  • memory issues
    • troubleshooting / Troubleshooting memory issues
  • memory optimization
    • reference / See also, See also
  • memory policy
    • configuring / Configuring memory policy, How it works...
    • maxmemory value, setting / There's more...
  • MEMORY STATS command
    • metrics / How it works...
  • memtier_benchmark tool
    • URL / See also
  • MIGRATE command
    • reference / See also

N

  • nutcracker / Twemproxy

O

  • OBJECT command
    • reference / See also
  • operating systems (OS) / Deploying Redis on Linux
  • out-of-memory (OOM) / How it works..., How it works...
  • output buffer / How it works...

P

  • Pika
    • about / Introduction, Pika – a Redis-compatible NoSQL database
    • architecture / Pika – a Redis-compatible NoSQL database
    • Pink / Pika – a Redis-compatible NoSQL database
    • Nemo / Pika – a Redis-compatible NoSQL database
    • Binlog / Pika – a Redis-compatible NoSQL database
    • working thread / Pika – a Redis-compatible NoSQL database
    • reference / See also
  • pipeline
    • using / Using pipelines, How it works...
    • reference / See also
  • Publish-Subscribe (PubSub)
    • using / Using PubSub, How it works..., There's more...
    • reference / See also
  • Python
    • Redis, connecting to / Connecting to Redis with Python
    • redis-py library, installing / How to do it...

Q

  • query buffer / How it works...

R

  • RDB
    • about / Introduction
    • manipulating / Manipulating RDB, How to do it..., How it works...
    • reference / See also, See also
    • exploring / Exploring RDB, How to do it..., There's more...
    • combining, with AOF / Combining RDB and AOF, How to do it..., How it works...
    • and AOF, enabling together / There's more...
  • RDB, configuration options
    • stop-writes-on-bgsave-error yes / There's more...
    • rdbcompression yes / There's more...
    • rdbchecksum yes / There's more...
  • RDB file, metadata
    • redis-ver / How it works...
    • redis-bits / How it works...
    • ctime / How it works...
    • used-mem / How it works...
    • repl_stream_db / How it works...
    • aof-preamble / How it works...
    • repl-id / How it works...
    • repl-offset / How it works...
  • RDB format
    • reference / See also
  • real-world application
    • of Redis / When to use Redis in your application
    • session store / Session store
    • analytics / Analytics
    • leaderboards / Leaderboards
    • queues / Queues
    • latest N records, obtaining / Latest N records
    • caching / Caching
  • Redis
    • reference / Introduction
    • downloading / Downloading and installing Redis, How to do it...
    • installing / Downloading and installing Redis, How to do it...
    • URL / Getting ready…
    • URL, for Windows / There's more...
    • starting / Starting and shutting down Redis, How it works...
    • shutting down / Starting and shutting down Redis, How it works...
    • connecting, with redis-cli / Connecting to Redis with redis-cli, How it works...
    • connecting, with Java / Connecting to Redis with Java
    • connecting, with Python / Connecting to Redis with Python
    • connecting, with Spring Data Redis / Connecting to Redis with Spring Data Redis
    • MapReduce job, writing / Writing a MapReduce job for Redis
    • Spark job, writing / Writing a Spark job for Redis
    • reference, for optimization / See also
    • deploying, on Linux / Deploying Redis on Linux, How to do it..., How it works...
    • reference, for deployment / See also
    • securing / Securing Redis, How to do it...
    • protected mode / There's more...
    • URL, for security / See also
    • operating, with bin/redis-cli / Operating Redis using bin/redis-cli, How to do it..., There's more...
    • health status, checking / Health checking in Redis
  • redis-cli
    • used, for connecting to Redis / Connecting to Redis with redis-cli, How it works...
    • about / There's more...
  • redis-migrate-tool
    • URL / See also
  • redis-port
    • URL / See also
  • redis-py library
    • installing / How to do it...
    • Redis Server, connecting to / Connecting to the Redis Server
    • pipelines, using / Using pipelines
    • Lua scripts, executing / Running Lua scripts
    • URL / See also
  • Redis clients
    • reference / See also
  • Redis Cluster
    • setting up / Setting up Redis Cluster, How to do it..., How it works...
    • redis-trib.rb script, using / There's more...
    • reference / See also, See also
    • testing / Testing Redis Cluster, How to do it..., How it works...
    • PFAIL state / There's more...
    • administrating / Administrating Redis Cluster, How to do it...
    • commands, URL / See also
  • Redis Event Model / Understanding the Redis Event Model, How to do it..., How it works...
  • Redis Lua debugger (LDB)
    • URL / See also
  • Redis module API
    • reference / See also
  • Redis modules
    • about / Introduction
    • advantages / Introduction
    • loading / Loading a Redis module, How to do it...
    • reference / See also
    • writing / Writing a Redis module, How to do it..., How it works...
  • RedisModuleSDK
    • URL / See also
  • Redis protocol
    • about / Understanding the Redis protocol, How it works...
    • reference / See also
  • REdis Serialization Protocol (RESP) / Understanding the Redis protocol
  • Redis Server
    • configurations, managing / Managing Redis Server configurations, How it works...
  • Redisson client
    • about / Introduction, The Redisson client
    • features / The Redisson client
    • reference / See also
  • Redis string commands
    • URL / See also
  • Redis transactions
    • versus RDBMS transactions / Understanding Redis transactions, How it works...
  • REmote DIctionary Server (Redis) / Introduction
  • replication
    • about / Introduction
    • setting up / Setting up Redis replication, How to do it..., How it works...
    • reference / See also
    • optimizing / Optimizing replication, How to do it..., How it works..., There's more...
    • troubleshooting / Troubleshooting replication, How to do it..., How it works...
    • timeout, preventing / There's more...
  • Resident Set Size (RSS) / How it works...
  • Resque
    • URL / See also
  • restore
    • about / Backup and restore
    • Redis data, restoring from RDB file / Restoring Redis data from an RDB file
    • AOF file, disabling / How it works...
  • RESTORE command / There's more...
  • round-trip time (RTT) / Using pipelines, How it works...

S

  • SCAN commands
    • reference / See also
  • Sentinel
    • setting up / Setting up Sentinel, Getting ready…, How it works...
    • utilizing / There's more…
    • URL / See also, There's more…
    • testing / Testing Sentinel, How to do it...
    • master failover, triggering manually / Triggering a master failover manually
    • master down, simulating / Simulating a master down
    • two slaves, shutting down / Simulating two slaves down
    • shutting down / Simulating one Sentinel down
    • two Sentinel, shutting down / Simulating two Sentinels down
    • administrating / Administrating Sentinel, How to do it..., How it works...
    • notification-script, executing / There's more...
    • client-config-script, executing / There's more...
  • server information
    • obtaining, with INFO command / Getting server information, How to do it..., There's more…
  • slow log
    • used, for identifying slow queries / Identifying slow queries using the SLOWLOG
  • SLOWLOG command
    • reference / See also
  • slow queries
    • identifying, with slow log / Identifying slow queries using the SLOWLOG
    • bottleneck / There's more…
  • Solid State Drive (SSD) / Pika – a Redis-compatible NoSQL database
  • SORT command
    • used, for sorting / Using SORT, There's more...
    • reference / See also
  • Sorted Set
    • manipulating / Using the sorted set data type, There's more...
  • Sorted Set commands
    • URL / See also
  • Sorted Set data type
    • using / Using the set data type, Using the sorted set data type
    • SMEMBERS command / There's more...
    • commands for union / There's more...
    • commands for intersection / There's more...
    • commands for difference / There's more...
  • Spark-Redis
    • URL / See also
  • Spark job
    • writing, for Redis / Writing a Spark job for Redis
  • Spring Data Redis
    • Redis, connecting to / Connecting to Redis with Spring Data Redis
    • URL / See also
  • STORE commands / There's more...
  • StrictRedis class
    • DEL command / There's more...
    • MULTI/EXEC command / There's more...
    • SELECT command / There's more...
    • SUBSCRIBE/LISTEN command / There's more...
  • string data type
    • using / Using the string data type
    • SET command / There's more...
    • EXIST command / There's more...
    • SETNX command / There's more...
  • Swagger
    • about / See also
    • URL / See also
  • swappiness
    • reference / See also

T

  • TCP Keepalive
    • URL / See also
  • transaction
    • about / Understanding Redis transactions
    • reference / See also
  • transparent huge pages
    • reference / See also
  • Twemproxy
    • about / Introduction, Twemproxy
    • reference / See also