Data synchronization method and device and electronic equipment

By configuring remote dictionary services in a dual-machine hot standby system and using heartbeat communication, efficient data synchronization between master and slave devices is achieved, solving the problems of complex and low efficiency of data synchronization in the prior art, and improving synchronization efficiency and Save memory.

CN119496786APending Publication Date: 2025-02-21ZHEJIANG UNIVIEW TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410930129.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In dual-machine hot standby, the data synchronization process is complex and inefficient, especially when there are many business modules and many table entries, it is impossible to achieve rapid batch synchronization and waste memory.

Method used

By configuring remote dictionary services in the master and slave devices, and using heartbeat communication, analyzing data update information, organizing module identification, updating actions and update content, using the list operation interface to write update data to the queue, and performing through the communication channel synchronous.

Benefits of technology

It realizes rapid batch synchronization during large-scale data updates, improves data synchronization efficiency, and saves memory consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496786A_ABST
    Figure CN119496786A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data synchronization method and device and electronic equipment. Remote dictionary services are configured in the master device and the slave device respectively, and communication is carried out through a heartbeat line; when the method is executed by a master device, the method comprises the steps that when data updating exists, data updating information is analyzed to obtain a module identifier, an updating action and updating content corresponding to a module for data updating; arranging the module identifier, the updating action and the updating content according to a list data format of the remote dictionary service to obtain updating data; and calling a list operation interface in the remote dictionary service to write the updated data into a queue, and sending the updated data to the remote dictionary service of the slave device through the communication channel, so that the master device and the slave device realize data synchronization. According to the scheme, the problems of low updating speed and low efficiency when a large amount of data needs to be updated are solved, the updated data of different modules are distinguished through the module identifiers and are transmitted in the same queue, the data synchronization efficiency is improved, and the memory consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data synchronization, and in particular to a data synchronization method, device and electronic device. Background Art

[0002] Hot standby is a high-availability technology that is mainly used to ensure the continuity and reliability of computer systems or network services. This technology usually involves two or more servers or network devices, one of which works as the master device and the other devices as backup devices. Under normal circumstances, the master device handles all requests and tasks, while the slave device is in a monitoring state and synchronizes the data and status of the master device in real time. If the master device fails or is abnormal, the slave device will take over the work in a very short time and continue to provide services, thus ensuring that the business system or network service will not be interrupted.

[0003] At present, in the process of data synchronization between the master and slave devices in dual-machine hot standby, the configuration or table item synchronization is generally achieved by encapsulating the message based on the private protocol extension message header, but the extension process is complicated and the workload is large. The data synchronization solution based on the interface function of the storage database cannot be synchronized quickly in batches when there are many business modules and business table item types to be processed, and it wastes memory. Summary of the invention

[0004] The embodiments of the present application provide a data synchronization method, device and electronic device, so as to enable rapid batch synchronization when the amount of data to be synchronized is large.

[0005] According to one aspect of the present application, a data synchronization method is provided, which is executed by a master device, wherein the master device and the slave device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the method comprises:

[0006] When there is data update in the master device, the data update information is parsed to obtain the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device;

[0007] Arranging the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device to obtain update data;

[0008] The list operation interface in the remote dictionary service in the master device is called to write the updated data into a queue, and the updated data is sent to the remote dictionary service of the slave device through a communication channel, so that the master device and the slave device achieve data synchronization.

[0009] According to one aspect of the present application, a data synchronization method is provided, which is executed by a slave device, wherein the slave device and the master device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the method comprises:

[0010] The remote dictionary service in the slave device monitors whether there is update data in the communication channel; wherein the update data is written into a queue by a list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain a module identifier, an update action, and an update content, and then sorting the data according to the list data format of the remote dictionary service;

[0011] If it exists, calling the list operation interface in the remote dictionary service in the slave device to parse the update data, and determining the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device;

[0012] Data synchronization is performed according to the module identifier, the update action, and the update content.

[0013] According to one aspect of the present application, a data synchronization device is provided, which is configured in a master device, wherein the master device and the slave device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the device comprises:

[0014] A data update information parsing module, used for parsing the data update information to obtain the module identification, update action and update content corresponding to the module targeted by the data update when there is data update in the master device; wherein the module is a functional module included in the device;

[0015] An update data generation module, used for arranging the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device to obtain update data;

[0016] The update data synchronization module is used to call the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and send the update data to the remote dictionary service of the slave device through the communication channel to synchronize the data between the master device and the slave device.

[0017] According to one aspect of the present application, a data synchronization device is provided, which is configured in a slave device, wherein the slave device and the master device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the device comprises:

[0018] An update data monitoring module is used to monitor whether there is update data in the communication channel through the remote dictionary service in the slave device; wherein the update data is written into the queue by the list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain the module identification, update action and update content, and then sorting according to the list data format of the remote dictionary service;

