As a popular key-value memory data store, Redis has recently received more and more attention due to its high performance, rich data types, powerful API functions, high availability, and scalable architecture.
Since 2017, Redis has successfully ranked 9/10 in the DB-Engine Complete Ranking. Before that, Redis even occupied the first place in the DB-Engine key-value storage classification list for a long time. From the early 2.x version to the 4.x version, Redis introduced many excellent features to help users who want to deliver low-latency services in business scenarios.
table of Contents
Redis is a very popular in-memory database, known as the "Swiss Army Knife" of the backend. It has many excellent features and has been adopted by more and more companies, and it is worth learning by every developer.
Through the more than 80 actual cases of Redis in design, development, operation and maintenance described in this article, readers can not only learn almost all knowledge about Redis from a shallow person, but also can directly use the content explained in the case to include design , Development and operation and maintenance of various production practices.
Each case in this article, the various knowledge, commands and tools involved in each case, are all from the author's summary of first-line enterprise applications;
The various parameter configurations and fault diagnosis cases summarized in this article are also from the author's real enterprise-level operation and maintenance work experience.
Chapter 1, Starting to Use Redis, mainly involves the installation and basic operations of Redis server-side , including starting and stopping the Redis server, using redis-cli to connect to Redis and obtaining server information. At the end of this chapter, the Redis event model and Redis communication protocol are also introduced.
Chapter 2, Data Types, mainly involves Redis data types and common API commands for manipulating data types . This chapter introduces all the data types supported in Redis 4.x (string string, list list, hash hash. set set, sorted set, HyperLogLog and Geo). This chapter also discusses basic Redis key management.
Chapter 3, Data Features, mainly involves some useful Redis features that make manipulating data easier . This chapter first shows how to use bitmap (bitmap), SORT command and set key expiration time. After that, I introduced readers to the three important functions of Redis: pipeline, transaction and PubSub. At the end of this chapter, we demonstrated how to write and debug Lua scripts in Redis.
Chapter 4, Developing with Redis, demonstrates how to use Redis to develop applications . First of all, this chapter discusses the usage scenarios, data types and API selection of Redis. After that, this chapter shows examples of using Redis client libraries Jedis and redis-py to develop Java and Python applications. Finally, this book introduces examples of using Redis in Spring Framework and using Redis in MapRe-duce/Spark jobs.
Chapter 5, Replication, mainly involves the replication mechanism of Redis . This chapter shows how to configure Redis slave instances and explains the working principle of Redis master-slave replication. Then, this chapter discusses troubleshooting topics related to Redis tuning and master-slave replication.
Chapter 6, Persistence, introduces two persistence methods in Redis: RDB and AOF . This chapter shows how to enable RDB and AOF in Redis to achieve persistence, and explains how persistence works. This chapter also discusses the difference between RDB and AOF, and how to combine the two methods.
Chapter 7, Configuring High Availability and Cluster (Cluster), mainly involves the high availability related architecture of Redis . This chapter demonstrates how to configure Redis Sentinel and Redis Cluster, and explains the working principles of Redis Sentinel and Redis Cluster through several experiments.
Chapter 8, Production Environment Deployment, discusses the matters needing attention when deploying Redis in a production environment . This chapter first discusses the operating system, network and security considerations; after that, it involves the two topics of configuration adjustment and logging, and also discusses the LRU strategy. Finally, this chapter also discusses Redis performance/stress testing.
Chapter 9, Managing Redis, mainly involves various Redis management tasks, including updating server configuration , using redis-cli. Backing up and restoring data, managing memory usage, managing clients and data migration, etc.
Chapter 10, Fault Diagnosis, mainly involves several examples of troubleshooting Redis . This chapter covers examples of using slow logs to locate slow queries. It also demonstrates cases of troubleshooting common failures such as latency, memory, and process crashes.
Chapter 11, Extending Redis through modules, discusses how to use Redis modules to extend Redis functions . This chapter explains the working principle of the Redis module and demonstrates how to use the Redis module SDK to build a Redis module.
Chapter 12, Redis Ecological Environment, explains the third-party components of Redis , and briefly introduces several popular tools, clients, and agents.
Appendix A. Windows environment setup, introduces how to run Redis in Windows environment.
This [Redis 4.x Cookbook Chinese Version] has a total of 322 pages. Friends who need the full version can get a free method at the end of the article! ! !
This article is aimed at developers, architects, and DBAs who want to start using Redis or deepen their knowledge.
If readers want to use Redis to design high-performance, scalable database solutions, then this article will guide readers to have a comprehensive and in-depth understanding of Redis through a variety of practical cases.
This article is also useful for DBAs who seek solutions to common problems encountered in daily operation and maintenance of Redis.
Because this document contains too much content, I can't show you all of it in detail. Friends who need the full version of the document can look below to get it!
Friends who need the full version of the document can get three links with one click, and get the free method below!