Configuration data updating method and device

文档序号:7211 发布日期:2021-09-17 浏览:31次 中文

1. A method for updating configuration data, the method comprising:

detecting a first tag configuration table, wherein identification data corresponding to configuration data are stored in the first tag configuration table, the identification data are used for searching the configuration data from the first configuration data table, and the writing priority of the configuration data is higher than that of the identification data;

responding to the change of the identification data in the first tag configuration table, and determining target identification data in the first tag configuration table, wherein the target identification data is the changed identification data in the first tag configuration table;

obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data;

and updating the first equipment corresponding to the target configuration data by using the target configuration data.

2. The method of claim 1, further comprising:

synchronizing the identification data in the second tag configuration table to the first tag configuration table;

synchronizing configuration data in a second configuration data table into the first configuration data table, wherein the configuration data in the second configuration data table is written by a management device communicated with a second device, and after the management device writes the configuration data into the second configuration data table, identification data corresponding to the currently written configuration data in the second tag configuration table is updated;

the first tag configuration table and the first configuration data table are located in a first database of the first device, and the second tag configuration table and the second configuration data table are located in a second database of the second device.

3. The method of claim 2, wherein the updating process of the identification data in the second tag configuration table and the configuration data in the second configuration data table comprises:

the management equipment obtains configuration data to be updated;

the management equipment writes the configuration data to be updated into the second configuration data table so as to update the second configuration data table by using the configuration data to be updated;

after determining that the configuration data in the second configuration data table is updated, the management device obtains the identification data of the written configuration data, and updates the identification data in the second tag configuration table by using the obtained identification data;

the management equipment determines whether the obtained identification data is consistent with the identification data existing in the second tag configuration table or not, and if not, the step of returning to the management equipment to obtain the configuration data to be updated is carried out; and if the tag identification data are consistent, updating the identification data in the second tag configuration table.

4. The method of claim 1, wherein detecting the first tag configuration table comprises:

detecting a cache version in each piece of identification data in the first tag configuration table, responding to the change of the cache version in the identification data, and determining that the identification data in the first tag configuration table changes;

the identification data comprises cache tags and cache versions, the cache tags are used for indicating the purposes of the configuration data, the cache versions are used for indicating the versions of the configuration data, the cache versions in the identification data corresponding to the configuration data are changed when the configuration data are changed, and one cache tag corresponds to one cache version.

5. The method of claim 1, wherein detecting the first tag configuration table comprises: detecting a cache version in each piece of identification data in the first tag configuration table through a timing task;

the determining the target identification data in response to the change of the identification data in the first tag configuration table comprises: if the first tag configuration table is detected through the timing task for the first time, determining all identification data in the first tag configuration table as target identification data;

and if the ith time passes through the timing task to detect the first tag configuration table, determining the identification data with the changed cache version as target identification data, wherein i is a natural number greater than 1, and the time condition for detecting the first tag configuration table by the ith time through the timing task is that the start time for detecting the ith time by the timing task is greater than the end time for updating the first device by the (i-1) th time.

6. The method of claim 1, wherein the updating, by using the target configuration data, the first device corresponding to the target configuration data comprises:

determining a target task corresponding to a cache tag based on the cache tag in the target identification data corresponding to the target configuration data;

and updating the configuration data of the target task by using the target configuration data, so that the target configuration data is called when the target task is executed.

7. An apparatus for updating configuration data, the apparatus comprising:

the device comprises a detection unit, a first tag configuration table and a second tag configuration table, wherein the first tag configuration table stores identification data corresponding to configuration data, the identification data is used for searching the configuration data from the first configuration data table, and the writing priority of the configuration data is higher than that of the identification data;

a determining unit, configured to determine target identification data in the first tag configuration table in response to a change of identification data in the first tag configuration table, where the target identification data is identification data that has changed in the first tag configuration table;

an obtaining unit, configured to obtain, based on the target identification data, target configuration data that matches the target identification data from the first configuration data table;

and the updating unit is used for updating the first equipment corresponding to the target configuration data by using the target configuration data.

8. The apparatus according to claim 7, wherein the detecting unit is configured to detect a cached version in each piece of identification data in the first tag configuration table, and determine that the identification data in the first tag configuration table changes in response to a change in the cached version in the identification data;