[0019] An update data parsing module, for, if present, calling the list operation interface in the remote dictionary service in the slave device to parse the update data, and determining the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device;

[0020] A data synchronization module is used to synchronize data according to the module identifier, the update action and the update content.

[0021] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:

[0022] at least one processor; and

[0023] A memory connected to at least one processor for data processing; wherein,

[0024] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the data synchronization method executed by the master device in any embodiment of the present application, or execute the data synchronization method executed by the slave device in any embodiment of the present application.

[0025] According to another aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to implement the data synchronization method executed by a master device in any embodiment of the present application, or implement the data synchronization method executed by a slave device in any embodiment of the present application when executed.

[0026] The technical solution of the embodiment of the present application is that the master device and the slave device are respectively configured with a remote dictionary service and communicate through a heartbeat line; when executed by the master device, the method includes: when there is data update in the master device, parsing the data update information to obtain the module identification, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module contained in the device; arranging the module identification, update action and update content according to the list data format of the remote dictionary service in the master device to obtain the update data; calling the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and sending the update data to the remote dictionary service of the slave device through the communication channel, so that the master device and the slave device can achieve data synchronization. The above scheme solves the current problem of slow update speed and low efficiency when a large amount of data needs to be updated. The module identification, update action and update content can be transmitted according to the list data format of the remote dictionary service by parsing the data update information, thereby realizing that the update data of different modules are transmitted in the same queue, improving the data synchronization efficiency and saving memory consumption.

[0027] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0029] Figure 1 A flowchart of a data synchronization method performed by a master device provided in an embodiment of the present application;

[0030] Figure 2 A schematic diagram of the configuration and table entry synchronization process provided in an embodiment of the present application;

[0031] Figure 3 A flowchart of a data synchronization method performed by a master device according to another embodiment of the present application;

[0032] Figure 4 A flowchart of a data synchronization method performed by a master device provided in another embodiment of the present application;

[0033] Figure 5 A flowchart of a data synchronization method performed by a slave device provided in an embodiment of the present application;

[0034] Figure 6 A configuration synchronization flow chart provided for an embodiment of the present application;

[0035] Figure 7 A table entry synchronization flow chart provided in an embodiment of the present application;

[0036] Figure 8 A schematic diagram of the structure of a data synchronization device configured on a master device provided in an embodiment of the present application;

[0037] Fig. 9 A schematic diagram of the structure of a data synchronization device configured on a slave device provided in an embodiment of the present application;

[0038] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0040] It should be noted that the terms "first", "second", "third", "fourth", "actual", "preset", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] Figure 1A flowchart of a data synchronization method provided in an embodiment of the present application, the embodiment of the present application can be applied to the case where data is synchronized between a master device and a slave device. Typically, the embodiment of the present application can be applied to the case where there are many types of services that need to be synchronized, and a remote dictionary service is used to synchronize data between a master device and a slave device. The method can be executed by a data synchronization device, which can be implemented in the form of hardware and / or software, and the data synchronization device can be configured in an electronic device. Figure 1 As shown, when the method is executed by the master device, it includes:

[0042] S110, when there is data update in the master device, parse the data update information to obtain the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device. The master device and the slave device are respectively configured with remote dictionary services and communicate through a heartbeat line.

[0043] Among them, the master device and the slave device are relative concepts, which are the devices currently used to process requests and tasks among at least two devices. When the master device fails or is abnormal, the slave device can be converted to the master device, and the original master device is converted to the slave device. In an embodiment of the present application, the master device and the slave device can be network devices, such as routers, switches, firewalls, gateways, etc. The master device and the slave device are respectively configured with a remote dictionary service, i.e., a Redis service. The master device and the slave device communicate via a heartbeat line.

[0044] Data updates include configuration updates and table item updates. Configuration refers to data set to enable the normal operation of a device or system, which may include hardware data, docking data, signaling data, routing data, number analysis data, etc. Table items are static data that has been generated for recording. For example, Figure 2 As shown, the user can update the configuration data in the configuration management plane, synchronize the configuration between the configuration management planes of the master device and the slave device, in the master device, the configuration is sent to the data plane by the configuration management plane, in the slave device, the configuration is sent to the data plane by the configuration management plane, and the table items updated in the data plane are synchronized from the data plane of the master device to the data plane of the slave device. The module can be a module corresponding to each function in the master device. For example, the modules of a router include input modules, output modules, packet exchange modules, and routing selection modules.

[0045] Exemplarily, if there is data update in the master device, the master device parses the data update information to obtain the module targeted by the data update, determines the module identifier corresponding to the module, and parses to obtain the update action of the data update, such as adding, modifying, deleting part, deleting all, etc., and parses to obtain the update content of the data update, such as which specific configurations are targeted for the update action. The above process can be continued, and as long as the data update is detected, the above process is executed to parse to obtain the module identifier, update action and update content of this data update.

[0046] S120, sorting the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device to obtain update data.

