Redis Data Summary (eight) master-slave replication

Source: Internet
Author: User

Redis Master-slave replication configuration and usage are simple. Master-slave replication allows multiple slave servers to have the same database copy as master server. Here are some of the features of Redis master-slave replication

1.master can have multiple slave
2. In addition to multiple slave connected to the same master, slave can also connect other slave to form a graphic structure
3. Master-slave replication does not block primary. This means that when one or more slave and master synchronize data for the first time, master can continue to process requests from the client. Conversely, slave will block requests that cannot process the client when the data is first synchronized.
4. Master-slave replication can be used to improve the scalability of the system, we can use multiple slave dedicated to client read requests, such as the sort operation can be handled using slave. can also be used to do simple data redundancy
5. You can disable data persistence in master, just comment out all the save configurations in the master configuration file and configure data persistence on slave only.

The following describes the process of master-slave replication

When the slave server is set up, slave will establish a connection to master and then send the Sync command. Whether the connection was first synchronized or after a disconnected connection, master initiates a background process, saves the database snapshot to a file, and the master master process starts collecting new write commands and caches them. After the background process finishes writing the file, master sends the file to Slave,slave to save the file to disk, and then loads it into the memory recovery database snapshot to slave. The master then forwards the cached command to slave. and subsequent master commands are sent to the slave by the connection that was started to be established. Commands that synchronize data from master to slave and commands sent from the client use the same protocol format. Slave can automatically reestablish a connection when master and slave are disconnected. If master receives multiple slave simultaneous connection commands at the same time, it will only use the START process to write database mirroring and then send it to all slave.

Configuring the slave server is simple, just add the following configuration to the configuration file

Slaveof 192.168.1.1 6379 #指定master的ip和端口

Redis Data Summary (eight) master-slave replication

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.