摘要 |
Embodiments of the present invention provide a method and device for complementing data, and relate to the field of computers. The method provided in the present invention includes:during the process of master database switching in a master-slave database cluster, a slave database is selected from the database cluster to serve as a new master database; first connections between the new master database and all the other slave databases are sequentially built; the data of the new master database is compared with the data of all the other slave databases to enable the new data in all the other slave databases to be synchronized into the master database so that the data of the new master database can be complemented. The new master database accordingly has the newest data in the database cluster, smooth switching of the master database is guaranteed, and therefore normal running of database business can not be influenced. |