[0047] The remote dictionary service is the Redis service, which is a key-value storage system. Redis supports master-slave synchronization. Data can be synchronized from the master server to any number of slave servers. The List operation in the remote dictionary service can synchronize data between the master device and the slave device. In the master device, the list operation interface in the remote dictionary service can write the updated data into the queue and send it to the slave device. In the slave device, the list operation interface in the remote dictionary service can obtain the updated data from the data channel and parse it.

[0048] When the list operation interface in the remote dictionary service in the master device is used for synchronization, the synchronized data needs to meet the data format required by the list operation. The module identifier, update action and update content can be sorted according to the list data format of the remote dictionary service in the master device to obtain the update data, so as to facilitate the synchronization of the update data using the list operation interface.

[0049] Updated data needs to be serialized and saved in binary format to meet the requirements of subsequent transmission.

[0050] S130, calling the list operation interface in the remote dictionary service in the master device to write the updated data into a queue, and sending the updated data to the remote dictionary service of the slave device through a communication channel, so that the master device and the slave device achieve data synchronization.

[0051] Among them, the list operation interface in the remote dictionary service in the master device may include an rpush interface and an lpush interface. Lpush refers to inserting one or more values ​​into the header of the list key, and each value is inserted in sequence from left to right. Rpush refers to inserting one or more values ​​into the tail of the list key, and each value is inserted in sequence from left to right. The list operation interface can be called to write the updated data into the queue and send it to the remote dictionary service of the slave device through the communication channel. The remote dictionary service of the slave device monitors in real time whether there is updated data in the communication channel. If so, it obtains the updated data, calls the list operation interface for parsing, and realizes data synchronization between the master device and the slave device.

[0052] In the embodiment of the present application, the module identification, update action and update content targeted by the data update are obtained by parsing, and the update data corresponding to different module identifications can be written in the same queue, and the update data for different modules can be transmitted and synchronized in batches, thereby improving the efficiency of data synchronization when a large amount of data needs to be synchronized in the network device. When the update data in the queue is received from the device, the object targeted by the update data can be determined according to the module identification, so as to perform the corresponding update action for the update content of the object, solving the problem that a piece of data update information can only be stored in one queue, cannot be transmitted in batches, has low data synchronization efficiency, and occupies memory.

[0053] In an embodiment of the present application, calling a list operation interface in a remote dictionary service in the master device to write the update data into a queue, and sending the update data to the remote dictionary service of the slave device through a communication channel includes:

[0054] Recording update data corresponding to at least one module identifier in a queue according to a preset queue capacity;

[0055] The queue containing the updated data is sent to the remote dictionary service of the slave device through the communication channel.

[0056] Exemplarily, the queue capacity is pre-set to specify the amount of update data that the queue can accommodate. The update data corresponding to at least one module identifier is recorded in the queue according to the preset queue capacity. The update data currently sorted may be update data for only one module, or may include update data for multiple modules. When the amount of update data meets the preset queue capacity, all the update data corresponding to at least one module identifier currently sorted can be recorded in the same queue, thereby realizing batch transmission and synchronization of update data, solving the problem of low efficiency and slow speed of data synchronization under large business volume.

[0057] The technical solution of the embodiment of the present application is that the master device and the slave device are respectively configured with a remote dictionary service and communicate through a heartbeat line; when executed by the master device, the method includes: when there is data update in the master device, parsing the data update information to obtain the module identification, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module contained in the device; arranging the module identification, update action and update content according to the list data format of the remote dictionary service in the master device to obtain the update data; calling the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and sending the update data to the remote dictionary service of the slave device through the communication channel, so that the master device and the slave device can achieve data synchronization. The above scheme solves the current problem of slow update speed and low efficiency when a large amount of data needs to be updated. The module identification, update action and update content can be transmitted according to the list data format of the remote dictionary service by parsing the data update information, thereby realizing that the update data of different modules are transmitted in the same queue, improving the data synchronization efficiency and saving memory consumption.

[0058] Figure 3 This is a flow chart of a data synchronization method provided by another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 3 As shown, the method of the embodiment of the present application specifically includes the following steps:

[0059] S210: Receive configuration information for service configuration from a user through a command line console or a web page.

[0060] In an embodiment of the present application, the data update information is configuration information; the update action includes a configuration action; and the update content includes configuration content.

[0061] Exemplarily, the user can generate configuration information by performing business configuration through the command line console or web page. After the configuration is completed, the configuration management plane of the master device sends the configuration information to the data plane to implement the sending of configuration information in the master device. In the data plane, the corresponding operation is performed according to the configuration information. If it is configuration addition, the configuration addition interface is called to add the configuration. If it is configuration deletion, the configuration deletion interface is called to delete it. If it is configuration modification, the configuration modification interface is called to modify it. If the configuration is completely cleared, the clearing interface is called to clear the entire configuration.