the identification data comprises cache tags and cache versions, the cache tags are used for indicating the purposes of the configuration data, the cache versions are used for indicating the versions of the configuration data, the cache versions in the identification data corresponding to the configuration data are changed when the configuration data are changed, and one cache tag corresponds to one cache version;

or

The detection unit is used for detecting the cache version in each piece of identification data in the first tag configuration table through a timing task;

the determining unit is configured to determine, if the first tag configuration table is detected by the timing task for the first time, all identification data in the first tag configuration table as target identification data, and determine, if the first tag configuration table is detected by the timing task for the ith time, identification data with a changed cache version as target identification data, where i is a natural number greater than 1, and a time condition for detecting the first tag configuration table by the timing task for the ith time is that a start time of detecting by the timing task for the ith time is greater than an end time of updating the first device for the ith-1 time.

9. A first device, comprising:

a processor;

a memory for storing the processor-executable instructions;

wherein the processor is configured to execute the instructions to implement the configuration data update method of any one of claims 1 to 6.

10. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed, are capable of performing the configuration data update method of any of claims 1 to 6.

Background

At present, the master device and the slave device update configuration data in a manner that the master device and the slave device can acquire the configuration data for updating after receiving a message notification; the master device and the slave device update the configuration data based on the message notification, so that the configuration data is not updated timely due to potential risks such as the sequence of the messages and the network accessibility.

Disclosure of Invention

In view of the above, an object of the present application is to provide a method and an apparatus for updating configuration data.

In one aspect, the present application provides a method for updating configuration data, where the method includes:

detecting a first tag configuration table, wherein identification data corresponding to configuration data are stored in the first tag configuration table, the identification data are used for searching the configuration data from the first configuration data table, and the writing priority of the configuration data is higher than that of the identification data;

responding to the change of the identification data in the first tag configuration table, and determining target identification data in the first tag configuration table, wherein the target identification data is the changed identification data in the first tag configuration table;

obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data;

and updating the first equipment corresponding to the target configuration data by using the target configuration data.

Optionally, the method further includes:

synchronizing the identification data in the second tag configuration table to the first tag configuration table;

synchronizing configuration data in a second configuration data table into the first configuration data table, wherein the configuration data in the second configuration data table is written by a management device communicated with a second device, and after the management device writes the configuration data into the second configuration data table, identification data corresponding to the currently written configuration data in the second tag configuration table is updated;

the first tag configuration table and the first configuration data table are located in a first database of the first device, and the second tag configuration table and the second configuration data table are located in a second database of the second device.

Optionally, the updating process of the identification data in the second tag configuration table and the configuration data in the second configuration data table includes:

the management equipment obtains configuration data to be updated;

the management equipment writes the configuration data to be updated into the second configuration data table so as to update the second configuration data table by using the configuration data to be updated;

after determining that the configuration data in the second configuration data table is updated, the management device obtains the identification data of the written configuration data, and updates the identification data in the second tag configuration table by using the obtained identification data;

the management equipment determines whether the obtained identification data is consistent with the identification data existing in the second tag configuration table or not, and if not, the step of returning to the management equipment to obtain the configuration data to be updated is carried out; and if the tag identification data are consistent, updating the identification data in the second tag configuration table.

Optionally, the detecting the first tag configuration table includes:

detecting a cache version in each piece of identification data in the first tag configuration table, responding to the change of the cache version in the identification data, and determining that the identification data in the first tag configuration table changes;

the identification data comprises cache tags and cache versions, the cache tags are used for indicating the purposes of the configuration data, the cache versions are used for indicating the versions of the configuration data, the cache versions in the identification data corresponding to the configuration data are changed when the configuration data are changed, and one cache tag corresponds to one cache version.

Optionally, the detecting the first tag configuration table includes: detecting a cache version in each piece of identification data in the first tag configuration table through a timing task;

the determining the target identification data in response to the change of the identification data in the first tag configuration table comprises: if the first tag configuration table is detected through the timing task for the first time, determining all identification data in the first tag configuration table as target identification data;

