Home > Database > Redis > How to achieve expansion of redis

How to achieve expansion of redis

步履不停
Release: 2019-06-25 19:43:40
Original
3999 people have browsed it

How to achieve expansion of redis

Expansion:

1. Cluster, use agents to achieve the purpose of clustering.

2. Master-slave synchronization, separation of reading and writing.

Advantages:

1 Excellent reading and writing performance, fast IO reading and writing from memory.

2 Supports data persistence, supporting two persistence methods: AOF and RDB (since Redis data is stored in memory, if persistence is not configured, all data will be lost after redis restarts, so it needs to be enabled The persistence function of redis saves data to the disk. When redis is restarted, the data can be restored from the disk. Redis provides two methods for persistence. One is RDB persistence: it refers to storing the memory in a specified time interval. The snapshot of the data set in is written to the disk. The actual operation process is to fork a sub-process and first write the data set to a temporary file. After the writing is successful, the previous file is replaced and stored using binary compression. There is also AOF persistence. : Record every write and delete operation processed by the server in the form of a log. The query operation will not be recorded, but will be recorded in the form of text. You can open the file to see the detailed operation record.)

3 Support master-slave Copy, the host will automatically synchronize data to the slave, and read and write can be separated.

4 Rich data structures: In addition to supporting string type value, it also supports string, hash, set, sortedset, list and other data structures.

5 Redis is single-threaded and multi-CPU, which makes it faster. Because it is single-threaded, there is no overhead of thread switching, and there is no need to consider locking and releasing locks, so there is no deadlock problem. Single-threaded-multiplexed IO model. efficient.

Disadvantages:

1 Master-slave synchronization, if the host goes down, some data is not synchronized to the slave before the downtime, which will lead to data inconsistency.

2. Master-slave synchronization, data synchronization will be delayed.

3. Separation of reading and writing. If the load written by the host is too large, it will also cause the host to crash.

For more Redis-related technical articles, please visit Redis Tutorial Column for learning!

The above is the detailed content of How to achieve expansion of redis. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template