[0062] S220: Parse the configuration information to determine the module identifier, configuration action, and configuration content corresponding to the module for which the user performs service configuration.

[0063] The module identifier may be obtained by pre-marking each module in the main device, and may be distinguished by numbers, letters, words, etc. The configuration action may include adding, modifying, deleting part, deleting all, etc. The configuration content may be the content targeted by the configuration action, such as specific fields, keywords, specific configurations, etc. Exemplarily, after the main device sends the configuration information from the configuration management plane to the data plane, it parses the configuration information to determine the module identifier, configuration action, and configuration content corresponding to the module targeted by the user for service configuration.

[0064] S230: Arrange the module identifier, the configuration action, and the configuration content according to the list data format of the remote dictionary service in the master device to obtain configuration update data.

[0065] Exemplarily, the module identification, configuration action and configuration content can be sorted according to the list data format of the remote dictionary service in the master device to obtain the configuration update data. Specifically, a new data model can be constructed based on the list data format of the remote dictionary service in the master device, and the module identification, configuration action and configuration content can be filled into the data model to obtain the configuration update data.

[0066] S240: Call the list operation interface in the remote dictionary service in the master device to write the configuration update data into a queue, and send the configuration update data to the remote dictionary service of the slave device through a communication channel, so that the master device and the slave device achieve data synchronization.

[0067] Exemplarily, the remote dictionary service in the slave device monitors whether there is configuration update data. If so, the list operation interface in the remote dictionary service is called to parse the configuration update data, obtain the module identifier, configuration action and configuration content, and call the corresponding processing interface to send the configuration. If it is configuration addition, the configuration addition interface is called to add the configuration. If it is configuration deletion, the configuration deletion interface is called to delete it. If it is configuration modification, the configuration modification interface is called to modify it. If the configuration is completely cleared, the clearing interface is called to clear the entire configuration. If there is no configuration update data in the communication channel, continue monitoring.

[0068] An embodiment of the present application provides a data synchronization method, which receives configuration information for business configuration by a user through a command line console or a web page; parses the configuration information to determine the module identifier, configuration action, and configuration content corresponding to the module for which the user performs business configuration. The module identifier, the configuration action, and the configuration content are sorted according to the list data format of the remote dictionary service in the master device to obtain configuration update data. The list operation interface in the remote dictionary service in the master device is called to write the configuration update data into a queue, and the configuration update data is sent to the remote dictionary service of the slave device through a communication channel. The above scheme can parse the module identifier, configuration action, and configuration content corresponding to the module for which the configuration update is targeted when there is an update to the configuration, so that the configuration update data for different modules can be written into the same queue for batch transmission and synchronization, thereby improving data synchronization efficiency.

[0069] Figure 4 This is a flowchart of a data synchronization method provided by another embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the present embodiment, please refer to the above embodiment. Figure 4 As shown, the method of the embodiment of the present application specifically includes the following steps:

[0070] S310: Process the received message to generate table entry update information.

[0071] Exemplarily, when the master device receives a message, it parses the message to generate table entry update information.

[0072] S320 , periodically poll the stored entries to determine whether there are aged entries that need to be deleted; if so, delete the aged entries and generate entry update information.

[0073] For example, generally, a table entry has a certain storage time after being stored. If the storage time is exceeded, it needs to be deleted in time to release memory. The master device can periodically poll the stored table entries to detect whether the table entries are aged and need to be deleted. If there are aged table entries that need to be deleted, the aged table entries are deleted and table entry update information is generated.

[0074] S330: Monitor whether there is configuration information for processing the stored table entry; if so, process the table entry according to the configuration information and generate table entry update information.

[0075] Exemplarily, the user may also process the table items through configuration, and may monitor whether there is configuration information for processing the stored table items. If so, the table items may be processed according to the configuration information, such as deleting some table items or deleting all table items, and generating table item update information.

[0076] It should be noted that S310 - S330 are three parallel execution steps and are not affected by each other.

[0077] S340: parse the entry update information to determine a module identifier, an entry processing action, and an entry processing content corresponding to the module targeted by the entry update.

[0078] Exemplarily, the master device parses the entry update information to determine the module identifier, entry processing action and entry processing content corresponding to the module targeted by the entry update. The entry processing action includes adding, modifying, deleting part and deleting all. The entry processing content includes specific entries.

[0079] S350: Arrange the module identifier, the entry processing action, and the entry processing content according to the list data format of the remote dictionary service in the master device to obtain entry update data.

[0080] Exemplarily, in order to make the synchronized data format meet the data format required by the list processing interface of the remote dictionary service, it is necessary to sort the module identification, the table item processing action and the table item processing content according to the list data format of the remote dictionary service in the master device to obtain the table item update data. Specifically, a new data model can be constructed based on the list data format of the remote dictionary service in the master device, and the module identification, the table item processing action and the table item processing content can be filled into the data model to obtain the table item update data.

