Configuration information updating method and device applied to main and standby clusters, equipment and medium
By generating configuration information acquisition instances in the primary and backup clusters, acquiring target locks, and utilizing a distributed configuration server to obtain and synchronize configuration information from the off-site disaster recovery cluster, the problem of configuration information loss under containerized deployment is solved, enabling timely updates and backups of configuration information, and improving the disaster recovery capability of the cluster and the business continuity of services.
Patent Information
- Application Number
- CN202511136083.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-10-31
AI Technical Summary
In containerized deployment scenarios, when using local file copies to store configuration information, the configuration information may be lost after the application restarts, leading to service anomalies and increased maintenance complexity.
By generating configuration information in the primary and backup clusters to obtain instances and target locks, the distributed configuration server is used to obtain the configuration list information of the remote disaster recovery cluster and synchronize it to the remote disaster recovery cluster, ensuring timely updates and backups of configuration information.
It enables timely updates and backups of configuration information, improves the cluster's disaster recovery capabilities, and ensures service continuity.
Smart Images

Figure CN120880905A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, device, and medium for updating configuration information in a primary / standby cluster. Background Technology
[0002] In modern computer application systems, the configuration management of technical parameters is a crucial and complex aspect. With the rapid development of application services and the increasing complexity of system architectures, the configuration information involved in various application systems is growing exponentially. To ensure the stability and flexibility of system operation, configuration information is stored and processed using a configuration server and local copies. The local copy serves as an emergency escape mechanism when the configuration server is unavailable, ensuring that applications can continue to run, at least maintaining a basic level of service, until the configuration center service is restored.
[0003] Currently, existing technologies primarily rely on local file copies for storing configuration information. However, solutions based on local file copies have limitations in cloud-native environments, especially in containerized deployments. In cloud-native environments, applications typically run in containers. When an application container restarts, the container's file system is rebuilt, potentially resulting in the loss of local file copies of configuration information. This can lead to the application being unable to recover to its previous state after a restart, thus losing the ability to separate configuration from other components. In other words, in a containerized environment, using local file copies for processing can result in configuration information loss, leading to service anomalies, functional limitations, and increased maintenance complexity. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and medium for updating configuration information in a primary-standby cluster, which enables timely updating and backup of configuration information, significantly improves the disaster recovery capability of the cluster, and ensures the business continuity of the corresponding services.
[0005] According to one aspect of the present invention, a method for updating configuration information applied to a primary-standby cluster is provided, the method comprising:
[0006] When the application meets the conditions for obtaining configuration information, a configuration information obtaining instance is generated; the application includes at least one primary cluster and a disaster recovery cluster in a different location.
[0007] When determining that the cluster to which the configuration information acquisition instance belongs is the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that acquired the target lock is determined; wherein, the target lock is an application lock that matches the business execution logic of the configuration information acquisition instance;
[0008] The target logical unit of the main cluster sends a configuration information retrieval request corresponding to the configuration information retrieval instance to the distributed configuration server, and receives the configuration list information corresponding to the remote disaster recovery cluster returned by the distributed configuration server.
[0009] The configuration list information obtained by the primary cluster is synchronized to the off-site disaster recovery cluster so that the configuration information of the off-site disaster recovery cluster can be updated based on the configuration list information.
[0010] According to another aspect of the present invention, a configuration information updating device for a primary / standby cluster is provided, the device comprising:
[0011] The instance generation module is used to generate a configuration information retrieval instance when the application meets the configuration information retrieval conditions; wherein the application includes at least one primary cluster and a remote disaster recovery cluster;
[0012] The target logical unit determination module is used to acquire a target lock based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs when it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, and to determine the target logical unit that has acquired the target lock; wherein, the target lock is an application lock that matches the business execution logic of the configuration information acquisition instance;
[0013] The configuration list information determination module is used to send a configuration information retrieval request corresponding to the configuration information retrieval instance to the distributed configuration server based on the target logical unit of the main cluster, and to receive the configuration list information corresponding to the remote disaster recovery cluster returned by the distributed configuration server.
[0014] The configuration information update module is used to synchronize the configuration list information obtained by the primary cluster to the off-site disaster recovery cluster, so as to update the configuration information of the off-site disaster recovery cluster based on the configuration list information.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] At least one processor; and
[0017] A memory that is communicatively connected to at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to execute the configuration information update method for a primary / standby cluster according to any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement a configuration information update method for a primary / standby cluster according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, characterized in that, when executed by a processor, the computer program implements a configuration information update method for a primary / standby cluster as described in any embodiment of the present invention.
[0021] The technical solution of this invention generates a configuration information acquisition instance when the application meets the configuration information acquisition conditions, and then acquires the corresponding configuration information based on the configuration information acquisition instance. When the cluster to which the configuration information acquisition instance belongs is determined to be the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that acquired the target lock is determined. Based on this, it can be ensured that only one logical unit obtains configuration information within the same query cycle, avoiding the problem of repeated acquisition or writing of configuration information. A configuration information acquisition request corresponding to the configuration information acquisition instance is sent to the distributed configuration server according to the target logical unit of the main cluster, so that the distributed configuration server returns configuration list information corresponding to the remote disaster recovery cluster. The configuration list information obtained by the main cluster is synchronized to the remote disaster recovery cluster, so that the configuration information of the remote disaster recovery cluster is updated based on the configuration list information. This invention establishes a new disaster recovery cluster configuration information acquisition link, ensuring that the application can independently and securely obtain the configuration information of the disaster recovery cluster. This allows the application to acquire and synchronize the configuration information of the disaster recovery cluster without relying on the original business logic. It solves the problem of configuration information loss caused by processing with local file copies in the prior art. By acquiring the configuration information of the disaster recovery cluster from the primary cluster and synchronizing it to the disaster recovery cluster, timely updates and backups of the configuration information are achieved, significantly improving the disaster recovery capability of the cluster and ensuring the business continuity of the corresponding services.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a configuration information update method for a primary / standby cluster provided in an embodiment of the present invention;
[0025] Figure 2This is a flowchart of a configuration information update method for a primary / standby cluster provided in an embodiment of the present invention;
[0026] Figure 3 This is a flowchart illustrating the process of obtaining configuration information corresponding to the remote disaster recovery cluster in the distributed configuration server through the main cluster, as provided in this embodiment of the invention.
[0027] Figure 4 This is a structural example diagram of a configuration information acquisition and synchronization system applied to a primary / standby cluster, provided by an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of a configuration information update device applied to a primary / standby cluster provided in an embodiment of the present invention;
[0029] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the configuration information update method for a primary / standby cluster according to an embodiment of the present invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] Example 1
[0033] Figure 1This is a flowchart of a configuration information update method for a primary / standby cluster provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where the configuration information of the primary cluster is obtained from the disaster recovery cluster and synchronized to the disaster recovery cluster to ensure the availability of configuration information in emergency switchover scenarios. This method can be executed by a configuration information update device for the primary / standby cluster, which can be implemented in hardware and / or software. This configuration information update device can be configured in electronic devices such as mobile phones, computers, or servers. Figure 1 As shown, the method includes:
[0034] S110. When the application meets the conditions for obtaining configuration information, generate a configuration information obtaining instance; wherein the application includes at least one primary cluster and a remote disaster recovery cluster.
[0035] In this context, the application end can be understood as a terminal program or service system that directly interacts with the user. The application end can include one or more application service clusters. Based on the function corresponding to the application service cluster, it is determined whether the application service cluster is a primary cluster or a remote disaster recovery cluster. The primary cluster and the remote disaster recovery cluster constitute a high-availability architecture in a distributed system, ensuring service continuity through data redundancy and failover mechanisms. The primary cluster undertakes the main services, handles all business requests, and is in an active state. The remote disaster recovery cluster takes over the service when the primary cluster fails and is typically in a standby state. Optionally, this embodiment of the invention can be applied to a "dual-active + remote hot standby" two-site three-center high-availability architecture, meaning the application end can include two primary clusters in the same region and a remote disaster recovery cluster.
[0036] The conditions for obtaining configuration information can be pre-set; these are the conditions that must be met to obtain the configuration information of the disaster recovery cluster. A configuration information acquisition instance can be understood as an instance that dynamically or statically obtains configuration information. Configuration information can include configuration parameters from multiple dimensions, such as basic system configuration parameters, application configuration parameters related to applications, and configuration parameters for business rules.
[0037] Specifically, the system checks whether the application meets the conditions for obtaining configuration information. When it is determined that the application meets the conditions for obtaining configuration information, a configuration information obtaining instance is generated to obtain the corresponding configuration information based on the configuration information obtaining instance.
[0038] S120. When it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, the target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that has acquired the target lock is determined.
[0039] The target lock is an application lock that matches the business execution logic of the configuration information acquisition instance. By setting a target lock, the target logical unit that acquires the target lock executes the business execution logic corresponding to the configuration information acquisition instance, which can avoid the problem of duplicate data retrieval that may occur when the cluster includes multiple logical units (pods). A logical unit is a pod in the cluster. In a cluster, a pod is the core logical unit, representing a set of tightly cooperating containers, and is the basic unit for resource scheduling, network communication, and lifecycle management. Each pod can contain one or more containers (usually one main container + several auxiliary containers, such as log collection, proxies, etc.). Optionally, each cluster can include at least one cluster.
[0040] Specifically, the database status of the cluster to which the configuration information acquisition instance belongs is monitored in real time to determine whether the cluster to which the configuration information acquisition instance belongs is the primary cluster. When the cluster to which the configuration information acquisition instance belongs is determined to be the primary cluster, a target lock is requested based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs. The logical unit that acquires the target lock is then used as the target logical unit to process the business execution logic corresponding to the configuration information acquisition instance.
[0041] For example, a real-time database status detection mechanism is employed to accurately determine the primary / standby role of the cluster to which the configuration information acquisition instance belongs by dynamically identifying the database's operating status. When the cluster to which the configuration information acquisition instance belongs is determined to be the primary cluster, the logical unit corresponding to the primary cluster automatically executes the business logic corresponding to the configuration information acquisition instance and intelligently switches business processing flows. Based on this, seamless switching between different configuration information acquisition instances using the same codebase can be achieved, effectively solving the management challenge of code version consistency between instances, significantly improving the availability and reliability of the corresponding cluster, and reducing maintenance costs.
[0042] Furthermore, for configuration information retrieval instances running on the main cluster, to address the issue of duplicate configuration information retrieval by at least one logical unit within the cluster, a target lock can be set to ensure that only one logical unit can perform read / write operations on configuration information within the same query cycle. That is, when the cluster to which the configuration information retrieval instance belongs is determined to be the main cluster, at least one logical unit in the main cluster will request a target lock. If one logical unit acquires the target lock, it becomes the target logical unit and executes the business logic corresponding to the configuration information retrieval implementation. Other logical units attempting to process the same logic will be blocked, and their corresponding business logic will terminate. By setting a target lock, the simultaneous reading or writing of the same configuration information by at least one logical unit can be effectively prevented, thus preventing duplicate configuration information retrieval or writing.
[0043] In this embodiment of the invention, the method for determining the cluster to which the configuration information acquisition instance belongs as the main cluster may be: detecting the database status of the cluster to which the configuration information acquisition instance belongs, and determining the cluster to which the configuration information acquisition instance belongs as the main cluster when the database status is detected to be a writable data status.
[0044] It's important to note that the database states of the primary cluster and the off-site disaster recovery cluster differ. The primary cluster can perform write operations on its database; that is, its database state is writable. The off-site disaster recovery cluster cannot independently perform data writes; that is, its database state is not writable.
[0045] Specifically, the database status of the cluster to which the configuration information acquisition instance belongs is detected. When the database status of the cluster to which the configuration information acquisition instance belongs is writable, the cluster to which the configuration information acquisition instance belongs is determined to be the main cluster.
[0046] S130. The target logical unit based on the main cluster sends a configuration information retrieval request corresponding to the configuration information retrieval instance to the distributed configuration server, and receives the configuration list information corresponding to the remote disaster recovery cluster returned by the distributed configuration server.
[0047] The configuration information retrieval request can be a request sent to the distributed configuration server to obtain configuration information for a remote disaster recovery cluster. The distributed configuration server can provide centralized management and real-time push services for application configuration parameters and other configuration information. The application hosts its configuration information on the distributed configuration server. When the distributed configuration server receives a configuration information retrieval request, it sends the corresponding configuration information back to the application, enabling the corresponding cluster to update its configuration information.
[0048] The configuration list includes multiple configuration entries for the off-site disaster recovery cluster, along with their corresponding update status and version number. The update status indicates whether the configuration information for the off-site disaster recovery cluster has been updated in the distributed configuration server. The version number indicates the current version of the configuration information.
[0049] Specifically, the target logical unit of the main cluster sends a configuration information retrieval request corresponding to the configuration information retrieval instance to the distributed configuration server, so that the distributed configuration server returns the configuration list information of the off-site disaster recovery cluster corresponding to the configuration information retrieval request, and updates the configuration information of the corresponding database of the off-site disaster recovery cluster based on the configuration list information.
[0050] For example, referring to the above example, the target logical unit of the main cluster sends a configuration information retrieval request corresponding to the configuration information retrieval instance to actively call the interface for retrieving the configuration list information of the remote disaster recovery cluster. This allows the main cluster to obtain the corresponding configuration list information, achieving parallel retrieval of each latest configuration information. Based on this, the consistency and integrity of configuration information between the remote disaster recovery cluster and the distributed configuration server can be guaranteed. Resource optimization is also achieved, avoiding omissions or duplicate retrieval of configuration information and ensuring that the application can comprehensively obtain configuration information in a multi-cluster environment.
[0051] S140. Synchronize the configuration list information obtained by the primary cluster to the off-site disaster recovery cluster, so as to update the configuration information of the off-site disaster recovery cluster based on the configuration list information.
[0052] Specifically, through the synchronization mechanism between the primary cluster and the off-site disaster recovery cluster, the configuration list information obtained by the primary cluster is synchronized to the off-site disaster recovery cluster, so as to update the configuration information stored in the local database and / or local file storage space corresponding to the off-site disaster recovery cluster based on the configuration list information.
[0053] For example, following the above example, after the primary cluster obtains the configuration list information, the configuration information acquisition instance will write the obtained configuration list information into the local database corresponding to the primary cluster according to a preset format and data specifications. During the writing process, a transaction mechanism will be used to ensure the consistency and integrity of the configuration list information, avoiding data incompleteness or errors due to abnormal interruptions. Afterwards, a database synchronization strategy will be initiated to synchronize the configuration list information stored in the primary cluster to the local database of the off-site disaster recovery cluster, based on the configuration information in the local database.
[0054] Optionally, after detecting that the configuration information corresponding to the off-site disaster recovery cluster has been updated, if it is detected that the target logical unit of the main cluster has held the target lock for a second preset duration, the target lock is released.
[0055] The second preset duration can be a pre-set standard duration for which the target logic unit holds the target lock.
[0056] Specifically, after detecting that the configuration information corresponding to the off-site disaster recovery cluster has been updated, if it is detected that the target logical unit of the main cluster has held the target lock for a second preset duration, the target lock can be released to ensure the periodicity and stability of the configuration information acquisition request.
[0057] For example, since the trigger times of the periodic configuration retrieval task differ between different running instances, a delayed release strategy can be adopted for the target lock to prevent repeated reading and writing of configuration information and to ensure the periodicity and stability of configuration information retrieval requests. That is, after completing the acquisition and synchronization of configuration information, the target logic unit that has acquired the target lock will not immediately release it. Instead, it will release the target lock after holding it for a second preset duration. Based on this, it is ensured that only one configuration information retrieval instance performs the acquisition and synchronization operation within the same period (the second preset duration), thereby effectively avoiding the risk of repeated execution and ensuring the accuracy and reliability of configuration information updates.
[0058] Optionally, embodiments of the present invention further include: performing primary / backup operation status detection on at least one application service cluster on the application end, so as to perform processing to obtain configuration list information of the off-site disaster recovery cluster from the distributed configuration server based on the primary cluster in the application end at the current moment.
[0059] It should be noted that in the technical solution provided in the embodiments of the present invention, the subsequent configuration information acquisition and synchronization processing of the off-site disaster recovery cluster can only be performed if the cluster to which the configuration information acquisition instance belongs is determined to be the main cluster. Therefore, the main and backup running status of at least one application service cluster on the application side can be detected in real time to determine whether the application service cluster to which the configuration information acquisition instance belongs is the main cluster, thereby ensuring the normal execution of subsequent processing.
[0060] Specifically, the primary and backup operation status detection process is performed on at least one application service cluster on the application side to determine the primary cluster and the off-site disaster recovery cluster of the application side at the current moment, so as to facilitate the processing of retrieving the configuration category information corresponding to the off-site disaster recovery cluster from the distributed configuration server based on the primary cluster at the current moment.
[0061] For example, based on the above example, for a configuration information retrieval instance running in a remote disaster recovery cluster, various methods such as heartbeat detection and database status feedback can be used to monitor in real time whether the cluster to which the configuration information retrieval instance belongs is the primary cluster. If it is detected that the cluster to which the configuration information retrieval instance belongs is a remote disaster recovery cluster, termination logic can be automatically triggered to immediately stop the relevant service threads corresponding to that configuration information retrieval instance, release the occupied system resources, and record the termination log. Based on this, interference from the configuration information retrieval instance corresponding to the remote disaster recovery cluster to the primary cluster can be effectively avoided, preventing errors in business execution logic caused by the switching of primary and backup roles in the cluster, while ensuring the rational utilization of system resources and providing strong guarantees for business continuity and data stability.
[0062] The technical solution of this embodiment generates a configuration information acquisition instance when the application meets the configuration information acquisition conditions, and then acquires the corresponding configuration information based on the configuration information acquisition instance. When it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that has acquired the target lock is determined. Based on this, it can be guaranteed that only one logical unit acquires configuration information in the same query cycle, avoiding the problem of repeated acquisition or writing of configuration information. According to the target logical unit of the main cluster, a configuration information acquisition request corresponding to the configuration information acquisition instance is sent to the distributed configuration server, so that the distributed configuration server returns configuration list information corresponding to the remote disaster recovery cluster. The configuration list information acquired by the main cluster is synchronized to the remote disaster recovery cluster, so that the configuration information of the remote disaster recovery cluster is updated based on the configuration list information. This invention establishes a new disaster recovery cluster configuration information acquisition link, ensuring that the application can independently and securely obtain the configuration information of the disaster recovery cluster. This allows the application to acquire and synchronize the configuration information of the disaster recovery cluster without relying on the original business logic. It solves the problem of configuration information loss caused by processing with local file copies in the prior art. By acquiring the configuration information of the disaster recovery cluster from the primary cluster and synchronizing it to the disaster recovery cluster, timely updates and backups of the configuration information are achieved, significantly improving the disaster recovery capability of the cluster and ensuring the business continuity of the corresponding services.
[0063] Example 2
[0064] Figure 2 This is a flowchart illustrating a configuration information update method applied to a primary / standby cluster, as provided in Embodiment 2 of the present invention. This embodiment is a preferred embodiment of the above embodiments. For specific implementation details, please refer to the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here. Figure 2 As shown, the method includes:
[0065] S210. When the application receives the configuration status response information corresponding to the configuration status detection request from the distributed configuration server, if it detects that the triggering conditions for the scheduled configuration acquisition task are met and / or that the data acquisition mode corresponding to the application will switch to local mode, then a configuration information acquisition instance is generated.
[0066] The data acquisition modes include local mode and remote mode. In local mode, the application obtains configuration information from the local database and / or local file storage space, while in remote mode, the application obtains configuration information from a distributed configuration server.
[0067] The configuration status detection request can be sent to the distributed configuration server to check if the configuration information of the off-site disaster recovery cluster it stores has been updated. The configuration status response information can be a response from the distributed configuration server indicating that the configuration information has been updated. The scheduled configuration retrieval task can be a task that retrieves configuration information from the distributed configuration server at regular intervals. The trigger condition for the scheduled configuration retrieval task is the arrival time of the task.
[0068] Data acquisition modes include local mode and remote mode. When it is detected that the data acquisition mode is about to switch to local mode, the corresponding configuration information can be obtained from the distributed configuration server in remote mode and synchronized to the local database and / or local file storage space. This ensures that after switching to local mode, the latest configuration information can be obtained from the corresponding local database.
[0069] Specifically, the application can send a configuration status check request to the distributed configuration server, enabling the server to detect whether the corresponding configuration information has been updated. If an update exists, the distributed configuration server can respond with configuration status information corresponding to the check request. After receiving the configuration status response, if the application detects that the trigger time for the scheduled configuration retrieval task has arrived, it determines that the triggering conditions for the scheduled configuration retrieval task are met. And / or, if it detects that the application's data retrieval mode is about to switch to local mode, it determines that the configuration information retrieval conditions are met and generates a configuration information retrieval instance.
[0070] For example, in conjunction with the above examples, the method for obtaining configuration information of the off-site disaster recovery cluster mentioned in the embodiments of the present invention establishes an independent communication channel between the application end and the distributed configuration server, so that the application end can independently and securely obtain the configuration information of the off-site disaster recovery cluster, and supports the application end to independently obtain and update the configuration information of the off-site disaster recovery cluster without relying on the original business logic.
[0071] See Figure 3 , Figure 3 This is a flowchart illustrating the process of obtaining configuration information corresponding to the off-site disaster recovery cluster from the distributed configuration server through the main cluster.
[0072] The application sends a configuration status request to the distributed configuration server. Upon receiving the request, the distributed configuration server checks if the configuration information of the corresponding off-site disaster recovery cluster in its database has been updated. If an update exists, it sends a configuration status response corresponding to the configuration status check request. After receiving the configuration status response, the application can determine whether the conditions for obtaining configuration information are met.
[0073] Right now, Figure 3 As shown, when a timed configuration acquisition task is detected to be triggered every T minutes or when the local mode switch is about to change, a configuration information acquisition instance can be generated to perform subsequent configuration information acquisition and synchronization processing based on the configuration information acquisition instance.
[0074] In this embodiment of the invention, the specific process for the application to receive the configuration status response information is as follows: the application sends a configuration status detection request to the distributed configuration server, so that the distributed configuration server detects the configuration information status after receiving the configuration status detection request for a first preset time, and if it determines that the configuration information status is updated, it feeds back the corresponding configuration status response information to the application; wherein, the configuration information status is used to characterize whether the configuration information stored by the distributed configuration server corresponding to the off-site disaster recovery cluster has been updated.
[0075] The first preset duration can be pre-set; it refers to the duration for which the distributed configuration server suspends the configuration status detection request after receiving it. "Configuration information updated" indicates that the configuration information stored on the distributed configuration server corresponding to the off-site disaster recovery cluster has been updated.
[0076] Specifically, the application sends a configuration status check request to the distributed configuration server. Upon receiving the request, the distributed configuration server checks the configuration information status after a first preset time interval and determines whether the configuration information has been updated. Setting a first preset time interval avoids sending configuration status check requests and performing configuration status checks repeatedly, thus improving the efficiency of configuration information acquisition and synchronization.
[0077] If the configuration information status is determined to be updated, the corresponding configuration status response information is fed back to the application, so that the application can obtain the configuration information in a timely manner when the conditions for obtaining the configuration information are met.
[0078] S220. When it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, the target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that has acquired the target lock is determined.
[0079] The target lock is an application lock that matches the business execution logic of the configuration information acquisition instance. S230: The target logic unit based on the main cluster sends a configuration information acquisition request corresponding to the configuration information acquisition instance to the distributed configuration server, and receives the configuration list information returned by the distributed configuration server corresponding to the remote disaster recovery cluster.
[0080] For example, in conjunction with the above examples, see Figure 3 When the conditions for obtaining configuration information are met, the system checks whether the data acquisition mode corresponding to the application is local mode. If the data acquisition mode is not local mode, a configuration information acquisition instance is generated. The system then checks the database running status of the cluster to which the configuration information acquisition instance belongs. If the database running status is writable, a target lock is acquired through at least one logical unit of the main cluster. The logical unit that acquired the target lock is designated as the target logical unit. Based on the target logical unit, a configuration information acquisition request is sent to the distributed configuration server to obtain the configuration list information corresponding to the remote disaster recovery cluster. Updated configuration information in the configuration list is then updated in the database of the main cluster and synchronized to the remote disaster recovery cluster.
[0081] It should be noted that for at least one application service cluster under the application client, there is a corresponding new link, that is, through... Figure 3 The configuration information is obtained and synchronized in the manner shown. However, since the business logic for obtaining configuration information is executed by the target logical unit of the application master cluster in this embodiment of the invention, at least one application service cluster can be detected so that when the roles of the master and backup clusters change, the above operation can be performed based on the master cluster at the current moment. That is, if the disaster recovery cluster in the off-site location switches to the master cluster, the operation of obtaining configuration information and synchronizing it to the current disaster recovery cluster in the off-site location (the previous master cluster) can be performed based on the current master cluster (the previous disaster recovery cluster).
[0082] S240. Based on the asynchronous replication mechanism, the configuration list information obtained by the master cluster is synchronized to the remote disaster recovery cluster. After receiving the configuration list information, the remote disaster recovery cluster matches the configuration information update status and configuration information version number in the configuration list information with the corresponding configuration information update status and configuration information version number of the remote disaster recovery cluster to determine the configuration information to be updated.
[0083] The configuration list information includes: configuration information corresponding to the off-site disaster recovery cluster, configuration information update status, and configuration information version number. The asynchronous replication mechanism works by having the primary cluster's database immediately return a success response to the application after completing the configuration information retrieval and update operations, without waiting for confirmation from the off-site disaster recovery cluster. The primary cluster then asynchronously pushes the configuration list information to the off-site disaster recovery cluster via a background thread or middleware, enabling the off-site disaster recovery cluster to update its configuration information.
[0084] The configuration information to be updated can be the configuration information in the configuration list that needs to be updated to the off-site disaster recovery cluster, that is, the configuration information that differs between the distributed configuration server and the off-site disaster recovery cluster.
[0085] It should be noted that after the main cluster obtains the configuration list information, it can also update the configuration information in the local database and / or local file storage space corresponding to the main cluster based on the configuration list information.
[0086] Specifically, a remote replication mechanism is adopted to achieve efficient synchronization of configuration list information without affecting the performance of the primary cluster. That is, the configuration list information is synchronized to the remote disaster recovery cluster, so that after receiving the configuration list information, the remote disaster recovery cluster matches the configuration information update status and configuration information version number in the configuration list information with the corresponding configuration information update status and configuration information version number in the remote disaster recovery cluster to determine the configuration information to be updated.
[0087] S250: Format the configuration information to be updated so that the formatted configuration information is updated to the local database and / or local file storage space corresponding to the off-site disaster recovery cluster.
[0088] The formatting process involves formatting the configuration information to be updated into data compatible with the local database and / or local file storage. It's important to note that when retrieving configuration information from the local database and / or local file storage, the information also needs to be formatted and converted to a suitable data format. The local database and local file storage serve as local copies of the off-site disaster recovery cluster's configuration information. In the event of a failure of the distributed configuration server, the corresponding configuration information can be retrieved from these local copies to ensure business continuity.
[0089] Specifically, the configuration information to be updated is formatted to obtain a formatted configuration information adapted to the local database and / or local file storage space. The formatted configuration information is then updated to the local database and / or local file storage space corresponding to the off-site disaster recovery cluster.
[0090] It should be noted that after the off-site disaster recovery cluster updates the corresponding local database and / or local file storage space based on the configuration information to be updated, the configuration information can be applied according to the same data transaction rules as the primary cluster to ensure data consistency between the primary and backup clusters. The entire process strictly follows the system's disaster recovery and high availability design specifications, thereby ensuring that the off-site disaster recovery cluster can quickly take over business operations and guarantee the continuous and stable operation of the system in the event of a failure in the primary cluster. At the same time, the system monitors the data synchronization status in real time, promptly detects and handles synchronization anomalies, further improving the system's reliability and fault tolerance.
[0091] The technical solution of this embodiment generates a configuration information acquisition instance when the application receives configuration status response information corresponding to the configuration status detection request from the distributed configuration server. If the triggering conditions for the timed configuration acquisition task are met and / or the data acquisition mode corresponding to the application is about to switch to local mode, a configuration information acquisition instance is generated. When it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that has acquired the target lock is determined. Based on this, it can be ensured that only one logical unit obtains configuration information within the same query cycle, avoiding the problem of repeated acquisition or writing of configuration information. The configuration information acquisition request corresponding to the configuration information acquisition instance is sent to the distributed configuration server according to the target logical unit of the main cluster, so that the distributed configuration server returns the configuration list information corresponding to the remote disaster recovery cluster. Through an asynchronous replication mechanism, the configuration list information acquired by the primary cluster is synchronized to the off-site disaster recovery cluster. Upon receiving the configuration list information, the off-site disaster recovery cluster matches the configuration information update status and version number in the configuration list with the corresponding configuration information update status and version number in the off-site disaster recovery cluster to determine the configuration information to be updated. This updated configuration information is then formatted and updated to the local database and / or local file storage space corresponding to the off-site disaster recovery cluster. This invention establishes a new configuration information acquisition link for the disaster recovery cluster, ensuring that the application can independently and securely obtain the configuration information of the disaster recovery cluster. This allows the application to acquire and synchronize the configuration information of the disaster recovery cluster without relying on existing business logic, solving the problem of configuration information loss caused by processing with local file copies in existing technologies. By acquiring the configuration information of the disaster recovery cluster from the primary cluster and synchronizing it to the disaster recovery cluster, timely updates and backups of configuration information are achieved, significantly improving the disaster recovery capability of the cluster and ensuring the business continuity of the corresponding services.
[0092] Example 3
[0093] Figure 4 This is a structural example diagram of a configuration information acquisition and synchronization system applied to a primary / standby cluster, provided by an embodiment of the present invention. The method applied in this embodiment is an example of a method based on the above method embodiment. Specific implementation details can be found in the technical solution of this embodiment. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here. Figure 4 As shown, the system includes: a configuration agent system integrated into the application and a runtime service system corresponding to the distributed configuration server.
[0094] The configuration agent system includes a primary cluster configuration acquisition module, a backup cluster configuration acquisition module, a cluster status check module, a local replica data management module, and a memory data management module.
[0095] The main cluster configuration acquisition module is used to acquire configuration information for the main cluster and maintain the various configuration information required for the current application to run. This module has timed status detection and configuration information acquisition functions, enabling real-time monitoring of configuration information updates. When the configuration information stored in the distributed configuration server is updated, the latest configuration information can be automatically updated to the main cluster's local database and / or local file storage space to ensure the real-time performance and accuracy of the main cluster configuration information, thereby guaranteeing the stable operation of the corresponding application system.
[0096] The backup cluster configuration acquisition module is used to acquire the configuration information of the off-site disaster recovery cluster. It operates independently of the primary cluster configuration acquisition module, thus ensuring the independence and fault tolerance of business functions. Even if an anomaly occurs in acquiring the off-site disaster recovery cluster configuration information, it will not affect application services. It should be noted that the processing method of the backup cluster configuration acquisition module is consistent with steps S110 to S140 mentioned in the above embodiments. When the configuration information of the off-site disaster recovery cluster specified by the application system or application changes in the distributed configuration server, this device can automatically update the latest configuration information to the primary cluster and, through a data synchronization mechanism, synchronize the configuration information from the primary cluster to the local database and / or local file storage control space of the off-site disaster recovery cluster, ensuring the real-time nature and accuracy of the configuration information, thereby guaranteeing the stable operation of the off-site disaster recovery cluster.
[0097] The cluster status detection module is used to monitor the primary and backup operation status of at least one application service cluster on the application side in real time. Specifically, it determines which application service cluster is the primary cluster and which is the off-site disaster recovery cluster. Based on this, when the cluster to which the configuration information acquisition instance belongs is the primary cluster, the configuration information acquisition instance can normally perform the operation of retrieving the configuration list information of the off-site disaster recovery cluster from the distributed configuration server and the synchronization of configuration information. When the cluster to which the configuration information acquisition instance belongs is the off-site disaster recovery cluster, the configuration information acquisition instance does not perform the configuration information retrieval and synchronization operations for the off-site disaster recovery cluster. In addition, this module has a rapid response mechanism; when a primary / backup cluster switch occurs, it can promptly adjust the corresponding business execution logic to ensure the continuity and stability of system operation.
[0098] The local copy data management module formats the configuration information obtained by the configuration acquisition module to obtain configuration information adapted to the local database and / or local file storage space, and updates it to the local copy (local database and / or local file storage space), thereby ensuring the persistent storage of configuration information. This module's localization of configuration information is completely transparent and imperceptible to upper-layer applications. Furthermore, this module operates independently, ensuring that even in the event of anomalies, it will not affect the normal operation of the application, demonstrating strong fault tolerance.
[0099] The memory data management module formats the configuration information returned by the configuration retrieval module and updates the formatted configuration information to the memory cache. For example, when an application based on the Spring Boot framework retrieves configuration information via annotations, this module can automatically update the corresponding memory variable data, thereby ensuring that the business logic of the upper-layer application can obtain the latest configuration information in real time, achieving efficient response and transparent management of configuration updates.
[0100] The running service system includes: a configuration publishing module, a configuration caching module, a configuration distribution module, a status detection module, and a database transaction module.
[0101] The configuration publishing module provides an interface for configuration publishing management, which can be called by external management terminals to update the configuration information stored in the distributed configuration server. Specifically, it stores the configuration information issued by external management terminals in the database of the distributed configuration server, achieving unified control over configuration publishing capabilities. This module effectively decouples management functions from business operations, ensuring not only the security and compliance of the configuration information publishing process but also significantly improving the independence and management efficiency of the distributed configuration server.
[0102] The configuration caching module loads configuration information stored in the database by the configuration publishing module into the corresponding memory and caches it. This effectively improves the efficiency and performance of configuration information retrieval by the primary and backup cluster configuration acquisition modules of the configuration agent system, while reducing the operational pressure on the database. This module also has a function to periodically update the configuration status, ensuring timely updates of the latest configuration information from the database to memory, further enhancing the efficiency and reliability of configuration retrieval.
[0103] The configuration distribution module processes configuration information retrieval requests from the configuration agent system, formats the corresponding configuration list information, and then distributes it to the configuration agent system. During this process, this module also records data such as information interaction logs and agent information to ensure traceability and queryability of information interaction logs, thereby improving system management capabilities.
[0104] The status detection module monitors configuration status detection requests from the configuration agent system in real time. By synchronously detecting the configuration information cached in the distributed configuration server, it promptly transmits the configuration status response information corresponding to the configuration status detection requests to the configuration agent system. This enables the configuration agent system to respond quickly and trigger configuration information retrieval requests, thereby effectively improving configuration information update efficiency and significantly increasing the configuration information update speed of the business system.
[0105] The database transaction module is used to uniformly manage database transactions on the distributed configuration server, providing a unified data interface and supporting basic database operations such as CRUD operations. By centrally handling database-related logic, it effectively reduces the code complexity of functional modules, minimizes code redundancy, and improves the reliability and stability of the database.
[0106] The technical solution in this embodiment obtains the configuration list information of the off-site disaster recovery cluster from the distributed configuration server by the primary cluster, and synchronizes the configuration list information to the database of the off-site disaster recovery cluster in real time through an efficient data synchronization mechanism. This not only solves the technical pain point of limited configuration separation capability when the configuration center is unavailable, but also establishes a configuration information synchronization mechanism between the primary and backup clusters through a configuration information acquisition and synchronization system applied to the primary and backup clusters. This ensures that the off-site disaster recovery cluster can quickly take over and maintain business operations when the distributed configuration server fails. Through intelligent management and synchronization strategies of configuration information, the system's disaster recovery capability and business continuity are significantly improved, providing strong technical support for industries with extremely high reliability requirements.
[0107] Example 4
[0108] Figure 5 This is a schematic diagram of a configuration information update device applied to a primary / standby cluster, provided in Embodiment 4 of the present invention. Figure 5 As shown, the device includes: an instance generation module 310, a target logic unit determination module 320, a configuration list information determination module 330, and a configuration information update module 340.
[0109] The instance generation module 310 is used to generate a configuration information acquisition instance when the application meets the configuration information acquisition conditions; wherein the application includes at least one primary cluster and a remote disaster recovery cluster; the target logical unit determination module 320 is used to acquire a target lock based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs when the cluster to which the configuration information acquisition instance belongs is determined to be the primary cluster, and to determine the target logical unit that has acquired the target lock; wherein the target lock is an application lock that matches the business execution logic of the configuration information acquisition instance; the configuration list information determination module 330 is used to send a configuration information acquisition request corresponding to the configuration information acquisition instance to the distributed configuration server based on the target logical unit of the primary cluster, and to receive the configuration list information corresponding to the remote disaster recovery cluster returned by the distributed configuration server; the configuration information update module 340 is used to synchronize the configuration list information acquired by the primary cluster to the remote disaster recovery cluster, so as to update the configuration information of the remote disaster recovery cluster based on the configuration list information.
[0110] The technical solution of this embodiment generates a configuration information acquisition instance when the application meets the configuration information acquisition conditions, and then acquires the corresponding configuration information based on the configuration information acquisition instance. When it is determined that the cluster to which the configuration information acquisition instance belongs is the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that has acquired the target lock is determined. Based on this, it can be guaranteed that only one logical unit acquires configuration information in the same query cycle, avoiding the problem of repeated acquisition or writing of configuration information. According to the target logical unit of the main cluster, a configuration information acquisition request corresponding to the configuration information acquisition instance is sent to the distributed configuration server, so that the distributed configuration server returns configuration list information corresponding to the remote disaster recovery cluster. The configuration list information acquired by the main cluster is synchronized to the remote disaster recovery cluster, so that the configuration information of the remote disaster recovery cluster is updated based on the configuration list information. This invention establishes a new disaster recovery cluster configuration information acquisition link, ensuring that the application can independently and securely obtain the configuration information of the disaster recovery cluster. This allows the application to acquire and synchronize the configuration information of the disaster recovery cluster without relying on the original business logic. It solves the problem of configuration information loss caused by processing with local file copies in the prior art. By acquiring the configuration information of the disaster recovery cluster from the primary cluster and synchronizing it to the disaster recovery cluster, timely updates and backups of the configuration information are achieved, significantly improving the disaster recovery capability of the cluster and ensuring the business continuity of the corresponding services.
[0111] Based on the above embodiments, optionally, the instance generation module is used to generate a configuration information acquisition instance when the application receives configuration status response information corresponding to the configuration status detection request from the distributed configuration server. If it detects that the triggering conditions for the timed configuration acquisition task are met and / or that the data acquisition mode corresponding to the application will switch to local mode, the data acquisition mode includes local mode and remote mode. In local mode, the application obtains configuration information from a local database and / or local file storage space, and in remote mode, the application obtains configuration information from the distributed configuration server.
[0112] Optionally, the instance generation module includes: a configuration status response information receiving unit, used to send a configuration status detection request from the application to the distributed configuration server, so that the distributed configuration server detects the configuration information status after receiving the configuration status detection request for a first preset time, and if it determines that the configuration information status is updated, it feeds back the corresponding configuration status response information from the application; wherein, the configuration information status is used to characterize whether the configuration information stored by the distributed configuration server corresponding to the off-site disaster recovery cluster has been updated.
[0113] Optionally, the target logical unit determination module includes: a cluster determination unit, used to detect the database status of the cluster to which the configuration information acquisition instance belongs, and to determine the cluster to which the configuration information acquisition instance belongs as the main cluster when the database status is detected to be writable.
[0114] Optionally, the configuration list information includes: configuration information corresponding to the off-site disaster recovery cluster, configuration information update status, and configuration information version number. The configuration list information determination module is used to synchronize the configuration list information obtained by the master cluster to the off-site disaster recovery cluster based on the asynchronous replication mechanism. This allows the off-site disaster recovery cluster to match the configuration information update status and configuration information version number in the configuration list information with the configuration information update status and configuration information version number corresponding to the off-site disaster recovery cluster after receiving the configuration list information, and determine the configuration information to be updated. The configuration information to be updated is then formatted to update the formatted configuration information to the local database and / or local file storage space corresponding to the off-site disaster recovery cluster.
[0115] Optionally, the device further includes a target lock release module, which is used to release the target lock if the target logical unit of the main cluster has held the target lock for a second preset time after the configuration information corresponding to the off-site disaster recovery cluster is updated.
[0116] Optionally, the device further includes: a primary / standby status detection module, used to detect the primary / standby running status of at least one application service cluster on the application side, so as to perform processing to obtain the configuration list information of the off-site disaster recovery cluster from the distributed configuration server based on the primary cluster in the application side at the current moment.
[0117] The configuration information update device for primary and standby clusters provided in this embodiment of the invention can execute the configuration information update method for primary and standby clusters provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0118] Example 5
[0119] Figure 6 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0120] like Figure 6 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0121] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0122] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as configuration information update methods applied to a primary / standby cluster.
[0123] In some embodiments, the configuration information update method applied to the primary / standby cluster can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the configuration information update method applied to the primary / standby cluster described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the configuration information update method applied to the primary / standby cluster by any other suitable means (e.g., by means of firmware).
[0124] Various embodiments 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), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0125] Computer programs used to implement the configuration information update method for primary / standby clusters of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0126] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, it performs the functions defined in the methods of the embodiments of the present invention.
[0127] Example 6
[0128] Embodiment 6 of the present invention also provides a computer-readable storage medium storing computer instructions for causing a processor to execute a configuration information update method applied to a primary-standby cluster, the method comprising:
[0129] When the application meets the conditions for obtaining configuration information, a configuration information obtaining instance is generated. The application includes at least one primary cluster and a remote disaster recovery cluster. When the cluster to which the configuration information obtaining instance belongs is determined to be the primary cluster, a target lock is obtained based on at least one logical unit of the cluster to which the configuration information obtaining instance belongs, and the target logical unit that obtained the target lock is determined. The target lock is an application lock that matches the business execution logic of the configuration information obtaining instance. Based on the target logical unit of the primary cluster, a configuration information obtaining request corresponding to the configuration information obtaining instance is sent to the distributed configuration server, and the configuration list information corresponding to the remote disaster recovery cluster returned by the distributed configuration server is received. The configuration list information obtained by the primary cluster is synchronized to the remote disaster recovery cluster to update the configuration information of the remote disaster recovery cluster based on the configuration list information.
[0130] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0131] To provide interaction with a user, the systems and techniques described herein can 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 pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0132] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0133] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0134] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0135] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand 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 invention should be included within the scope of protection of this invention.
Claims
1. A method for updating configuration information in a master-slave cluster, characterized in that, include: When the application meets the conditions for obtaining configuration information, a configuration information obtaining instance is generated; wherein, the application includes at least one primary cluster and a remote disaster recovery cluster; When determining that the cluster to which the configuration information acquisition instance belongs is the main cluster, a target lock is acquired based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and the target logical unit that acquired the target lock is determined; wherein, the target lock is an application lock that matches the business execution logic of the configuration information acquisition instance; Based on the target logical unit of the main cluster, a configuration information retrieval request corresponding to the configuration information retrieval instance is sent to the distributed configuration server, and the configuration list information corresponding to the off-site disaster recovery cluster is returned by the distributed configuration server. The configuration list information obtained by the primary cluster is synchronized to the off-site disaster recovery cluster, so as to update the configuration information of the off-site disaster recovery cluster based on the configuration list information.
2. The method according to claim 1, characterized in that, The step of generating a configuration information retrieval instance when the application meets the configuration information retrieval conditions includes: When the application receives the configuration status response information corresponding to the configuration status detection request from the distributed configuration server, if it detects that the triggering conditions for the timed configuration acquisition task are met and / or that the data acquisition mode corresponding to the application will switch to local mode, a configuration information acquisition instance is generated. The data acquisition modes include local mode and remote mode. In local mode, the application obtains configuration information from a local database and / or local file storage space. In remote mode, the application obtains configuration information from the distributed configuration server.
3. The method according to claim 2, characterized in that, The application receives configuration status response information from the distributed configuration server corresponding to the configuration status detection request, including: The application sends a configuration status detection request to the distributed configuration server, so that after receiving the configuration status detection request for a first preset time, the distributed configuration server detects the configuration information status, and if it determines that the configuration information status is that the configuration information has been updated, it feeds back the corresponding configuration status response information of the application. The configuration information status is used to indicate whether the configuration information stored by the distributed configuration server corresponding to the off-site disaster recovery cluster has been updated.
4. The method according to claim 1, characterized in that, The step of determining the primary cluster to which the configuration information acquisition instance belongs includes: The database status of the cluster to which the configuration information acquisition instance belongs is detected. If the database status is detected to be writable, the cluster to which the configuration information acquisition instance belongs is determined to be the primary cluster.
5. The method according to claim 1, characterized in that, The configuration list information includes: configuration information corresponding to the off-site disaster recovery cluster, configuration information update status, and configuration information version number. The step of synchronizing the configuration list information obtained by the primary cluster to the off-site disaster recovery cluster, so as to update the configuration information of the off-site disaster recovery cluster based on the configuration list information, includes: Based on the asynchronous replication mechanism, the configuration list information obtained by the master cluster is synchronized to the off-site disaster recovery cluster. This allows the off-site disaster recovery cluster to match the configuration information update status and version number in the configuration list information with the configuration information update status and version number corresponding to the off-site disaster recovery cluster, and determine the configuration information to be updated. The configuration information to be updated is formatted so that the formatted configuration information is updated to the local database and / or local file storage space corresponding to the off-site disaster recovery cluster.
6. The method according to claim 1, characterized in that, The method further includes: After detecting that the configuration information corresponding to the off-site disaster recovery cluster has been updated, if it is detected that the target logical unit of the main cluster has held the target lock for a second preset duration, then the target lock is released.
7. The method according to claim 1, characterized in that, The method further includes: At least one application service cluster of the application terminal is subjected to primary and backup operation status detection, so as to perform the processing of obtaining the configuration list information of the off-site disaster recovery cluster from the distributed configuration server based on the primary cluster in the application terminal at the current time.
8. A configuration information update device for a primary / standby cluster, characterized in that, include: The instance generation module is used to generate a configuration information acquisition instance when the application meets the configuration information acquisition conditions; wherein, the application includes at least one primary cluster and a remote disaster recovery cluster; The target logical unit determination module is used to, when determining that the cluster to which the configuration information acquisition instance belongs is a main cluster, acquire a target lock based on at least one logical unit of the cluster to which the configuration information acquisition instance belongs, and determine the target logical unit that has acquired the target lock; wherein, the target lock is an application lock that matches the business execution logic of the configuration information acquisition instance; The configuration list information determination module is used to send a configuration information acquisition request corresponding to the configuration information acquisition instance to the distributed configuration server based on the target logical unit of the main cluster, and to receive the configuration list information corresponding to the off-site disaster recovery cluster returned by the distributed configuration server. The configuration information update module is used to synchronize the configuration list information obtained by the main cluster to the off-site disaster recovery cluster, so as to update the configuration information of the off-site disaster recovery cluster based on the configuration list information.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the configuration information update method for a primary-standby cluster as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the configuration information update method for a primary-standby cluster as described in any one of claims 1-7.