The invention provides a multi-
server master and slave
machine work method based on a TCP event. By using the method, in a
system which has a high requirement to
performance efficiency and stability, two or more than two servers are arranged, configuration of each
server is the same, incremental data is synchronized and the servers can replace each other to carry out work in the
system. At one moment, only one
server is served as a master
machine (which is the aftermentioned master), other servers are served as slave machines (which are the aftermentioned slave), and incremental data of the slave machines and the master
machine is synchronized. When the master machine can not work normally, the
system selects the slave machine with the highest priority level as the new master machine. In the invention, an I / O
multiplexing model
epoll is used to manage the TCP event, efficiency is high and the method is easy to realize, and an incremental
data synchronization event can carry out incremental
data synchronization between the master machine and the slave machines so that a requirement of mutual replacement among the servers is satisfied.