[0081] S360: Call the list operation interface in the remote dictionary service in the master device to write the entry update data into a queue, and send the update data to the remote dictionary service of the slave device through a communication channel, so that the master device and the slave device achieve data synchronization.

[0082] Exemplarily, the remote dictionary service in the slave device monitors whether there is table item update data. If there is, the list operation interface in the remote dictionary service is called to parse the table item update data to obtain the module identifier, table item processing action and table item processing content. If it is to add a table item, the add interface is called to add the table item; if it is to delete a table item, the delete interface is called to delete it; if it is to modify a table item, the modify interface is called to modify it; if all table items are cleared, the clear interface is called to clear the entire table item. If there is no table item update data in the communication channel, continue monitoring.

[0083] The embodiment of the present application provides a data synchronization method, which determines the table item update information through at least one of the following: processing the received message to generate the table item update information; periodically polling the stored table items to determine whether there are aged table items that need to be deleted, if so, deleting the aged table items and generating the table item update information; monitoring whether there is configuration information for processing the stored table items, if so, processing the table items according to the configuration information and generating the table item update information; parsing the table item update information to determine the module identifier, table item processing action and table item processing content corresponding to the module targeted by the table item update. The module identifier, the table item processing action and the table item processing content are sorted according to the list data format of the remote dictionary service in the master device to obtain the table item update data. The list operation interface in the remote dictionary service in the master device is called to write the table item update data into the queue, and the update data is sent to the remote dictionary service of the slave device through the communication channel, so that the master device and the slave device can achieve data synchronization. In an embodiment of the present application, when an entry is updated, the module identifier, entry processing action and entry processing content corresponding to the module are parsed, and the entry update data of different modules can be written into the same queue for transmission and synchronization, thereby improving the efficiency of entry synchronization.

[0084] Figure 5 A flowchart of a data synchronization method provided in an embodiment of the present application, the embodiment of the present application can be applied to the case where data is synchronized between a master device and a slave device. Typically, the embodiment of the present application can be applied to the case where there are many types of services that need to be synchronized, and a remote dictionary service is used to synchronize data between a master device and a slave device. The method can be executed by a data synchronization device, which can be implemented in the form of hardware and / or software, and the data synchronization device can be configured in an electronic device. Figure 5 As shown, when the method is executed by the slave device, it includes:

[0085] S410, monitoring whether there is update data in the communication channel through the remote dictionary service in the slave device; wherein the update data is written into a queue by a list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain a module identifier, an update action, and an update content, and then sorting the data according to the list data format of the remote dictionary service.

[0086] Exemplarily, the slave device monitors in real time through the remote dictionary service whether there is update data in the communication channel, and the update data includes configuration update data and table item update data. The configuration update data and table item update data can be distinguished according to a preset identifier. The process of the master device generating update data and transmitting update data is shown in the above embodiment.

[0087] S420: If so, call the list operation interface in the remote dictionary service in the slave device to parse the update data, and determine the module identifier, update action, and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device.

[0088] Exemplarily, if the slave device detects that there is update data in the communication channel, the list operation interface in the remote dictionary service is called to parse the update data to determine the corresponding module identifier, update action, and update content of the module targeted by the data update. If the update data is configuration update data, the module identifier, configuration action, and configuration content corresponding to the module targeted by the configuration are determined; if the update data is table item update data, the module identifier, table item processing action, and table item processing content corresponding to the module targeted by the table item update are determined.

[0089] S430: Perform data synchronization according to the module identifier, the update action, and the update content.

[0090] Exemplarily, a corresponding update action is executed for the update content in the module corresponding to the module identifier to achieve data synchronization.

[0091] In the embodiment of the present application, the update data includes configuration update data; the update action includes configuration action; the update content includes configuration content;

[0092] Accordingly, data synchronization is performed according to the module identifier, the update action, and the update content, including:

[0093] Sending the module identifier, the configuration action, and the configuration content from the configuration management plane of the slave device to the data plane;

[0094] Determine a target configuration processing module corresponding to the configuration action; wherein the configuration action includes configuration addition, configuration deletion, configuration modification and configuration clearing;

[0095] Based on the target configuration processing module, the configuration content in the module corresponding to the module identifier is processed.

[0096] Exemplarily, if the update data is configuration update data, the update action includes the configuration action, and the update content includes the configuration content. The configuration update data is sent from the configuration management plane of the master device to the configuration management plane of the slave device. After the configuration management plane of the slave device obtains the configuration update information, the configuration update data is sent from the configuration management plane to the data plane. In the data plane, the target configuration processing module corresponding to the configuration action is determined. Based on the target configuration processing module, the configuration content in the module corresponding to the module identifier is processed to achieve configuration synchronization. If it is a configuration addition, the configuration addition interface is called to add the configuration. If it is a configuration deletion, the configuration deletion interface is called to delete it. If it is a configuration modification, the configuration modification interface is called to modify it. If the configuration is completely cleared, the clear interface is called to clear the entire configuration. If there is no configuration update data in the communication channel, continue monitoring.

