Preface
As a NoSQL database based on key-value pairs, Redis has the characteristics of high performance, rich data structure, persistence, high availability, and distribution. At the same time, Redis itself is very stable and has been widely recognized and used in the industry. Therefore, as a Java developer, mastering Redis has long been one of the necessary skills.
Today, I would like to share with you this Redis Collection, which is considered the most NB by the bigwigs in the circle. It pays attention to all aspects of Redis development, especially the detailed analysis of how to improve the efficiency and reduce the problems that may be encountered in the development, not only how to solve it. These problems, but through the analysis of the important principles of Redis, help developers learn how to find problems and understand the principles behind them, so that developers not only know what they are, but also why they are. Therefore, it has also received unanimous praise from the bigwigs in the circle.
Receiving study notes: After one-click triple connection, add the assistant vx:bjmsb2019 or vx:1249448307!
Chapter 1 Getting to Know Redis
Get to know Redis for the first time, lead readers into the world of Redis, understand its past and present, many features, application scenarios, installation and configuration, simple use, and finally explain the important versions of Redis in the development process, so that readers can have a comprehensive view of Redis understanding.
1.1 Redis features
1.2 Redis usage scenarios
1.3 Suggestions for good use of Redis
1.4 Install and start Redis correctly
1.5 Redis major version
Chapter 2 API understanding and use
The understanding and use of API, a comprehensive introduction to the five data structures provided by Redis: string (string), hash (hash), list (list), set (set), ordered set (zset) data model, and common commands , Typical application scenarios, and each section will give you the pits and skills that you may need to pay attention to in the Redis development process. At the same time, this chapter will also give a comprehensive introduction to Redis's single-threaded processing mechanism and key value management. Through understanding of these principles, readers can select appropriate data structures and commands for development in appropriate application scenarios, which effectively improves program efficiency and reduces Possible problems and hidden dangers.
2.1 Preparation
2.2 String
2.3 Hash
2.4 List
2.5 Collection
2.6 Ordered collection
2.7 Key Management
Chapter 3 Small Functions and Great Uses
Small functions and great uses. In addition to the five data structures, Redis also provides additional functions such as slow query, Redis Shell, Pipeline, Lua script, Bitmaps, HyperLogLog, publish and subscribe, GEO, etc. With the help of these functions, Redis applications The scene is richer.
3.1 Slow query analysis
3.2 Redis Shell
3.3 Pipeline
3.4 Transactions and Lua
3.5 Bitmaps
3.6 HyperLogLog
3.7 Publish and Subscribe
3.8 GEO
Chapter 4 Client
Client, this chapter focuses on the development of the Redis client, introduces the Redis client communication protocol, explains in detail the usage skills of the Java client Jedis, and analyzes the client's monitoring and management skills in the development, operation and maintenance from a principle perspective. Finally, common problems and case explanations in client development are given.
4.1 Client communication protocol
4.2 Java Client Jedis
4.3 Python client redis-py
4.4 Client Management
4.5 Common client exceptions
4.6 Client case analysis
Chapter 5 Endurance
Persistence, Redis's persistence function effectively avoids data loss problems caused by process exit. This chapter first introduces RDB and AOF two persistence configurations and operating procedures, and secondly locates and optimizes common persistence problems, and finally combines Redis common Optimized single-machine multi-instance deployment scenarios.
5.1 RDB
5.2 AOF
5.3 Problem location and optimization
5.4 Multi-instance deployment
Tips: Due to too much content, I will mainly show the knowledge points and some screenshots in the following chapters. Get the full version: You can get it for free at the end of the article!
Chapter 6 Copy
Replication, in order to solve a single point problem in a distributed system, multiple copies of data are usually deployed to other machines for failure recovery and load balancing requirements, as does Redis. It provides us with a replication function, which implements multiple Redis copies of the same data. The replication function is the basis of highly available Redis. The sentinels and clusters in the following chapters are all based on replication to achieve high availability.
6.1 Configuration
6.2 Topology
6.3 Principle
6.4 Problems in development and operation and maintenance
Chapter 7 The Nightmare of Redis: Blocking
Blocking, Redis is a typical single-threaded architecture, all read and write operations are completed in a main thread. This thread becomes its lifeline when Redis is used in high concurrency scenarios. If there is a blockage, even for a short time, it is a nightmare for our application. Scenarios that cause blocking problems are roughly divided into internal and external causes. This chapter will conduct a detailed analysis.
7.1 Obstruction found
7.2 Internal reasons
7.3 External reasons
Chapter 8 Understanding Memory
To understand memory, all Redis data exists in memory, and how to efficiently use Redis memory becomes very important. To efficiently use Redis memory, you first need to understand where Redis memory is consumed, how to manage memory, and finally go deep into how to optimize memory. After mastering this knowledge, I believe that readers can store more data with less memory to reduce costs.
8.1 Memory consumption
8.2 Memory Management
8.3 Memory optimization
Chapter 9 Sentinel
Sentinel, Redis has officially provided Redis Sentinel since version 2.8, which effectively solves several problems of failover in master-slave replication mode and provides high availability for Redis. This chapter will analyze Redis Sentinel's related concepts, installation and deployment, configuration, command usage, and principle analysis step by step. Finally, it will analyze some problems in Redis Sentinel operation and maintenance.
9.1 Basic concepts
9.2 Installation and deployment
9.3 API
9.4 Client connection
9.5 Implementation Principle
9.6 Problems in development and operation and maintenance
Chapter 10 Cluster
Cluster is the highlight of this book. Redis Cluster is the Redis distributed solution provided by Redis3, which effectively solves the needs of Redis distribution. Understanding and applying RedisCluster will greatly liberate our needs for distributed Redis. At the same time, it is also Learn a great example of distributed storage. This chapter will analyze and explain the data distribution of RedisCluster, the establishment of clusters, node communication, request routing, cluster scaling, and failover.
10.1 Data distribution
10.2 Build a cluster
10.3 Point communication
10.4 Cluster Scaling
10.5 Request routing
10.6 Failover
10.7 Cluster operation and maintenance
Chapter 11 Cache Design
Cache can effectively accelerate the read and write speed of applications and reduce the back-end load. It is essential for developers to develop daily applications. However, adding cache to the application architecture will also bring some problems. This chapter will introduce the use and design of cache The problems encountered include: cache revenue and cost, cache update strategy, cache granularity control, penetration problem optimization, bottomless pit problem optimization, avalanche problem optimization, and hot key optimization.
11.1 Benefits and costs of caching
11.2 Cache update strategy
11.3 Cache Granularity Control
11.4 Penetration optimization
11.5 Bottomless Hole Optimization
11.6 Avalanche optimization
11.7 Hot key reconstruction optimization
Chapter 12 "Trap" of Development Operation and Maintenance
Introduce some thorny issues in Redis development, operation and maintenance, including: Linux configuration optimization, flush misoperation data recovery, how to make Redis secure, bigkey issues, hot key issues.
12.1 Linux configuration optimization
12.2 Misoperation of flushall/flushdb
12.3 Secure Redis
12.4 Dealing with bigkey
12.5 Find hot key
Chapter 13 Redis Monitoring Operation and Maintenance Cloud Platform CacheCloud
Redis monitoring operation and maintenance cloud platform CacheCloud, introduces the open source Redis operation and maintenance tool CacheCloud of the author’s team, which effectively solves some problems in Redis monitoring and operation and maintenance. This chapter will follow the rapid deployment, machine deployment, access applications, user functions, The operation and maintenance function comprehensively introduces CacheCloud in multiple dimensions. I believe that with its help, readers can better monitor and operate Redis.
13.1 What is CacheCloud
13.2 Rapid deployment
13.3 Machine deployment
13.4 Access application
13.5 User functions
13.6 Operation and maintenance functions
13.7 Client report
Chapter 14 Redis Configuration Statistics Dictionary
Redis configuration statistics dictionary will do a comprehensive review of Redis system status information and all configurations. I hope this chapter can become a Redis configuration statistics dictionary to help you analyze and solve problems encountered in daily development and operation and maintenance.
14.1 Info system status description
14.2 Standalone configuration description and analysis
14.3 Sentinel configuration description and analysis
14.4 Cluster configuration description and analysis
At last
The notes introduce Redis related knowledge in a simple way, so it can be used as an introductory tutorial for Redis novices.
Readers who step by step to improve Redis development and operation and maintenance capabilities are also very suitable.
Receiving study notes: After one-click triple connection, add the assistant vx:bjmsb2019 or vx:1249448307 to receive it for free!