and if the ith time passes through the timing task to detect the first tag configuration table, determining the identification data with the changed cache version as target identification data, wherein i is a natural number greater than 1, and the time condition for detecting the first tag configuration table by the ith time through the timing task is that the start time for detecting the ith time by the timing task is greater than the end time for updating the first device by the (i-1) th time.

Optionally, the updating, by using the target configuration data, the first device corresponding to the target configuration data includes:

determining a target task corresponding to a cache tag based on the cache tag in the target identification data corresponding to the target configuration data;

and updating the configuration data of the target task by using the target configuration data, so that the target configuration data is called when the target task is executed.

In another aspect, the present application provides a configuration data updating apparatus, including:

the device comprises a detection unit, a first tag configuration table and a second tag configuration table, wherein the first tag configuration table stores identification data corresponding to configuration data, the identification data is used for searching the configuration data from the first configuration data table, and the writing priority of the configuration data is higher than that of the identification data;

a determining unit, configured to determine target identification data in the first tag configuration table in response to a change of identification data in the first tag configuration table, where the target identification data is identification data that has changed in the first tag configuration table;

an obtaining unit, configured to obtain, based on the target identification data, target configuration data that matches the target identification data from the first configuration data table;

and the updating unit is used for updating the first equipment corresponding to the target configuration data by using the target configuration data.

Optionally, the apparatus further comprises: the synchronization unit is used for synchronizing the identification data in the second label configuration table to the first label configuration table; synchronizing configuration data in a second configuration data table into the first configuration data table, wherein the configuration data in the second configuration data table is written by a management device communicated with a second device, and after the management device writes the configuration data into the second configuration data table, identification data corresponding to the currently written configuration data in the second tag configuration table is updated;

the first tag configuration table and the first configuration data table are located in a first database of the first device, and the second tag configuration table and the second configuration data table are located in a second database of the second device.

Optionally, the detecting unit is configured to detect a cache version in each piece of identification data in the first tag configuration table, respond to a change in the cache version in the identification data, and determine that the identification data in the first tag configuration table changes;

the identification data comprises cache tags and cache versions, the cache tags are used for indicating the purposes of the configuration data, the cache versions are used for indicating the versions of the configuration data, the cache versions in the identification data corresponding to the configuration data are changed when the configuration data are changed, and one cache tag corresponds to one cache version;

or

The detection unit is used for detecting the cache version in each piece of identification data in the first tag configuration table through a timing task;

the determining unit is configured to determine, if the first tag configuration table is detected by the timing task for the first time, all identification data in the first tag configuration table as target identification data, and determine, if the first tag configuration table is detected by the timing task for the ith time, identification data with a changed cache version as target identification data, where i is a natural number greater than 1, and a time condition for detecting the first tag configuration table by the timing task for the ith time is that a start time of detecting by the timing task for the ith time is greater than an end time of updating the first device for the ith-1 time.

Optionally, the updating unit is configured to determine, based on a cache tag in target identification data corresponding to the target configuration data, a target task corresponding to the cache tag; and updating the configuration data of the target task by using the target configuration data, so that the target configuration data is called when the target task is executed.

In yet another aspect, the present application provides a first device comprising:

a processor;

a memory for storing the processor-executable instructions;

wherein the processor is configured to execute the instructions to implement the above configuration data updating method.

In yet another aspect, the present application provides a computer-readable storage medium, wherein instructions of the computer-readable storage medium can execute the above configuration data updating method when executed.

The configuration data updating method and device detect a first tag configuration table, wherein identification data corresponding to the configuration data is stored in the first tag configuration table, and the identification data is used for searching the configuration data from the first configuration data table; the method comprises the steps of responding to the change of identification data in a first tag configuration table, determining target identification data in the first tag configuration table, wherein the target identification data are identification data changed in the first tag configuration table, obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data, and updating first equipment corresponding to the target configuration data by using the target configuration data, so that the first equipment can determine the target configuration data needing to be updated by using the target identification data when the identification data in the first tag configuration table are changed, the timeliness of updating the configuration data is improved, and the first equipment can detect when a plurality of identification data in the first tag configuration table are changed, so that the plurality of target configuration data are updated simultaneously. The writing priority of the configuration data is higher than that of the identification data, and the configuration data is already written into the first configuration data table when the identification data changes, so that the integrity of the target configuration data is ensured, and the updating accuracy is improved.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