[0097] In an embodiment of the present application, if the configuration action is configuration saving, data synchronization is performed according to the module identifier, the update action, and the update content, including:

[0098] The configuration management plane of the slave device writes the configuration content in the module corresponding to the module identifier into the hard disk for storage.

[0099] Exemplarily, if the configuration action is configuration saving, the configuration content in the module corresponding to the module identifier is directly written into the hard disk in the configuration management plane for saving and permanent storage.

[0100] The flow chart of the configuration update process is as follows: Figure 6 As shown, the configuration update data is generated by the master device and transmitted through the remote dictionary service, and the slave device receives the configuration update data through the remote dictionary service and performs the configuration update process.

[0101] In an embodiment of the present application, the update data includes table entry update data; the update action includes a table entry processing action; the update content includes a table entry processing content; the table entry update information is synchronized from the data plane of the master device to the data plane of the slave device;

[0102] Accordingly, data synchronization is performed according to the module identifier, the update action, and the update content, including:

[0103] Determine a target entry processing module corresponding to the entry processing action; wherein the entry processing action includes entry addition, entry deletion, entry modification and entry clearing;

[0104] Based on the target entry processing module, the entry processing content in the module corresponding to the module identifier is processed.

[0105] Exemplarily, if the update data is table item update data, the update action is a table item processing action, and the update content is a table item processing content. In the process of updating the table items, the data plane of the master device is synchronized to the data plane of the slave device. After obtaining the table item update data, the table item update data is parsed to obtain the module identifier, the table item processing action and the table item processing content, and the corresponding table item processing process is performed according to the above information. Specifically, the target table item processing module corresponding to the table item processing action is determined, and based on the target table item processing module, the table item processing content in the module corresponding to the module identifier is processed. If a table item is added, the add interface is called to add the table item, if the table item is deleted, the delete interface is called to delete, if the table item is modified, the modify interface is called to modify, and if all table items are cleared, the clear interface is called to clear the entire table item. If there is no table item update data in the communication channel, continue monitoring.

[0106] The flowchart of the table entry update process is as follows Figure 7 As shown, the table entry update data is generated by the master device and transmitted via the remote dictionary service, and the slave device receives the remote dictionary service and executes the table entry update process.

[0107] The embodiment of the present application provides a data synchronization method, wherein the remote dictionary service in the slave device monitors whether there is update data in the communication channel; wherein the update data is the list operation interface of the remote dictionary service in the master device writing the update data into the queue and sending it through the communication channel; the update data is obtained by parsing the data update information to obtain the module identification, update action and update content, and then sorting it according to the list data format of the remote dictionary service; if it exists, the list operation interface in the remote dictionary service in the slave device is called to parse the update data, and determine the module identification, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device; data synchronization is performed according to the module identification, the update action and the update content. In the embodiment of the present application, the slave device monitors whether there is update data in real time through the remote dictionary service, and if it exists, the module identification, update action and update content in the update data are parsed, so as to accurately distinguish the update data that may be targeted at different modules in the same queue, and accurately determine the targeted module according to the module identification, and perform the update action on the update content in the module, so as to realize the differentiated and targeted processing of the update data transmitted in batches, and efficiently realize data synchronization.

[0108] Figure 8 This is a schematic diagram of the structure of a data synchronization device provided in an embodiment of the present application. The device can execute the data synchronization method provided in any embodiment of the present application and has the corresponding functional modules and beneficial effects of the execution method. Figure 8As shown, the device is configured in a master device, and the master device and the slave device are respectively configured with a remote dictionary service and communicate through a heartbeat line; the device includes:

[0109] The data update information parsing module 510 is used to parse the data update information to obtain the module identification, update action and update content corresponding to the module targeted by the data update when there is data update in the master device; wherein the module is a functional module included in the device;

[0110] An update data generation module 520, configured to obtain update data by arranging the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device;

[0111] The update data synchronization module 530 is used to call the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and send the update data to the remote dictionary service of the slave device through the communication channel to synchronize the data between the master device and the slave device.

[0112] In the embodiment of the present application, the data update information is configuration information; the update action includes a configuration action; the update content includes configuration content;

[0113] Accordingly, when there is data update in the master device, the data update information parsing module 510 parses the data update information to obtain the module identifier, update action and update content corresponding to the module targeted by the data update, including:

[0114] Receive configuration information for business configuration from users through a command line console or a web page;

[0115] The configuration information is parsed to determine the module identifier, configuration action, and configuration content corresponding to the module for which the user performs service configuration.

[0116] In the embodiment of the present application, the update data includes table item update data; the update action includes table item processing action; the update content includes table item processing content;

[0117] Accordingly, when there is data update in the master device, the data update information parsing module 510 parses the data update information to obtain the module identifier, update action and update content corresponding to the module targeted by the data update, including:

