Redis multi-host function purpose:Transition from a single redis server to multiple redis servers
Problems with redis standalone in the production environment
1,Insufficient memory capacity
Redis uses memory to store data in the Book database. However, for a single machine, the memory capacity of the hardware is limited. When the amount of data we need to store exceeds the memory capacity of the machine, one server cannot meet our requirements;
For example, if you want to store GB of data, but the machine supports a maximum of 64 GB memory;
2,Insufficient processing capability
Similar to the memory limit. Due to server hardware restrictions (machine configuration/network restrictions, etc.), the number of command requests that a server can process is also limited, when the number of command requests to be processed exceeds the number of command requests that can be processed by the machine, one server cannot meet our requirements;
Example: requests are processed per second, but the machine can only process requests per second;
Solution
To solve the problem of insufficient memory capacity and processing capacity, we need to use the redis multi-host function. The core purpose of these functions isDeploy the entire database on multiple servers and use multiple servers to process command requests.
For example:
Redis standalone mode: Both clienta, clientb, and clientc request servera;
Redis multi-host mode: clienta requests servera; clientb requests serverb; clientc requests serverc;
By extending the system from one server to three servers, the data volume stored by the system and the number of command requests processed will increase;
Implementation of redis multi-host Functions
Redis provides the following multi-host functions:
1,Copy(Replication): expands the system's capability to process requests;
2,Sentinel: Provides high-availability features for the system to reduce downtime;
3,Cluster(Cluster): expands the database capacity of the system and the system's ability to process read/write requests, and provides high availability features;
4,Twemproxy: Twitter is an open-source proxy server that supports redis and memcached protocols. It can expand the database capacity of the system and the system's ability to process read/write requests;
Redis multi-host function Introduction