Fig. 1 is a flowchart of a configuration data updating method provided in an embodiment of the present application;

FIG. 2 is a schematic diagram of detection and update provided by embodiments of the present application;

FIG. 3 is a flow chart of another configuration data updating method provided by the embodiment of the present application;

fig. 4 is a schematic diagram of an application scenario corresponding to a configuration data updating method provided in an embodiment of the present application;

fig. 5 is a schematic diagram of another application scenario corresponding to the configuration data updating method provided in the embodiment of the present application;

fig. 6 is a schematic structural diagram of a configuration data updating apparatus according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, an optional flow of a configuration data updating method provided in an embodiment of the present application is shown, which may include the following steps:

101: and detecting a first tag configuration table, wherein identification data corresponding to the configuration data is stored in the first tag configuration table, and the writing priority of the configuration data is higher than that of the identification data. The writing priority indicates the writing sequence of the data, the writing priority of the configuration data is higher than that of the identification data, and the configuration data is written before the identification data, for example, the configuration data is written into the first configuration data table, and the identification data is written into the first tag configuration table after the configuration data is written.

The writing priority of the configuration data is higher than that of the identification data because the identification data changes when the configuration data changes, whether the configuration data changes is determined by detecting the identification data, and the configuration data needs to be written when the identification data changes, so that the integrity of the read configuration data is ensured, and the writing priority of the configuration data is higher than that of the identification data.

In this embodiment, for any configuration data, one piece of identification data of the configuration data may be stored in the first tag configuration table, and when the configuration data changes, the identification data corresponding to the configuration data in the first tag configuration table is updated in a manner of generating new identification data corresponding to the configuration data and replacing the existing identification data corresponding to the configuration data in the first tag configuration table. For example, a piece of configuration data is used to control the content loaded at startup, the identification data corresponding to the piece of configuration data in the first tag configuration table is identification data 1, and if the piece of configuration data changes, identification data 2 is generated, and identification data 2 is replaced with identification data 1. Through the updating mode of the identification data, for the configuration data of one function, only one piece of identification data of the configuration data is stored in the first tag configuration table, so that the data quantity in the first tag configuration table is small, the retrieval efficiency is improved, and the changed identification data in the first tag configuration table is determined as soon as possible.

Wherein the identification data may include: the cache tag is used for indicating the purpose of the configuration data, the cache version is used for indicating the version of the configuration data, the cache version in the identification data corresponding to the configuration data changes when the configuration data changes, and one cache tag corresponds to one cache version. That is to say, for any configuration data, the cache tag in the identification data corresponding to the configuration data is fixed, so that the purpose of the configuration data is indicated by the cache tag and the cache tag does not change with the change of the configuration data, and what changes with the configuration data in the identification data is the cache version, so that the change of the configuration data is indicated by the cache version, and thus the data amount in the first tag configuration table can be reduced. The corresponding detection first tag configuration table comprises: and detecting the cache version in each piece of identification data in the first tag configuration table, responding to the change of the cache version in the identification data, and determining that the identification data in the first tag configuration table changes. In addition to cache tags and cache versions, the identification data may include: and the cache updating time is used for indicating the time of updating the cache version in the first tag configuration table so as to determine when the cache version changes according to the cache updating time.

The first tag configuration table may be located in a database, and a data table is added to an existing database, where the data table includes a cache tag, a cache version, and cache update time, so as to obtain the first tag configuration table. When the configuration data changes, the cache version in the first tag configuration table changes, for example, an array is added on the basis of the previous version to obtain the current cache version, and for example, one is added on the basis of the previous version, the cache updating time can be written by the storage device to which the database belongs according to the current time, so that the updating of the identification data is judged according to the latest time of the storage device. Updating the cache version needs to be performed after the configuration data is updated, the writing priority of the configuration data is higher than that of the identification data, and otherwise, a message of updating failure can be fed back.

When the first tag configuration table is detected, the cache version in each identification datum in the first tag configuration table can be detected through the timing task, and the timing task can detect the first tag configuration table at a preset frequency, for example, the timing task detects the first tag configuration table at a preset frequency of ms (millisecond), so that the detection efficiency of the timing task is improved.

