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?
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
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.