Disclosure of Invention
The invention provides a network control center multipoint hot standby method for solving the technical problems mentioned in the background technology. The method can be applied to the scene that a plurality of network control centers are deployed in different places to perform network management configuration data hot backup, does not need to depend on available software or equipment of a third party, and is wide in applicable scene and easy to implement.
In order to achieve the purpose, the invention adopts the technical scheme that:
a network control center multipoint hot standby method comprises two stages of data initial synchronization and state machine replication;
the initial data synchronization phase comprises the following steps:
A1. the main network control center periodically sends a handshake message to each standby network control center;
A2. after receiving the handshake message of the main network control center, the standby network control center generates summary information of all local data and sends the summary information to the main network control center;
A3. after receiving the summary information of the standby network control center, the main network control center generates summary information of all local data and compares the summary information with the received summary information of the standby network control center, if the summary information of the same standby network control center received for three times continuously is not consistent with the local summary information, the step A4 is executed, otherwise, the step A1 is skipped;
A4. the main network control center generates snapshots of all local data and packages the snapshots into backup files, then transmits the backup files to the corresponding standby network control center, and the standby network control center decompresses the files and carries out filling operation, and then jumps to step A1;
the state machine replication phase comprises the following steps:
B1. each network control center maintains a log queue for storing operation logs; when the external system operates the data of the main network control center, the main network control center generates operation logs and sequentially stores the operation logs into a log queue of the main network control center;
B2. the master network control center synchronizes the operation logs to each standby network control center, and the standby network control centers sequentially store the operation logs in local log queues;
B3. and the state machines of the main and standby network control centers execute the same updating according to the same sequence in the queue, so that the consistency of the final state is ensured, and the data synchronization of the main and standby network control centers is realized.
Further, in step a2 and step A3, the specific way of generating summary information of all local data is as follows:
generating abstract information aiming at a configuration file supporting the function of the network control center and a data table for recording configuration parameters in a database, wherein the abstract information of the configuration file is recorded in a data version file; recording the latest modified time information of each configuration parameter data table in the database in a data version table;
for the configuration files, comparing the data summary information of the newly generated configuration files each time with the data summary information of the corresponding files in the data version files, if the data summary information of the newly generated configuration files is inconsistent with the data summary information of the corresponding files in the data version files, updating the data summary information of the corresponding files in the data version files, otherwise, not updating;
for the data tables, when a certain data table in the database is modified, updating the time information of the current data table of the data version table;
and generating abstract information of the data version file and abstract information of a data version table in the database, and using the two abstract information as abstract information of local data to reflect the states of all data versions of the current network control center.
The invention has the beneficial effects that:
the method can be applied to the scene that a plurality of network control centers are deployed in different places to perform network management configuration data hot backup, does not need to depend on available software or equipment of a third party, and is wide in applicable scene and easy to implement.
Detailed Description
The technical solution of the present invention will be further described with reference to the accompanying drawings and the detailed description.
A multipoint hot standby method of a network control center comprises two stages of data initial synchronization and state machine copying.
The initial data synchronization stage is realized by exchanging data summaries through a network control center, judging data consistency, generating and filling data snapshots, and specifically comprises the following steps:
A. the main network control center periodically sends handshake messages to each standby network control center.
B. After receiving the handshake message of the main network control center, the standby network control center generates summary information of all local data and sends the summary information to the main network control center.
C. And D, after the master network control center receives the abstract information of the standby network control center, generating the abstract information of all local data and comparing the abstract information with the received abstract information of the standby network control center, if the abstract information of the same standby network control center received for three times continuously is not consistent with the local abstract information, executing the step D, and otherwise, skipping to the step A.
D. And B, after the main network control center generates snapshots of all local data and packages the snapshots into backup files, transmitting the backup files to a corresponding standby network control center, decompressing the files by the standby network control center, and jumping to the step A after the backup network control center performs filling operation.
The generation of the local data summary information in the above steps B and C includes the following steps:
A. the basic data for supporting the main functions of the network control center mainly comprise configuration files and a data table for recording configuration parameters in a database. And recording the summary information of each configuration file in the data version file, comparing the generated data summary information of the new configuration file with the data summary information of the corresponding file in the data version file each time, if the data summary information of the new configuration file is inconsistent with the data summary information of the corresponding file in the data version file, updating the data summary information of the corresponding file in the data version file, and if the data summary information of the corresponding file in the data version file is not consistent with the data summary information of the corresponding file in the data version file, not updating the data summary information.
B. The latest modified time information of each configuration parameter data table in the database is recorded in the data version table, and when a certain data table in the database is modified, the time information of the current data table of the data version table is updated.
C. And generating summary information of the data version file and summary information of a data version table in the database, wherein the summary information of the data version file and the summary information of the data version table in the database reflect the current data version state of the network control center and serve as the summary information of the local data.
The state machine replication phase is executed after the data initial synchronization phase is completed, and is realized by operation log generation, operation log synchronization and state machine update, and the method specifically comprises the following steps:
A. each network control center maintains a log queue to store a series of operation logs, and when the external system operates the data of the main network control center, the main network control center generates the operation logs and sequentially stores the operation logs in the log queue.
B. The master network control center synchronizes the operation logs to each standby network control center, and the standby network control centers sequentially store the operation logs in local log queues.
C. And the state machines of the main and standby network control centers execute the same updating according to the same sequence in the queue, so that the consistency of the final state is ensured, and the data synchronization of the main and standby network control centers is realized.
Three network control centers are taken as an example to illustrate a network control center multipoint hot standby method. As shown in fig. 1, three network control centers are respectively deployed at different locations; one main network control center is connected with two standby network control centers (numbers 1 and 2) through a ground optical fiber link.
The network control center multipoint hot standby method comprises two stages of data initial synchronization and state machine copying: data abstract exchange, data consistency judgment, data snapshot generation and data filling are carried out through a network control center to realize initial synchronization of data among the network control centers; after the initial data synchronization stage is completed, the network control centers finally realize the copying of the state machines among the network control centers through operation log generation, operation log synchronization and state machine updating, and finally realize the data synchronization of the main and standby network control centers.
As shown in fig. 2, the initial synchronization phase of data is completed by the following steps:
A. the main network control center periodically sends handshake messages to the standby network control center 1 and the standby network control center 2 through an ActiveMQ message bus.
B. After receiving the handshake message of the main network control center, the standby network control center 1 and the standby network control center 2 respectively calculate the summary information of the local data version file and the data version table in the database through the MD5 algorithm, and send the respective data summary information as handshake response message to the main network control center through the message bus.
C. After receiving the handshake response messages of the standby network control center 1 and the standby network control center 2, the main network control center calculates the summary information of the local data version file and the data version table in the database through the MD5 algorithm and compares the summary information with the data summary information in the received handshake response messages. And (3) comparing the results: the data abstract information in the handshake response message of the standby network control center 1 is inconsistent with the data abstract information of the main network control center for three consecutive times, and the subsequent step D is continuously executed; and D, the data abstract information in the handshake response message of the standby network control center 2 is consistent with the data abstract information of the main network control center, and the step A is continuously executed.
D. The main network control center generates snapshots of all local data, packages the snapshots into backup files, transmits the backup files to the standby network control center 1 based on FTP, and skips step A after the standby network control center 1 decompresses the backup files and performs filling operation.
As shown in fig. 3, the state machine replication phase is completed by:
A. each network control center maintains a log queue to store a series of operation logs, and when an external system operates the data of the main network control center on the basis of the completion of the initial synchronization stage of the data, the main network control center generates the operation logs and sequentially stores the operation logs into the log queue.
B. The operation of the network control center on the data is completed by using a message triggering mechanism, the network connector function of an ActiveMQ message bus is adopted, the operation logs of the main network control center are synchronized to the standby network control center 1 and the standby network control center 2, and the received operation logs are sequentially stored in respective log queues by the standby network control center 1 and the standby network control center 2.
C. The state machines of the main network control center, the standby network control center 1 and the standby network control center 2 execute the same update according to the same sequence in the log queue, so that the consistency of the final state is ensured, and the synchronization of data between the main network control center and the standby network control center is realized.
In a word, the method periodically exchanges local data abstracts by the main network control center and the standby network control center, when the data are judged to be inconsistent, the main network control center carries out local data snapshot, and the standby network control center imports the snapshot to complete the initial synchronization of the data; on the basis, the standby network control center keeps a data synchronization state through state machine copying, and remote hot backup of the network control center configuration data is achieved.
The method can be applied to the scene that a plurality of network control centers are deployed in different places to perform network management configuration data hot backup, does not need to depend on available software or equipment of a third party, and is wide in applicable scene and easy to implement.
Although the present invention has been described in detail with reference to the above embodiments, it will be apparent to those skilled in the art that modifications may be made to the above embodiments, or equivalent substitutions and modifications may be made to other features of the embodiments, and any modifications, equivalents, improvements, etc. within the spirit and principle of the present invention should be included in the scope of the present invention.