102: and responding to the change of the identification data in the first tag configuration table, determining target identification data in the first tag configuration table, wherein the target identification data is the changed identification data in the first tag configuration table, the configuration data corresponding to the target identification data is changed, and after the target identification data is determined, the target identification data is used for pointing to the configuration data needing to be updated in the first equipment.

In this embodiment, in response to the change of the identification data in the first tag configuration table, one way to determine the target identification data is as follows: if the first tag configuration table is detected through the timing task for the first time, determining all identification data in the first tag configuration table as target identification data; and if the ith time passes through the timing task to detect the first tag configuration table, determining the detected identification data with the changed cache version as target identification data, wherein i is a natural number greater than 1, and the time condition for detecting the first tag configuration table by the ith time passes through the timing task is that the starting time for detecting the ith time by the timing task is greater than the ending time for updating the first equipment by the (i-1) th time.

The first detection of the first tag configuration table by the timing task may be a first detection of the first tag configuration table by the first device after the timing task is enabled, and the first device is a device that needs to update the configuration data. If the first device is a server in the server cluster, the server can use the timing task to detect the first tag configuration table for multiple times after the timing task is started, so as to determine the changed identification data in the first tag configuration table.

When the timing task detects the first tag configuration table, the cache tag in the first tag configuration table can be used as an index to detect the cache version pointed by the index, and because the index exists in the first tag configuration table and the data size of the first tag configuration table is small, even if the timing task detects at the ms-level frequency, no pressure is generated on the storage entity, and the storage entity is a device for storing the first tag configuration table. And a cache tag is added when the first tag configuration table stores the identification data, even if the first tag configuration table and the first configuration data table are not in a storage instance due to bank division and table division, only one thread is needed to start timing task processing, and the first configuration data table is used for storing the configuration data.

103: and obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data. The configuration data and the identification data have a corresponding relationship, and target configuration data matched with the target identification data can be obtained from the first configuration data table based on the corresponding relationship between the configuration data and the identification data.

The configuration data in the first configuration data table may use cache tags as indexes, and one cache tag may correspond to at least one piece of configuration data, for example, when the configuration data changes, the first configuration data table may add new configuration data on the basis of keeping the existing configuration data, or replace the existing configuration data with the new configuration data, and the embodiment of the update method of the configuration data is not limited.

104: and updating the first equipment corresponding to the target configuration data by using the target configuration data. The updating of the first device corresponding to the target configuration data is to write the target configuration data into the first device, so that the first device can call the target configuration data, and the updating method includes, but is not limited to:

at least one of updating the target configuration data in full, updating the configuration data in time increments, and deleting the cache tag to wait for the next request to rebuild the cache configuration data. The step of updating the target configuration data in full refers to that the target configuration data corresponding to the target identification data in the first configuration data table is all written into the first device, for example, one target identification data corresponds to 10 pieces of configuration data, and the 10 pieces of configuration data have the same function, and the step of updating the target configuration data in full indicates that the 10 pieces of configuration data are written into the first device.

Updating the configuration data according to the time increment is to write the configuration data corresponding to the target identification data newly added in the first configuration data table into the first device. Still correspond 10 configuration data with above-mentioned a target identification data, 10 configuration data possess the same function and 5 configuration data are newly increased, update configuration data according to the time increment will instruct to write 5 newly increased configuration data into first equipment.

Deleting the cache tag to wait for the next request for reconstructing the cache configuration data means that the cache tag and the configuration data corresponding to the target configuration data are deleted firstly after the target configuration data are obtained, and the target configuration data are written in after a request for calling the configuration data is received.

In this embodiment, updating the first device corresponding to the target configuration data may be performed by a target task, for example, determining a target task corresponding to a cache tag based on the cache tag in the target identification data corresponding to the target configuration data; and updating the configuration data of the target task by using the target configuration data, so that the target configuration data is called when the target task is executed, and the mode can be adopted when the configuration data of the target task is updated. The target task is a service in the first device, such as a boot task, and when the configuration data is updated by the target task, the update implementation class of the cache configuration data can be called, and no dependency is provided on whether the cache is persistent or not, whether the cache uses a memory cache or other third-party components or not. As shown in fig. 2, the detection and update process is performed by an application program in the first device detecting the first tag configuration table through a timing task, and determining the target identification data in the first tag configuration table. And the application program determines a target task corresponding to the cache tag based on the cache tag in the target identification data, and the target task acquires target configuration data from the first configuration data table for updating.