[0118] The table entry update information is determined by at least one of the following:

[0119] Processing received messages to generate table entry update information;

[0120] Regularly poll the stored entries to determine whether there are any aged entries that need to be deleted. If so, delete the aged entries and generate entry update information.

[0121] Monitoring whether there is configuration information for processing the stored table entry, and if so, processing the table entry according to the configuration information and generating table entry update information;

[0122] The entry update information is parsed to determine a module identifier, an entry processing action, and an entry processing content corresponding to the module targeted by the entry update.

[0123] In the embodiment of the present application, the update data synchronization module 530 calls the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and sends the update data to the remote dictionary service of the slave device through the communication channel, including:

[0124] Recording update data corresponding to at least one module identifier in a queue according to a preset queue capacity;

[0125] The queue containing the updated data is sent to the remote dictionary service of the slave device through the communication channel.

[0126] A data synchronization device provided in an embodiment of the present application can execute a data synchronization method provided in any embodiment of the present application and executed by a master device, and has functional modules and beneficial effects corresponding to the execution method.

[0127] Fig. 9 This is a schematic diagram of the structure of a data synchronization device provided in an embodiment of the present application. The device can execute the data synchronization method provided in any embodiment of the present application and has the corresponding functional modules and beneficial effects of the execution method. Fig. 9 As shown, the device is configured in a slave device, and the slave device and the master device are respectively configured with a remote dictionary service and communicate through a heartbeat line; the device includes:

[0128] The update data monitoring module 610 is used to monitor whether there is update data in the communication channel through the remote dictionary service in the slave device; wherein the update data is written into the queue by the list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain the module identification, update action and update content, and then sorting according to the list data format of the remote dictionary service;

[0129] The update data parsing module 620 is used to call the list operation interface in the remote dictionary service in the slave device to parse the update data if it exists, and determine the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device;

[0130] The data synchronization module 630 is used to perform data synchronization according to the module identifier, the update action and the update content.

[0131] In the embodiment of the present application, the update data includes configuration update data; the update action includes configuration action; the update content includes configuration content;

[0132] Accordingly, the data synchronization module 630 performs data synchronization according to the module identifier, the update action and the update content, including:

[0133] Sending the module identifier, the configuration action, and the configuration content from the configuration management plane of the slave device to the data plane;

[0134] Determine a target configuration processing module corresponding to the configuration action; wherein the configuration action includes configuration addition, configuration deletion, configuration modification and configuration clearing;

[0135] Based on the target configuration processing module, the configuration content in the module corresponding to the module identifier is processed.

[0136] In the embodiment of the present application, if the configuration action is configuration saving, the data synchronization module 630 performs data synchronization according to the module identifier, the update action and the update content, including:

[0137] The configuration management plane of the slave device writes the configuration content in the module corresponding to the module identifier into the hard disk for storage.

[0138] In an embodiment of the present application, the update data includes table entry update data; the update action includes a table entry processing action; the update content includes a table entry processing content; the table entry update information is synchronized from the data plane of the master device to the data plane of the slave device;

[0139] Accordingly, the data synchronization module 630 performs data synchronization according to the module identifier, the update action and the update content, including:

[0140] Determine a target entry processing module corresponding to the entry processing action; wherein the entry processing action includes entry addition, entry deletion, entry modification and entry clearing;

[0141] Based on the target entry processing module, the entry processing content in the module corresponding to the module identifier is processed.

[0142] A data synchronization device provided in an embodiment of the present application can execute a data synchronization method provided in any embodiment of the present application and executed by a slave device, and has functional modules and beneficial effects corresponding to the execution method.

[0143] Fig.10 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0144] like Fig.10 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the data processing of the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0145] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a data processing unit 19, such as a network card, a modem, a wireless data processing transceiver, etc. The data processing unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0146] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a data synchronization method performed by a master device, or a data synchronization method performed by a slave device.

[0147] In some embodiments, the data synchronization method performed by the master device, or the data synchronization method performed by the slave device may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the data processing unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data synchronization method performed by the master device, or the data synchronization method performed by the slave device described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the data synchronization method performed by the master device, or the data synchronization method performed by the slave device, in any other appropriate manner (e.g., by means of firmware).

[0148] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0149] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data synchronization device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0150] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device or equipment. A computer readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0151] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0152] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data processing (e.g., a data processing network). Examples of data processing networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0153] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a data processing network. The client and server relationship is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0154] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the information expected by the technical solution of this application can be achieved, and this document is not limited here.

[0155] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A data synchronization method, characterized in that: The method is executed by a master device, wherein the master device and the slave device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the method comprises: When there is data update in the master device, the data update information is parsed to obtain the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device; Arranging the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device to obtain update data; The list operation interface in the remote dictionary service in the master device is called to write the updated data into a queue, and the updated data is sent to the remote dictionary service of the slave device through a communication channel, so that the master device and the slave device achieve data synchronization.

