Home >Backend Development >PHP Tutorial >Both the master and slave servers use redis (saving them into the mysql library is not considered for the time being). How to ensure that the data of each machine is unified in real time?

Both the master and slave servers use redis (saving them into the mysql library is not considered for the time being). How to ensure that the data of each machine is unified in real time?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:21:531194browse

We all know that redis has redis-cli to implement the subscription and publishing function. Similar to this, if the data of the master server is modified, how to notify each slave server to change the data in real time (millisecond level)? For example, in the 12306 ticket grabbing, the servers in Beijing, Guangzhou and Shanghai should record and display the remaining tickets on the main server in real time. Once the ticket purchase action is completed, how can each server be notified of the change of status in real time? I'm a noob, I hope you can teach me

Reply content:

We all know that redis has redis-cli to implement the subscription and publishing function. Similar to this, if the data of the master server is modified, how to notify each slave server to change the data in real time (millisecond level)? For example, in the 12306 ticket grabbing, the servers in Beijing, Guangzhou and Shanghai should record and display the remaining tickets on the main server in real time. Once the ticket purchase action is completed, how can each server be notified of the change of status in real time? I'm a noob, I hope you can teach me

Since you have made a master-slave configuration, if the data on the master server is modified, the slave server will automatically synchronize.

Statement:
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