Automatic switching method and device for multi-active data center
By obtaining and analyzing the monitoring indicators of multi-active data centers in the disaster recovery tool system in real time, judging the fault center using a dynamic weighting algorithm, and sending switching instructions to the application system, the automatic switching of multi-active data centers is realized, solving the problems of long manual switching and difficult automatic switching in the existing technology, and improving business continuity and user experience.
Patent Information
- Application Number
- CN202411769862.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-02-28
AI Technical Summary
The existing multi-active data center switching method requires manual operation by operation and maintenance personnel, and the switching time is long, and it is difficult to achieve automatic switching without changing the application system architecture.
By obtaining the index values of multiple monitoring indicators in the disaster recovery tool system in real time, a total score is generated based on a dynamic weighting algorithm. When the total score reaches the preset threshold, it is judged that the data center is the fault center, and a switching command is sent to the application system, which automatically switches the user from the fault center to other data centers.
It realizes rapid and automatic switching of multi-active data centers without changing the application system architecture, improving business continuity and user experience, and reducing operation and maintenance costs.
Smart Images

Figure CN119537105A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to an automatic switching method and device for a multi-active data center. Background Art
[0002] With the rapid development of the economy, financial services have higher and higher requirements for business continuity, and financial institutions are increasingly relying on data centers. 7*24 all-day uninterrupted business operation has become one of the most basic requirements of core key businesses. At the same time, with the continuous improvement of national laws and regulations, disaster recovery in the same city, two locations and three centers, and even multiple data centers are becoming standard configurations for financial institutions. At present, most financial institutions have completed data-level disaster recovery construction and adopted the active-standby mode. When a disaster occurs, the primary data center goes down and the backup data center can quickly restore data and applications. However, the huge investment in the construction of the disaster recovery center and the high annual operation and maintenance costs, coupled with its role in disaster recovery, often become idle resources with low utilization. Coupled with the increasingly high business continuity requirements, these factors drive the evolution from the dual-center active-active mode to the dual-active or even multi-active mode. The multi-active mode of the data center can efficiently integrate equipment resources across regions and centers to form a global resource pool and unified scheduling. When a data center fails, it switches to other data centers to provide users with uninterrupted services and ensure user experience and business continuity.
[0003] In the existing multi-active data center switching method, when a disaster occurs, the operation and maintenance personnel need to use a variety of basic monitoring tools to assist and issue switching instructions based on operation and maintenance experience. The overall switching time is long. If the switching method is adjusted from manual switching to automatic switching, the existing solution needs to significantly modify the application system architecture and increase additional resource investment. Therefore. How to achieve automatic switching of multi-active data centers without changing the application system architecture is an urgent problem to be solved. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for automatic switching of multiple active-active data centers, so as to realize automatic switching of multiple active-active data centers without changing the application system architecture.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of an embodiment of the present invention discloses an automatic switching method for a multi-active data center, which is applied to a disaster recovery tool system, wherein the disaster recovery tool system is communicatively connected with an application system, and the method includes:
[0007] For each data center in the multi-active mode, the indicator values of multiple preset monitoring indicators are obtained in real time; wherein each of the monitoring indicators is set with a corresponding indicator threshold and indicator weight;
[0008] For each of the monitoring indicators, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, it is determined as the target monitoring indicator, and according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold, the initial score of the target monitoring indicator is determined;
[0009] Based on the dynamic weighting algorithm, the initial score corresponding to each of the target monitoring indicators and the indicator weight corresponding to each of the target monitoring indicators, a total score is generated and the indicator weight corresponding to each of the target monitoring indicators is updated;
[0010] If the total score reaches a preset score threshold, the data center is determined to be a fault center, and a switching instruction and the identifier of the fault center are sent to the application system, so that the application system determines the target user accessing the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
[0011] Preferably, the method further comprises:
[0012] Obtain historical operation and maintenance data;
[0013] For each of the monitoring indicators, based on the dynamic baseline algorithm and the historical operation and maintenance data, the indicator threshold corresponding to the monitoring indicator is updated.
[0014] Preferably, the method further comprises:
[0015] When it is monitored that the total score corresponding to the faulty center is less than the score threshold, it is determined that the faulty center has returned to normal, and a switchback instruction is sent to the application system so that the application system switches the target user back to the data center after it has returned to normal.
[0016] Preferably, determining the initial score of the target monitoring indicator according to the indicator value of the target monitoring indicator exceeding the range of the corresponding indicator threshold value includes:
[0017] Compare the indicator value of the target monitoring indicator with the corresponding indicator threshold to obtain the difference between the indicator value and the corresponding indicator threshold;
[0018] A difference range in which the difference value is located is determined, and based on the difference range, a corresponding initial score is searched in a preset score mapping table.
[0019] A second aspect of an embodiment of the present invention discloses an automatic switching method for a multi-active data center, which is applied to an application system, wherein the application system is communicatively connected to a disaster recovery tool system, and the method includes:
[0020] Receiving a switching instruction and an identifier of a fault center sent by the disaster recovery tool system;
[0021] Determining a target user who accesses the fault center according to the identifier of the fault center;
[0022] Based on the switching instruction, the target user is switched from the fault center to any other data center in the multi-active mode.
[0023] Preferably, the application system includes a plurality of application clusters, each of the application clusters corresponds to one of the data centers, and the switching of the target user from the fault center to any other data center in the multi-active mode based on the switching instruction includes:
[0024] Using the GTM domain name server, randomly resolving the default domain name to an address corresponding to any data center in the multi-active mode other than the failure center to obtain a first address; the default domain name is input by the target user during the first login operation;
[0025] Receive the first address returned by the GTM domain name server, and access the application cluster corresponding to the corresponding data center according to the first address;
[0026] The application cluster determines the target data center to which the user belongs from each of the data centers other than the failure center based on a preset user allocation strategy, and returns the subdomain name of the target data center to the client;
[0027] In response to the target user initiating a transaction using the sub-domain name, resolving the sub-domain name to a second address of the target data center using the GTM domain name server;
[0028] The application cluster corresponding to the target data center is accessed based on the second address to access the target data center.
[0029] Preferably, the application cluster determines the target data center to which the user belongs from each of the data centers other than the failure center based on a preset user allocation strategy, including:
[0030] The application cluster obtains the user ID of the user;
[0031] Counting the number of the data centers that are not at fault, and obtaining a modulo number;
[0032] Performing a modulo operation on the user ID based on the modulo number to obtain a modulo result; each of the modulo results corresponds to a non-faulty data center;
[0033] The data center corresponding to the modulo result is determined as the target data center to which the user belongs.
[0034] A third aspect of an embodiment of the present invention discloses an automatic switching device for a multi-active data center, which is applied to a disaster recovery tool system, wherein the disaster recovery tool system is communicatively connected with an application system, and the device comprises:
[0035] An acquisition unit, used to acquire the indicator values of a plurality of preset monitoring indicators in real time for each data center in the multi-active mode; wherein each of the monitoring indicators is provided with a corresponding indicator threshold and indicator weight;
[0036] A comparison unit, for determining, for each monitoring indicator, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, the target monitoring indicator, and determining an initial score of the target monitoring indicator according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold;
[0037] A weighting unit, configured to generate a total score and update the indicator weight corresponding to each target monitoring indicator based on a dynamic weighting algorithm, the initial score corresponding to each target monitoring indicator and the indicator weight corresponding to each target monitoring indicator;
[0038] A sending unit is used to determine that the data center is a fault center if the total score reaches a preset score threshold, and send a switching instruction and an identifier of the fault center to the application system, so that the application system determines a target user who accesses the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
[0039] A fourth aspect of an embodiment of the present invention discloses an automatic switching device for a multi-active data center, which is applied to an application system, wherein the application system is communicatively connected to a disaster recovery tool system, and the device comprises:
[0040] A receiving unit, configured to receive a switching instruction and an identifier of a fault center sent by the disaster recovery tool system;
[0041] A determination unit, configured to determine a target user accessing the fault center according to an identifier of the fault center;
[0042] A switching unit is used to switch the target user from the fault center to any other data center in the multi-active mode based on the switching instruction.
[0043] Based on the above-mentioned embodiment of the present invention, an automatic switching method and device for a multi-active data center is provided. For each data center in the multi-active mode, the indicator values of multiple preset monitoring indicators are obtained in real time; wherein each of the monitoring indicators is set with a corresponding indicator threshold and indicator weight; for each of the monitoring indicators, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, it is determined to be a target monitoring indicator, and according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold, the initial score of the target monitoring indicator is determined; based on the dynamic weighting algorithm, the initial score corresponding to each of the target monitoring indicators and the indicator weight corresponding to each of the target monitoring indicators, a total score is generated and the indicator weight corresponding to each of the target monitoring indicators is updated; if the total score reaches the preset score threshold, the data center is determined to be a fault center, and a switching instruction and the identifier of the fault center are sent to the application system, so that the application system determines the target user accessing the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction. In this solution, the disaster recovery tool system is used to determine the total score of the data center. When a disaster occurs based on the total score, a switching instruction and a fault center identifier are sent to the application system, triggering the switching logic of the application system and automatically switching the data center accessed by the user, thereby achieving automatic switching of multiple active data centers without changing the application system architecture. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 A flowchart of an automatic switching method for a multi-active data center disclosed in an embodiment of the present invention;
[0046] Figure 2 A flowchart of another automatic switching method of a multi-active data center disclosed in an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of a user accessing and switching a data center disclosed in an embodiment of the present invention;
[0048] Figure 4 A structural diagram of an automatic switching device for a multi-active data center disclosed in an embodiment of the present invention;
[0049] Figure 5This is a structural diagram of another automatic switching device for a multi-active data center disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0052] In the existing multi-active data center switching method, when a disaster occurs, the operation and maintenance personnel need to use a variety of basic monitoring tools to assist and issue switching instructions based on operation and maintenance experience. The overall switching time is long. If the switching method is adjusted from manual switching to automatic switching, the existing solution needs to significantly modify the application system architecture and increase additional resource investment. Therefore. How to achieve automatic switching of multi-active data centers without changing the application system architecture is an urgent problem to be solved.
[0053] Therefore, an embodiment of the present invention discloses a method and device for automatic switching of multiple active data centers. In this solution, a disaster recovery tool system is used to determine the total score of the data center. When a disaster occurs based on the total score, a switching instruction and a fault center identifier are sent to the application system to trigger the switching logic of the application system. The data center accessed by the user is automatically switched, thereby realizing automatic switching of multiple active data centers without changing the application system architecture.
[0054] like Figure 1 FIG. 1 is a flowchart of an automatic switching method for a multi-active data center disclosed in an embodiment of the present invention. The method is applied to a disaster recovery tool system that is connected to an application system in communication, and mainly includes the following steps:
[0055] Step S101: for each data center in the multi-active mode, obtain the indicator values of multiple preset monitoring indicators in real time.
[0056] In step S101, the monitoring indicators are mainly monitoring indicators at the network level and application level, for example:
[0057] 1. System business success rate and system success rate per unit time;
[0058] 2. Average response time and average processing time of the system per unit time;
[0059] 3. System transaction volume per unit time;
[0060] 4. The number of major and minor alarm instructions per unit time.
[0061] Among them, each monitoring indicator is set with a corresponding indicator threshold and indicator weight.
[0062] The indicator threshold and indicator weight change dynamically. The dynamic update process of each indicator threshold is as follows:
[0063] Obtain historical operation and maintenance data; for each monitoring indicator, update the indicator threshold corresponding to the monitoring indicator based on the dynamic baseline algorithm and historical operation and maintenance data.
[0064] Specifically, a dynamic baseline algorithm is used and combined with historical operation and maintenance data to continuously update the baseline value, wherein the historical operation and maintenance data refers to the historical indicator values of the monitoring indicators.
[0065] It should be noted that the core idea of the dynamic baseline algorithm to adjust the threshold is to build a dynamic baseline value (such as mean, standard deviation, etc.) based on historical operation and maintenance data, and then dynamically adjust the indicator threshold based on this baseline value to make it more flexible to adapt to the operation mode of different time periods. The indicator threshold is usually set based on the fluctuation range of the baseline value, rather than a rigidly defined constant.
[0066] Taking the business success rate as an example, the historical business success rate analysis shows that: baseline value (average value of historical data): 30%, standard deviation: 5%.
[0067] Then, set the business success rate threshold based on the baseline value and standard deviation:
[0068] If the threshold is set to baseline value + 2*standard deviation, then the business success rate threshold is 30% + 2*5% = 40%.
[0069] If the threshold is set to baseline value - 2*standard deviation, then the business success rate threshold is 30% - 2*5% = 20%.
[0070] The core functions of the dynamic baseline algorithm are defined and described as follows:
[0071] function DynamicBaseline(dataStream,windowSize,threshold):
[0072] / / Initialize the baseline to the average value of a window at the beginning of the data stream
[0073] baseline=CalculateInitialBaseline(dataStream,windowSize)
[0074] / / Initialize the exception list, which contains historical operation and maintenance data, usually real numbers
[0075] anomalies=[]
[0076] / / Traverse each data point in the data stream
[0077] for each dataPoint in dataStream:
[0078] / / Calculate the deviation between the current data point and the baseline. The current data point is the historical operation and maintenance data. For example, the business success rate is 99% and the baseline value is 98%.
[0079] deviation=AbsoluteValue(dataPoint-baseline)
[0080] / / If the deviation exceeds the threshold, it is considered an outlier
[0081] if deviation>threshold:
[0082] AddToAnomalies(dataPoint,anomalies)
[0083] / / Update the baseline
[0084] baseline=UpdateBaseline(dataPoint,baseline,windowSize)
[0085] return anomalies
[0086] Helper function definition:
[0087] / / Calculate the initial baseline
[0088] function CalculateInitialBaseline(dataStream,windowSize):
[0089] sum=0
[0090] for i from 0 to windowSize-1:
[0091] sum+=dataStream[i]
[0092] return sum / windowSize
[0093] / / Update the baseline
[0094] function UpdateBaseline(dataPoint,currentBaseline,windowSize):
[0095] / / Update the baseline using simple moving average method
[0096] return(currentBaseline*(windowSize-1)+dataPoint) / windowSize
[0097] / / Add the exception value to the exception list
[0098] function AddToAnomalies(dataPoint,anomalies):
[0099] anomalies.append(dataPoint)
[0100] CalculateInitialBaseline: Calculates the initial baseline, which is obtained by taking the average of the first windowSize data points in the data stream.
[0101] UpdateBaseline: Updates the baseline each time a new data point is received. The simple moving average method is used here.
[0102] AbsoluteValue: Calculates the absolute value.
[0103] AddToAnomalies: If a data point deviates from the current baseline by more than a given threshold, it is marked as an anomaly and added to the anomaly list.
[0104] Instructions for use:
[0105] dataStream: A list or stream of sequential data points.
[0106] WindowSize: The window size used to calculate the baseline. The window size is a value set by the user. For example, if the window size is 7, it is a baseline within 7 days.
[0107] threshold: The standard value for determining abnormality.
[0108] Step S102: For each monitoring indicator, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, it is determined as the target monitoring indicator, and the initial score of the target monitoring indicator is determined according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold.
[0109] In step S102, the target monitoring indicator is converted into a real value according to its importance and in combination with historical operation and maintenance experience to obtain an initial score.
[0110] In the specific implementation process of step S102, the indicator value of the target monitoring indicator is compared with the corresponding indicator threshold to obtain the difference between the indicator value and the corresponding indicator threshold; the difference range of the difference is determined, and based on the difference range, the corresponding initial score is found in the preset score mapping table.
[0111] For example, if the business success rate is 90% and the corresponding indicator threshold is 80%, then the difference is 10%, which is in the range of 0% to 30%. The initial score corresponding to this difference range is 80 points.
[0112] It is understandable that the scoring mapping table is established according to the importance of each monitoring indicator and combined with historical operation and maintenance experience.
[0113] Step S103: Based on the dynamic weighting algorithm, the initial scores corresponding to the target monitoring indicators and the indicator weights corresponding to the target monitoring indicators, a total score is generated and the indicator weights corresponding to each target monitoring indicator are updated.
[0114] In step S103, a total score is generated based on a dynamic weighting algorithm, the initial score corresponding to each target monitoring indicator and the indicator weight corresponding to each target monitoring indicator, and the indicator weight corresponding to each monitoring indicator is dynamically updated according to the actual historical disaster occurrence and trend.
[0115] The core function definition and description of the dynamic weighted algorithm are as follows:
[0116] function DynamicWeightingAlgorithm(inputData,initialWeights,learningRate):
[0117] / / Initialize the weight vector
[0118] weights=initialWeights
[0119] / / Initialize performance indicators
[0120] performanceMetric=InitializePerformanceMetric()
[0121] / / For each input data
[0122] for each dataPoint in inputData:
[0123] / / Use the current weights to calculate the predicted output
[0124] prediction=CalculatePrediction(dataPoint,weights)
[0125] / / Calculate error
[0126] error=CalculateError(prediction,dataPoint.target)
[0127] / / Update performance indicators
[0128] performanceMetric=UpdatePerformanceMetric(performanceMetric,error)
[0129] / / Adjust weights
[0130] weights=AdjustWeights(weights,error,learningRate)
[0131] return weights,performanceMetric
[0132] Helper function definition:
[0133] / / Initialize performance indicators
[0134] function InitializePerformanceMetric():
[0135] / / It can be mean square error (MSE), mean absolute error (MAE), etc.
[0136] return 0
[0137] / / Calculate the predicted output
[0138] function CalculatePrediction(dataPoint,weights):
[0139] / / Assume that the data point is a feature vector and the weight corresponds to it
[0140] prediction=0
[0141] for i from 0 to numberOfFeatures-1:
[0142] prediction+=dataPoint.features[i]*weights[i]
[0143] return prediction
[0144] / / Calculate error
[0145] function CalculateError(prediction,target):
[0146] / / The error can be the difference between the target value and the predicted value
[0147] return target-prediction
[0148] / / Update performance indicators
[0149] function UpdatePerformanceMetric(performanceMetric,error):
[0150] / / Update according to the specific performance indicator formula
[0151] return performanceMetric+error*error / / Take MSE as an example
[0152] / / Adjust weights
[0153] function AdjustWeights(weights,error,learningRate):
[0154] newWeights=[]
[0155] for i from 0 to numberOfFeatures-1:
[0156] / / Update each weight
[0157] newWeights.append(weights[i]+learningRate*error*dataPoint.features[i])
[0158] return newWeights
[0159] Among them, InitializePerformanceMetric: initializes performance indicators, such as mean square error (MSE).
[0160] CalculatePrediction: Calculates the predicted output based on the current weights.
[0161] CalculateError: Calculates the error between the actual value and the predicted value.
[0162] UpdatePerformanceMetric: Updates the performance metric based on the error.
[0163] AdjustWeights: Update weights based on error and learning rate.
[0164] Instructions for use:
[0165] inputData: A list containing multiple data points, each of which contains a feature vector and a target value.
[0166] initialWeights: The initial weight vector corresponding to the feature.
[0167] learningRate: How fast the weights are adjusted.
[0168] Step S104: If the total score reaches the preset score threshold, the data center is determined to be a fault center, and a switching instruction and the identifier of the fault center are sent to the application system, so that the application system determines the target user accessing the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
[0169] In step S104, the identifier of the fault center may be its corresponding subdomain name.
[0170] It should be noted that the application system deploys a default domain name and multiple sub-domain names, each of which represents a different data center. The default domain name is customer-oriented, and the sub-domain names are transparent to customers. The default domain name can be resolved to multiple data centers, while the sub-domain names can only be resolved to a single center.
[0171] It is understandable that, before the switch, the target user is accessing the application cluster corresponding to the failed data center, and the data center provides data services and other support for the application cluster, that is, the target user accesses the data center.
[0172] The application system includes multiple application clusters, and each application cluster has a data center that provides services for it.
[0173] In one embodiment, when it is monitored that the total score corresponding to the faulty center is less than the score threshold, it is determined that the faulty center has returned to normal, and a switchback instruction is sent to the application system so that the application system switches the target user back to the restored data center.
[0174] It should be noted that this solution is carried out in real time, and each data center in the multi-active mode is judged in real time, even if it is a data center that is determined to have failed. Therefore, when the total score of the data center previously determined to be faulty is not greater than the score threshold, the users who were originally connected to this data center will be switched back from other data centers.
[0175] Based on the above-mentioned embodiment of the present invention, an automatic switching method of multiple active data centers is disclosed. In this solution, a disaster recovery tool system is used to determine the total score of the data center calculation. When a disaster is determined to have occurred based on the total score, a switching instruction and a fault center identifier are sent to the application system to trigger the switching logic of the application system, and automatically switch the data center accessed by the user, thereby realizing automatic switching of multiple active data centers without changing the application system architecture.
[0176] like Figure 2 FIG. 1 is a flowchart of another automatic switching method of a multi-active data center disclosed in an embodiment of the present invention, which is applied to an application system, and the application system is connected to a disaster recovery tool system for communication, and mainly includes the following steps:
[0177] Step S201: receiving a switching instruction and an identifier of a fault center sent by a disaster recovery tool system.
[0178] In step S201, the process of the disaster recovery tool system sending the switching instruction and the identification of the fault center can be found in the above-mentioned embodiment of the present invention, which will not be described in detail here.
[0179] Step S202: Determine the target user who accesses the fault center according to the identifier of the fault center.
[0180] In step S202, the target user accessing the fault center refers to a user who is accessing an application cluster relying on the fault center.
[0181] Step S203: Based on the switching instruction, the target user is switched from the fault center to any other data center in the multi-active mode.
[0182] It should be noted that during the switch, it is necessary to ensure that the data center being switched to is not the fault center.
[0183] For detailed description of the specific implementation process of step S203, please refer to Figure 3 , which is a schematic diagram of a user accessing and switching a data center disclosed in an embodiment of the present invention.
[0184] First of all, it should be noted that the application system deploys a default domain name and multiple sub-domain names, each of which represents a different data center. The default domain name is customer-oriented, and the sub-domain names are transparent to customers. The default domain name can be resolved to multiple data centers, while the sub-domain names can only be resolved to a single center.
[0185] The application system includes multiple application clusters, and each application cluster corresponds to a data center.
[0186] The steps for users to access the data center for the first time are as follows:
[0187] ① After the user logs in for the first time through the client and uses the default domain name, the GTM domain name server will randomly resolve the default domain name to the corresponding address of any data center.
[0188] Among them, GTM (Global Traffic Manager) is a global traffic management system, usually supported by load balancing technology, which is used to intelligently distribute network traffic among servers in different geographical locations.
[0189] The address refers to the IP address of the data center.
[0190] ② Connect the user to the corresponding data center according to the address returned by GTM, that is, access the application cluster corresponding to the data center.
[0191] The application cluster needs to determine the data center to which the user belongs according to the preset user allocation policy, so continue to perform the following steps.
[0192] ③The application cluster obtains the user ID from the user management system.
[0193] It should be noted that the user management system is deployed in any application cluster in the application system.
[0194] ④ Perform a modulo operation based on the number of data centers to determine the data center to which the user belongs, and return the domain name corresponding to the data center to which the user belongs to the client.
[0195] The example is three centers. The user ID is modulo 3. There are three results of the modulo. The three results correspond to different centers. Therefore, the data center to which the user belongs can be obtained according to the modulo interface.
[0196] The purpose of taking the model is to divert users and inform them which data center to access, so as to achieve user diversion and load balancing.
[0197] ⑤The user initiates a transaction through the client and the sub-domain name, and the GTM domain name server resolves the sub-domain name to the corresponding data center address.
[0198] ⑥ Access the corresponding application cluster through the address returned by GTM to complete the access.
[0199] It can be understood that ① to ④ are operations performed upon first access, and ⑤ to ⑥ are operations performed after a user who has been assigned a sub-domain name initiates a transaction. That is to say, subsequent users can use the sub-domain name to repeatedly perform ⑤ to ⑥ to initiate transactions, access the application cluster, and access the corresponding data center.
[0200] When the application system receives the switching instruction and the identification of the fault center from the disaster recovery tool system, it will process the failure of a data center, interrupt transactions, and make the application inaccessible. GTM will automatically detect and stop the sub-domain name and resolution address of the fault center.
[0201] During the switch, the application system modifies the preset allocation strategy with one click, that is, removes the faulty center from the modulus quantity and allocates users connected to the faulty center to other normal data centers for transactions.
[0202] Based on the above, the specific implementation process of step S203 is as follows:
[0203] Step S2031: using the GTM domain name server, randomly resolve the default domain name to an address corresponding to any data center in the multi-active mode other than the fault center to obtain a first address.
[0204] In step S2031, the default domain name is input by the target user during the first login operation.
[0205] Step S2032: Receive the first address returned by the GTM domain name server, and access the application cluster corresponding to the corresponding data center according to the first address.
[0206] Step S2033: the application cluster determines the target data center to which the user belongs from various data centers other than the fault center based on the preset user allocation strategy, and returns the sub-domain name of the target data center to the client.
[0207] In the specific implementation process of step S2033, the application cluster obtains the user ID of the user; counts the number of non-faulty data centers to obtain a modulo number; performs a modulo operation on the user ID based on the modulo number to obtain a modulo result; each modulo result corresponds to a non-faulty data center; and determines the data center corresponding to the modulo result as the target data center to which the user belongs.
[0208] It should be noted that modulo operation is a common operation in mathematics, which is used to calculate the remainder after dividing one number by another number.
[0209] By taking the modulus of the user ID, users can be evenly distributed to different data centers.
[0210] Basic concepts:
[0211] User ID: Assume that each user has a unique ID, usually an integer.
[0212] Modulo operation: By performing a modulo operation on the user ID (eg user_id%n), the user ID can be assigned to n different groups or buckets. n is a positive integer, which represents the modulo number in the embodiment of the present invention.
[0213] The modulo result will be an integer between 0 and n-1.
[0214] Example:
[0215] Assume there are 1,000 users, each with a unique user ID, and you want to assign these users to 5 different data centers. You can use user_id%5 to achieve this. In this way, each user ID will be assigned to a data center based on the result of its modulo.
[0216] For example:
[0217] User ID: 1001, 1001%5=1, assigned to data center 1.
[0218] User ID: 1023, 1023%5=3, assigned to data center 3.
[0219] Step S2034: In response to the target user initiating a transaction using the sub-domain name, the sub-domain name is resolved to the second address of the target data center using the GTM domain name server.
[0220] Step S2035: Access the application cluster corresponding to the target data center based on the second address to access the target data center.
[0221] In one embodiment, a switchback instruction for instructing the failed center to return to normal is received; and the target user is switched back to the restored data center.
[0222] Based on the above-mentioned embodiment of the present invention, a method for automatic switching of multiple active data centers is disclosed. In this solution, a monitoring logic is added on the basis of the existing application system to monitor whether a switching instruction and a fault center identifier are issued from the disaster recovery tool system. If the switching logic is triggered, the data center accessed by the user is automatically switched, thereby realizing automatic switching of multiple active data centers without changing the application system architecture.
[0223] Based on the above embodiment of the present invention, a method for automatically switching multiple active data centers is disclosed, such as Figure 4 As shown, it is a structural diagram of an automatic switching device of a multi-active data center disclosed in an embodiment of the present invention. The device is applied to a disaster recovery tool system, and the disaster recovery tool system is communicated with the application system, including: an acquisition unit 401, a comparison unit 402, a weighting unit 403 and a sending unit 404.
[0224] The acquisition unit 401 is used to acquire the indicator values of multiple preset monitoring indicators in real time for each data center in the multi-active mode; wherein each monitoring indicator is set with a corresponding indicator threshold and indicator weight.
[0225] The comparison unit 402 is used to determine, for each monitoring indicator, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, as the target monitoring indicator, and determine the initial score of the target monitoring indicator based on the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold.
[0226] In one embodiment, the comparison unit 402 for determining the initial score of the target monitoring indicator according to the indicator value of the target monitoring indicator exceeding the range of the corresponding indicator threshold is specifically used to:
[0227] Compare the indicator value of the target monitoring indicator with the corresponding indicator threshold to obtain the difference between the indicator value and the corresponding indicator threshold; determine the difference range in which the difference lies, and based on the difference range, find the corresponding initial score in the preset score mapping table.
[0228] The weighting unit 403 is used to generate a total score and update the indicator weight corresponding to each target monitoring indicator based on a dynamic weighting algorithm, an initial score corresponding to each target monitoring indicator and an indicator weight corresponding to each target monitoring indicator.
[0229] The sending unit 404 is used to determine that the data center is a fault center if the total score reaches a preset score threshold, and send a switching instruction and an identifier of the fault center to the application system, so that the application system determines the target user accessing the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
[0230] In one embodiment, the device further comprises:
[0231] The updating unit is used to obtain historical operation and maintenance data; for each monitoring indicator, based on the dynamic baseline algorithm and the historical operation and maintenance data, the indicator threshold corresponding to the monitoring indicator is updated.
[0232] In one embodiment, the device further comprises:
[0233] The switchback instruction sending unit is used to determine that the faulty center has returned to normal when the total score corresponding to the faulty center is monitored to be less than the score threshold, and send a switchback instruction to the application system so that the application system switches the target user back to the data center after the restoration.
[0234] Based on the above-mentioned embodiment of the present invention, an automatic switching device for multiple active data centers is disclosed. In this solution, a disaster recovery tool system is used to determine the total score of the data center. When a disaster is determined to have occurred based on the total score, a switching instruction and a fault center identifier are sent to the application system to trigger the switching logic of the application system and automatically switch the data center accessed by the user, thereby realizing automatic switching of multiple active data centers without changing the application system architecture.
[0235] Based on the above embodiment of the present invention, a method for automatically switching multiple active data centers is disclosed, such as Figure 5 As shown, it is a structural diagram of another automatic switching device of a multi-active data center disclosed in an embodiment of the present invention. The device is applied to an application system, and the application system is communicated with a disaster recovery tool system, and includes: a receiving unit 501, a determining unit 502 and a switching unit 503.
[0236] The receiving unit 501 is used to receive the switching instruction and the identifier of the fault center sent by the disaster recovery tool system.
[0237] The determining unit 502 is used to determine a target user who accesses the fault center according to the identifier of the fault center.
[0238] The switching unit 503 is used to switch the target user from the fault center to any other data center in the multi-active mode based on the switching instruction.
[0239] In one embodiment, the switching unit 503 is specifically configured to:
[0240] Using the GTM domain name server, the default domain name is randomly resolved to the address corresponding to any data center in the multi-active mode outside the fault center to obtain the first address; the default domain name is entered by the target user during the first login operation;
[0241] Receive the first address returned by the GTM domain name server, and access the application cluster corresponding to the corresponding data center according to the first address;
[0242] Based on the preset user allocation strategy, the application cluster determines the target data center to which the user belongs from various data centers outside the fault center, and returns the subdomain name of the target data center to the client;
[0243] In response to the target user initiating a transaction using the sub-domain name, using the GTM domain name server to resolve the sub-domain name to a second address of the target data center;
[0244] The application cluster corresponding to the target data center is accessed based on the second address to access the target data center.
[0245] The switching unit 503 for determining the target data center to which the user belongs from various data centers other than the fault center based on the preset user allocation strategy of the application cluster is specifically used for:
[0246] The application cluster obtains the user ID of the user;
[0247] Count the number of data centers that are not faulty and obtain the modulus number;
[0248] Perform a modulo operation on the user ID based on the modulo number to obtain a modulo result; each modulo result corresponds to a non-faulty data center;
[0249] The data center corresponding to the modulo result is determined as the target data center to which the user belongs.
[0250] In one embodiment, the device further comprises:
[0251] The switchback unit is used to receive a switchback instruction for instructing the failed center to return to normal; and switch the target user back to the data center after the data center returns to normal.
[0252] Based on the above-mentioned embodiment of the present invention, an automatic switching device for multiple active data centers is disclosed. In this solution, a monitoring logic is added on the basis of the existing application system to monitor whether a switching instruction and a fault center identifier are issued from the disaster recovery tool system. If the switching logic is triggered, the data center accessed by the user is automatically switched, thereby realizing automatic switching of multiple active data centers without changing the application system architecture.
[0253] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0254] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0255] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for automatic switching of multiple active data centers, characterized in that: Applied to a disaster recovery tool system, the disaster recovery tool system is communicatively connected with an application system, and the method comprises: For each data center in the multi-active mode, the indicator values of multiple preset monitoring indicators are obtained in real time; wherein each of the monitoring indicators is set with a corresponding indicator threshold and indicator weight; For each of the monitoring indicators, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, it is determined as the target monitoring indicator, and according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold, the initial score of the target monitoring indicator is determined; Based on the dynamic weighting algorithm, the initial score corresponding to each of the target monitoring indicators and the indicator weight corresponding to each of the target monitoring indicators, a total score is generated and the indicator weight corresponding to each of the target monitoring indicators is updated; If the total score reaches a preset score threshold, the data center is determined to be a fault center, and a switching instruction and the identifier of the fault center are sent to the application system, so that the application system determines the target user accessing the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
2. The method according to claim 1, characterized in that: The method further comprises: Obtain historical operation and maintenance data; For each of the monitoring indicators, based on the dynamic baseline algorithm and the historical operation and maintenance data, the indicator threshold corresponding to the monitoring indicator is updated.
3. The method according to claim 1, characterized in that: The method further comprises: When it is monitored that the total score corresponding to the faulty center is less than the score threshold, it is determined that the faulty center has returned to normal, and a switchback instruction is sent to the application system so that the application system switches the target user back to the data center after it has returned to normal.
4. The method according to any one of claims 1 to 3, characterized in that: The determining, according to the indicator value of the target monitoring indicator exceeding the range of the corresponding indicator threshold, an initial score of the target monitoring indicator comprises: Compare the indicator value of the target monitoring indicator with the corresponding indicator threshold to obtain the difference between the indicator value and the corresponding indicator threshold; A difference range in which the difference value is located is determined, and based on the difference range, a corresponding initial score is searched in a preset score mapping table.
5. An automatic switching method for multiple active data centers, characterized in that: Applied to an application system, the application system is communicatively connected with a disaster recovery tool system, the method comprising: Receiving the switching instruction and the identifier of the fault center sent by the disaster recovery tool system; Determining a target user who accesses the fault center according to the identifier of the fault center; Based on the switching instruction, the target user is switched from the fault center to any other data center in the multi-active mode.
6. The method according to claim 5, characterized in that The application system includes a plurality of application clusters, each of which corresponds to one of the data centers, and the switching instruction based on which the target user is switched from the fault center to any other data center in the multi-active mode includes: Using the GTM domain name server, randomly resolving the default domain name to an address corresponding to any data center in the multi-active mode other than the failure center to obtain a first address; the default domain name is input by the target user during the first login operation; Receive the first address returned by the GTM domain name server, and access the application cluster corresponding to the corresponding data center according to the first address; The application cluster determines the target data center to which the user belongs from each of the data centers other than the failure center based on a preset user allocation strategy, and returns the subdomain name of the target data center to the client; In response to the target user initiating a transaction using the sub-domain name, resolving the sub-domain name to a second address of the target data center using the GTM domain name server; The application cluster corresponding to the target data center is accessed based on the second address to access the target data center.
7. The method according to claim 6, characterized in that The application cluster determines the target data center to which the user belongs from each of the data centers other than the failure center based on a preset user allocation strategy, including: The application cluster obtains the user ID of the user; Counting the number of the data centers that are not at fault, and obtaining a modulo number; Performing a modulo operation on the user ID based on the modulo number to obtain a modulo result; each of the modulo results corresponds to a non-faulty data center; The data center corresponding to the modulo result is determined as the target data center to which the user belongs.
8. The method according to any one of claims 5 to 7, characterized in that: The method further comprises: receiving a switchback instruction for instructing the faulty center to return to normal; The target user is switched back to the data center after it returns to normal.
9. An automatic switching device for a multi-active data center, characterized in that: Applied to a disaster recovery tool system, the disaster recovery tool system is communicatively connected with an application system, and the device comprises: An acquisition unit, used to acquire the indicator values of a plurality of preset monitoring indicators in real time for each data center in the multi-active mode; wherein each of the monitoring indicators is provided with a corresponding indicator threshold and indicator weight; A comparison unit, for determining, for each monitoring indicator, if the indicator value of the monitoring indicator is greater than the corresponding indicator threshold, the target monitoring indicator, and determining an initial score of the target monitoring indicator according to the range in which the indicator value of the target monitoring indicator exceeds the corresponding indicator threshold; A weighting unit, configured to generate a total score and update the indicator weight corresponding to each target monitoring indicator based on a dynamic weighting algorithm, the initial score corresponding to each target monitoring indicator and the indicator weight corresponding to each target monitoring indicator; A sending unit is used to determine that the data center is a fault center if the total score reaches a preset score threshold, and send a switching instruction and an identifier of the fault center to the application system, so that the application system determines a target user who accesses the fault center according to the identifier of the fault center, and switches the target user from the fault center to any other data center based on the switching instruction.
10. An automatic switching device for a multi-active data center, characterized in that: Applied to an application system, the application system is communicatively connected with a disaster recovery tool system, and the device comprises: A receiving unit, configured to receive a switching instruction and an identifier of a fault center sent by the disaster recovery tool system; A determination unit, configured to determine a target user accessing the fault center according to an identifier of the fault center; A switching unit is used to switch the target user from the fault center to any other data center in the multi-active mode based on the switching instruction.