The configuration data updating method includes detecting a first tag configuration table, where identification data corresponding to configuration data is stored in the first tag configuration table, and the identification data is used to search the configuration data from the first configuration data table; the method comprises the steps of responding to the change of identification data in a first tag configuration table, determining target identification data in the first tag configuration table, wherein the target identification data are identification data changed in the first tag configuration table, obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data, and updating first equipment corresponding to the target configuration data by using the target configuration data, so that the first equipment can determine the target configuration data needing to be updated by using the target identification data when the identification data in the first tag configuration table are changed, the timeliness of updating the configuration data is improved, and the first equipment can detect when a plurality of identification data in the first tag configuration table are changed, so that the plurality of target configuration data are updated simultaneously. The writing priority of the configuration data is higher than that of the identification data, and the configuration data is already written into the first configuration data table when the identification data changes, so that the integrity of the target configuration data is ensured, and the updating accuracy is improved.

In the related art, the master device and the slave device may trigger the update of the configuration data through a timing task or update the configuration data in a cross-network shared cache manner, in addition to performing the update of the configuration data based on the message notification. The timing task is used for scanning the configuration data in the database at regular time to determine whether the configuration data in the database is updated or not, and if the configuration data in the database is updated, the configuration data is obtained from the database for updating; scanning the configuration data in the database through the timing task can increase scanning time due to the increase of the number of the configuration data in the database, and further the configuration data is not updated timely. In the configuration data updating method provided in this embodiment, the identification data in the first tag configuration table is detected, the changed identification data, such as the target identification data, in the first tag configuration table is determined, so as to determine the target configuration data based on the target identification data, and the target configuration data is used for updating, where the data amount of the identification data in the first tag configuration table is much smaller than the data amount of the configuration data in the database, and compared with the updating performed by scanning the configuration data through the timing task, the data amount of the scanning is reduced, and the timeliness of the updating is improved.

The master device and the slave device update configuration data in a cross-network shared cache mode, and a phenomenon of single-device service occurs when a network between the master device and the slave device is abnormal. An implementation subject (e.g., a first device) of the configuration data updating method provided in this embodiment may update the configuration data by using the associated first tag configuration table and the first configuration data table, and a cache way is not required to be shared across networks, so that a phenomenon that a single device serves when an abnormality occurs in a network is solved.

Referring to fig. 3, an alternative flow of another configuration data updating method provided in the embodiment of the present application is shown, which may include the following steps:

201: and synchronizing the identification data in the second label configuration table to the first label configuration table.

202: and synchronizing the configuration data in the second configuration data table into the first configuration data table, writing the configuration data in the second configuration data table into a management device communicated with the second device, and updating the identification data corresponding to the currently written configuration data in the second tag configuration table after the management device writes the configuration data into the second configuration data table.

After the management equipment finishes writing in of the identification data and the configuration data, the second equipment and the first equipment finish data synchronization between the first database and the second database in a master-slave synchronization mode, and the cost for maintaining inconsistency of the configuration data and the identification data in each equipment is reduced.

For example, the second device and the first device are two clusters in a master-slave cluster, the second device may be a master cluster, and the first device is a slave cluster in a plurality of slave clusters, and the architecture is shown in fig. 4. The management device is communicated with the main cluster, the management device writes the configuration data into a second configuration data table of a second database of the main cluster, and along with the completion of the writing of the configuration data, the identification data corresponding to the configuration data in a second tag configuration table of the second database is updated so as to point to the configuration data through the updated tag data. And the slave cluster and the master cluster complete data synchronization between the databases in the two clusters in a master-slave synchronization mode, so that the configuration data and the identification data in the second database of the master cluster are synchronized to the first database of the slave cluster.