2. The method according to claim 1, characterized in that The data update information is configuration information; the update action includes a configuration action; the update content includes a configuration content; Accordingly, when there is data update in the master device, parsing the data update information to obtain the module identifier, update action and update content corresponding to the module targeted by the data update includes: Receive configuration information for business configuration from users through a command line console or a web page; The configuration information is parsed to determine the module identifier, configuration action, and configuration content corresponding to the module for which the user performs service configuration.

3. The method according to claim 1, characterized in that The update data includes table entry update data; the update action includes table entry processing action; the update content includes table entry processing content; Accordingly, when there is data update in the master device, parsing the data update information to obtain the module identifier, update action and update content corresponding to the module targeted by the data update includes: The table entry update information is determined by at least one of the following: Processing received messages to generate table entry update information; Regularly poll the stored entries to determine whether there are any aged entries that need to be deleted. If so, delete the aged entries and generate entry update information. Monitoring whether there is configuration information for processing the stored table entry, and if so, processing the table entry according to the configuration information and generating table entry update information; The entry update information is parsed to determine a module identifier, an entry processing action, and an entry processing content corresponding to the module targeted by the entry update.

4. The method according to claim 1, characterized in that: Calling the list operation interface in the remote dictionary service in the master device to write the update data into a queue, and sending the update data to the remote dictionary service of the slave device through a communication channel, including: Recording update data corresponding to at least one module identifier in a queue according to a preset queue capacity; The queue containing the updated data is sent to the remote dictionary service of the slave device through the communication channel.

5. The method according to claim 1, characterized in that The method is executed by a slave device, wherein the slave device and the master device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the method comprises: The remote dictionary service in the slave device monitors whether there is update data in the communication channel; wherein the update data is written into a queue by a list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain a module identifier, an update action, and an update content, and then sorting the data according to the list data format of the remote dictionary service; If it exists, calling the list operation interface in the remote dictionary service in the slave device to parse the update data, and determining the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device; Data synchronization is performed according to the module identifier, the update action, and the update content.

6. The method according to claim 5, characterized in that The update data includes configuration update data; the update action includes configuration action; the update content includes configuration content; Accordingly, data synchronization is performed according to the module identifier, the update action, and the update content, including: Sending the module identifier, the configuration action, and the configuration content from the configuration management plane of the slave device to the data plane; Determine a target configuration processing module corresponding to the configuration action; wherein the configuration action includes configuration addition, configuration deletion, configuration modification and configuration clearing; Based on the target configuration processing module, the configuration content in the module corresponding to the module identifier is processed.

7. The method according to claim 5, characterized in that The update data includes table entry update data; the update action includes table entry processing action; the update content includes table entry processing content; the table entry update information is synchronized from the data plane of the master device to the data plane of the slave device; Accordingly, data synchronization is performed according to the module identifier, the update action, and the update content, including: Determine a target entry processing module corresponding to the entry processing action; wherein the entry processing action includes entry addition, entry deletion, entry modification and entry clearing; Based on the target entry processing module, the entry processing content in the module corresponding to the module identifier is processed.

8. A data synchronization device, characterized in that: The master device and the slave device are configured with remote dictionary services respectively, and communicate via a heartbeat line; the device comprises: A data update information parsing module, used for parsing the data update information to obtain the module identification, update action and update content corresponding to the module targeted by the data update when there is data update in the master device; wherein the module is a functional module included in the device; An update data generation module, used for arranging the module identifier, update action and update content according to the list data format of the remote dictionary service in the master device to obtain update data; The update data synchronization module is used to call the list operation interface in the remote dictionary service in the master device to write the update data into the queue, and send the update data to the remote dictionary service of the slave device through the communication channel to synchronize the data between the master device and the slave device.

9. A data synchronization device, characterized in that: The device is configured in a slave device, wherein the slave device and the master device are respectively configured with a remote dictionary service and communicate via a heartbeat line; the device comprises: An update data monitoring module is used to monitor whether there is update data in the communication channel through the remote dictionary service in the slave device; wherein the update data is written into the queue by the list operation interface of the remote dictionary service in the master device and sent through the communication channel; the update data is obtained by parsing the data update information to obtain the module identification, update action and update content, and then sorting according to the list data format of the remote dictionary service; An update data parsing module, for, if present, calling the list operation interface in the remote dictionary service in the slave device to parse the update data, and determining the module identifier, update action and update content corresponding to the module targeted by the data update; wherein the module is a functional module included in the device; A data synchronization module is used to synchronize data according to the module identifier, the update action and the update content.

10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and A memory connected to the at least one processor for data processing; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data synchronization method executed by the master device as described in any one of claims 1-4, or the data synchronization method executed by the slave device as described in any one of claims 5-8.

Citation Information

Cited By

  • Data synchronization method and device and medium

    CN121334173A