摘要 |
A method and device for switching a primary database and a secondary database. The method comprises: monitoring the operation of a first database used as a current primary database, and sending a secondary-to-primary switching request to a second database used as a current secondary database when it is detected that the first database is in abnormal operation; acquiring reported feedback data when the second database detects that data in the second database are consistent with the data in the first database and the second database is successfully switched into the current primary database, and acquiring, according to the feedback data, data switching information, finally synchronized from the first database, of the second database; and sending a primary-to-secondary switching request comprising the data switching information to the first database, and switching the first database into the current secondary database when it is judged, according to the data switching information, that the data synchronized to the second database are not in data loss. |