In addition to being applied to one master multi-slave cluster, the present invention can also be applied to multiple master clusters, for example, as shown in fig. 5, when any one of the three master clusters is a master cluster, the remaining two clusters are slave clusters, the management device can write configuration data into each master cluster, and as the configuration data is written, the identification data corresponding to the configuration data in the master cluster is updated. After the management equipment completes writing of the configuration data and the identification data in any master cluster, the master cluster and the slave cluster complete data synchronization in a master-slave synchronization mode, and therefore the configuration data and the identification data in the second database of the master cluster are synchronized into the first database of the slave cluster.

The updating process of the management device to the configuration data and the identification data is as follows: the management equipment obtains configuration data to be updated; writing the configuration data to be updated into the second configuration data table so as to update the second configuration data table by using the configuration data to be updated; after determining that the configuration data in the second configuration data table is updated, obtaining identification data of the written configuration data, and updating the identification data in the second tag configuration table by using the obtained identification data; determining whether the obtained identification data is consistent with the existing identification data in the second configuration data table, and if not, returning to the step of obtaining the configuration data to be updated by the management equipment; and if the tag identification data are consistent, updating the identification data in the second tag configuration table.

The configuration data is updated before the identification data is updated to satisfy that the write priority of the configuration data is higher than the write priority of the identification data; if the obtained identification data is inconsistent with the identification data already in the second configuration data table, it indicates that the management device may write a history of configuration data, and the management device needs to obtain the configuration data to be updated again to ensure that the latest configuration data is written.

203: and detecting a first tag configuration table, wherein identification data corresponding to the configuration data is stored in the first tag configuration table, and the writing priority of the configuration data is higher than that of the identification data. The writing priority indicates the writing sequence of the data, the writing priority of the configuration data is higher than that of the identification data, and the configuration data is written before the identification data, for example, the configuration data is written into the first configuration data table, and the identification data is written into the first tag configuration table after the configuration data is written.

The first tag configuration table may be detected through a timing task, for example, for the clusters shown in fig. 4 and 5, updating of the configuration data is triggered through the timing task, so that each cluster can update the latest configuration data in real time, thereby improving timeliness of updating.

204: and responding to the change of the identification data in the first tag configuration table, and determining target identification data in the first tag configuration table, wherein the target identification data is the changed identification data in the first tag configuration table.

205: and obtaining target configuration data matched with the target identification data from the first configuration data table based on the target identification data.

206: and updating the first equipment corresponding to the target configuration data by using the target configuration data.

For the description of steps 203 to 206, refer to steps 101 to 104, which are not described in detail herein.

The configuration data updating method synchronizes the identification data in the second tag configuration table to the first tag configuration table; and synchronizing the configuration data in the second configuration data table into the first configuration data table, writing the configuration data in the second configuration data table into a management device communicated with the second device, and updating the identification data corresponding to the currently written configuration data in the second tag configuration table after the management device writes the configuration data into the second configuration data table. After the management equipment finishes writing in of the identification data and the configuration data, the second equipment and the first equipment finish data synchronization between the first database and the second database in a master-slave synchronization mode, and the cost for maintaining inconsistency of the configuration data and the identification data in each equipment is reduced.

While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present application is not limited by the order of acts or acts described, as some steps may occur in other orders or concurrently with other steps in accordance with the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.

Corresponding to the foregoing method embodiment, an embodiment of the present application further provides a configuration data updating apparatus, and an optional structure of the apparatus is shown in fig. 6, where the configuration data updating apparatus may include: a detection unit 10, a determination unit 20, an obtaining unit 30 and an updating unit 40.

The detecting unit 10 is configured to detect a first tag configuration table, where identification data corresponding to the configuration data is stored in the first tag configuration table, the identification data is used to search the configuration data from the first configuration data table, and a write priority of the configuration data is higher than a write priority of the identification data.

For example, the detecting unit 10 is configured to detect a cache version in each piece of identification data in the first tag configuration table, and determine that the identification data in the first tag configuration table changes in response to a change in the cache version in the identification data. The identification data comprises cache tags and cache versions, the cache tags are used for indicating the purposes of the configuration data, the cache versions are used for indicating the versions of the configuration data, the cache versions in the identification data corresponding to the configuration data are changed when the configuration data are changed, and one cache tag corresponds to one cache version.

For another example, the detecting unit 10 is configured to detect, by a timing task, a cached version in each piece of identification data in the first tag configuration table.

The determining unit 20 is configured to determine target identification data in the first tag configuration table in response to a change of the identification data in the first tag configuration table, where the target identification data is identification data that has changed in the first tag configuration table, and the configuration data corresponding to the target identification data changes, and after the target identification data is determined, the configuration data that needs to be updated in the first device is pointed by the target identification data.

The determining unit 20 is configured to determine, if the first tag configuration table is detected by the timing task for the first time, all the identification data in the first tag configuration table as target identification data, and determine, if the first tag configuration table is detected by the timing task for the ith time, the identification data with the detected cache version changed as the target identification data, where i is a natural number greater than 1, and a time condition for detecting the first tag configuration table by the timing task for the ith time is that a start time for detecting by the timing task for the ith time is greater than an end time for updating the first device for the (i-1) th time.

An obtaining unit 30, configured to obtain target configuration data matching the target identification data from the first configuration data table based on the target identification data. The configuration data and the identification data have a corresponding relationship, and target configuration data matched with the target identification data can be obtained from the first configuration data table based on the corresponding relationship between the configuration data and the identification data.

The configuration data in the first configuration data table may use cache tags as indexes, and one cache tag may correspond to at least one piece of configuration data, for example, when the configuration data changes, the first configuration data table may add new configuration data on the basis of keeping the existing configuration data, or replace the existing configuration data with the new configuration data, and the embodiment of the update method of the configuration data is not limited.

And the updating unit 40 is configured to update the first device corresponding to the target configuration data by using the target configuration data. The updating of the first device corresponding to the target configuration data is to write the target configuration data into the first device, so that the first device can call the target configuration data, and the updating method includes, but is not limited to: at least one of updating the target configuration data in full, updating the configuration data in time increment and deleting the cache tag to wait for the next request for rebuilding the cache configuration data, which is described in detail with reference to the above embodiment.

In this embodiment, the updating unit 40 is configured to determine, based on a cache tag in target identification data corresponding to target configuration data, a target task corresponding to the cache tag; and updating the configuration data of the target task by using the target configuration data, so that the target configuration data is called when the target task is executed.

The configuration data updating apparatus may further include: the synchronization unit is used for synchronizing the identification data in the second label configuration table to the first label configuration table; and synchronizing the configuration data in the second configuration data table into the first configuration data table, writing the configuration data in the second configuration data table into a management device communicated with the second device, and updating the identification data corresponding to the currently written configuration data in the second tag configuration table after the management device writes the configuration data into the second configuration data table. The first tag configuration table and the first configuration data table are located in a first database of the first device, and the second tag configuration table and the second configuration data table are located in a second database of the second device.

The updating process of the management device to the configuration data and the identification data is as follows: the management equipment obtains configuration data to be updated; writing the configuration data to be updated into the second configuration data table so as to update the second configuration data table by using the configuration data to be updated; after determining that the configuration data in the second configuration data table is updated, obtaining identification data of the written configuration data, and updating the identification data in the second tag configuration table by using the obtained identification data; determining whether the obtained identification data is consistent with the existing identification data in the second configuration data table, and if not, returning to the step of obtaining the configuration data to be updated by the management equipment; and if the tag identification data are consistent, updating the identification data in the second tag configuration table.

The configuration data is updated before the identification data is updated to satisfy that the write priority of the configuration data is higher than the write priority of the identification data; if the obtained identification data is inconsistent with the identification data already in the second configuration data table, it indicates that the management device may write a history of configuration data, and the management device needs to obtain the configuration data to be updated again to ensure that the latest configuration data is written.

An embodiment of the present application further provides a first device, including: a processor and a memory for storing processor-executable instructions. Wherein the processor is configured to execute the instructions to implement the above-described configuration data updating method.

The embodiment of the present application further provides a computer-readable storage medium, and the instructions in the computer-readable storage medium can execute the above configuration data updating method when executed.

It should be noted that, various embodiments in this specification may be described in a progressive manner, and features described in various embodiments in this specification may be replaced with or combined with each other, each embodiment focuses on differences from other embodiments, and similar parts between various embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:非接触式读写方法、装置、打印机及计算机可读存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!