Cluster switching method, system, device, terminal, server and storage medium

The cluster switching server collects component status and automatically changes the connection configuration, which solves the problems of cumbersome cluster switching and high labor costs in the existing technology, realizes fast, automatic and imperceptible switching of the cluster, and improves the high availability of the business.

CN113765690BActive Publication Date: 2024-10-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110019669.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-07
Publication Date
2024-10-22
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

The existing cluster switching solution is cumbersome, has high labor costs, and cannot automatically detect faults and switch to the backup cluster in a timely manner, resulting in poor business feasibility.

Method used

The cluster switching server collects the status of each component to determine whether to perform the switching task, obtains the business to be switched and the target cluster connection information, and automatically changes the cluster connection configuration, so that the cluster switching client switches to the target cluster when it monitors the configuration change.

Benefits of technology

It realizes automatic and timely sensing of cluster faults and rapid switchover, simplifies the switchover process, reduces labor costs, and improves the high availability and feasibility of the business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113765690B_ABST
    Figure CN113765690B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a cluster switching method, system, device, terminal, server and storage medium. The method is applied to a cluster switching server connected to at least two clusters, and the method may include: collecting the component status of each component in each cluster respectively, and judging whether to execute the corresponding cluster switching task according to the collected component status; if so, obtaining the to-be-switched service corresponding to the cluster switching task, and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster; changing the cluster connection configuration of the to-be-switched service according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the to-be-switched service to the target cluster according to the acquired changed cluster connection configuration. The technical solution of the embodiment of the present invention can simplify the implementation process of cluster switching, and achieve the effect of fast, automatic and imperceptible switching of the cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer applications, and in particular to a cluster switching method, system, device, terminal, server and storage medium. Background Art

[0002] In the wave of big data, distributed column storage cluster has become a popular cluster in recent years, and it is also one of the core open source projects of Apache. However, if we want to better apply this cluster to enterprises, there are still many areas that need to be improved.

[0003] For example, stability is one of the important attributes of a cluster, which can ensure high availability of the business. Enterprises usually need to ensure that the service level agreement (SLA) is above 99.95%. For this reason, existing clusters are usually set as primary clusters and backup clusters to achieve high availability. Specifically, when the database administrator (Database Administrator, DBA) finds that there is a cluster switching requirement to switch the business to be switched from the primary cluster to the backup cluster, he needs to actively contact the business party to which the business to be switched belongs, so that the business party can manually implement the cluster switching process of the business to be switched.

[0004] In the process of implementing the present invention, the inventors found that the prior art has the following technical problems: in actual applications, the number of services to be switched connected to cluster communication is usually more than several hundred, and the implementation process of the above cluster switching solution is relatively cumbersome and has poor feasibility. Summary of the invention

[0005] The embodiments of the present invention provide a cluster switching method, system, device, terminal, server and storage medium, which solve the problem that the cluster switching process is relatively complicated.

[0006] In a first aspect, an embodiment of the present invention provides a cluster switching method, which can be applied to a cluster switching server, where the cluster switching server is connected to at least two clusters for communication, and the method may include:

[0007] Collect the component status of each component in each cluster respectively, and determine whether to execute the corresponding cluster switching task according to the collected component status;

[0008] If yes, then obtaining the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster;

[0009] The cluster connection configuration of the service to be switched is changed according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration.

[0010] In a second aspect, an embodiment of the present invention further provides a cluster switching method, which is applied to a cluster switching client and may include:

[0011] When a change trigger event of a cluster connection configuration change of a service to be switched belonging to a cluster switching client is monitored, a changed cluster connection configuration corresponding to the change trigger event is obtained from the cluster switching server;

[0012] Create a target connection according to the changed cluster connection configuration, and switch the service to be switched to the target cluster corresponding to the target connection according to the target connection;

[0013] Among them, the changed cluster connection configuration includes the changed configuration of the cluster connection configuration before the change made by the cluster switching server according to the cluster connection information, and the cluster connection information may include information determined by the cluster switching server based on the component status of each component in at least two clusters that are communicated with the cluster switching server.

[0014] In a third aspect, an embodiment of the present invention further provides a cluster switching system, which may include a cluster switching server and a cluster switching client, wherein the cluster switching server is communicatively connected to at least two clusters;

[0015] The cluster switching server is used to collect the component status of the components in each cluster respectively, and when determining to execute the corresponding cluster switching task according to the collected component status, obtain the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster, and change the cluster connection configuration of the to-be-switched service according to the cluster connection information;

[0016] The cluster switching client is used to create a target connection according to the changed cluster connection configuration corresponding to the change trigger event obtained from the cluster switching server when a change trigger event of the cluster connection configuration change is monitored, and switch the connection of the service to be switched to the target cluster according to the target connection.

[0017] In a fourth aspect, an embodiment of the present invention further provides a cluster switching device, which is configured at a cluster switching server, and the cluster switching server is communicatively connected to at least two clusters, and may include:

[0018] The task judgment module is used to collect the component status of each component in each cluster respectively, and judge whether to execute the corresponding cluster switching task according to the collected component status;

[0019] An information acquisition module, used for acquiring the to-be-switched service corresponding to the cluster switching task and cluster connection information of the target cluster corresponding to the cluster switching task in each cluster;

[0020] The first cluster switching module is used to change the cluster connection configuration of the to-be-switched service according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the to-be-switched service to the target cluster according to the acquired changed cluster connection configuration.

[0021] In a fifth aspect, an embodiment of the present invention further provides a cluster switching device, which is configured on a cluster switching client and may include:

[0022] The configuration acquisition module is used to acquire the changed cluster connection configuration corresponding to the change triggering event from the cluster switching server when monitoring the change triggering event of the cluster connection configuration change of the to-be-switched service belonging to the cluster switching client;

[0023] A second cluster switching module is used to create a target connection according to the changed cluster connection configuration, and switch the service to be switched to a target cluster corresponding to the target connection according to the target connection;

[0024] Among them, the changed cluster connection configuration includes the changed configuration of the cluster connection configuration before the change made by the cluster switching server according to the cluster connection information, and the cluster connection information may include information determined by the cluster switching server based on the component status of each component in at least two clusters that are communicated with the cluster switching server.

[0025] In a sixth aspect, an embodiment of the present invention further provides a server, which may include:

[0026] one or more processors;

[0027] A memory for storing one or more programs;

[0028] When one or more programs are executed by one or more processors, the one or more processors implement the cluster switching method provided by the first embodiment or the second embodiment of the present invention.

[0029] In a seventh aspect, an embodiment of the present invention further provides a terminal, which may include:

[0030] one or more processors;

[0031] A memory for storing one or more programs;

[0032] When one or more programs are executed by one or more processors, the one or more processors implement the cluster switching method provided in the third embodiment of the present invention.

[0033] In an eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the cluster switching method provided by any embodiment of the present invention is implemented.

[0034] According to the technical solution of the embodiment of the present invention, the cluster switching server collects the component status of each component in each cluster that is connected to the cluster switching server for communication, and determines whether to execute the corresponding cluster switching task based on the collection results, thereby solving the problem of high labor cost caused by the need for human supervision to monitor whether the cluster fails, and achieving the effect of automatic and timely perception when a cluster fails; when it is necessary to execute the task to be switched corresponding to the component status, the service to be switched that matches the task to be switched and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster can be obtained first, and then the cluster connection configuration of the service to be switched can be changed according to the cluster connection information. In this way, when the cluster switching client monitors the cluster connection configuration change, it can switch the service to be switched to the target cluster according to the changed cluster connection configuration obtained from the cluster switching server, thereby solving the problem of poor feasibility caused by the need for the business party to manually change the cluster connection configuration and restart the business client. The above technical solution automatically and timely senses the health status of the cluster, and automatically and quickly switches the service to be switched to the target cluster when a cluster connected to the service to be switched fails. This cluster switching process does not involve any manual process, thereby simplifying the implementation process of cluster switching and achieving the effect of fast, automatic and imperceptible switching of the cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 is a flow chart of a cluster switching method in Embodiment 1 of the present invention;

[0036] Figure 2 is a schematic diagram of a health perception module in a cluster switching method in Embodiment 1 of the present invention;

[0037] Figure 3 is a flow chart of a cluster switching method in Embodiment 2 of the present invention;

[0038] Figure 4 is a schematic diagram of a policy storage module in a cluster switching method in Embodiment 2 of the present invention;

[0039] Figure 5 is a schematic diagram of a policy management module in a cluster switching method in Embodiment 2 of the present invention;

[0040] Figure 6 is a flow chart of a cluster switching method in Embodiment 3 of the present invention;

[0041] Figure 7 is a schematic diagram of a cluster switching client in a cluster switching method in Embodiment 3 of the present invention;

[0042] Figure 8 It is a schematic diagram of the cooperation between various parts in a cluster switching method in Embodiment 3 of the present invention;

[0043] Fig. 9 is a structural block diagram of a cluster switching system in Embodiment 4 of the present invention;

[0044] Fig.10 is a structural block diagram of a cluster switching device in Embodiment 5 of the present invention;

[0045] Fig.11 is a structural block diagram of a cluster switching device in Embodiment 6 of the present invention;

[0046] Fig.12 It is a structural diagram of a server in Embodiment 7 of the present invention;

[0047] Fig.13 It is a structural diagram of a terminal in Embodiment 8 of the present invention. DETAILED DESCRIPTION

[0048] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It is also necessary to explain that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0049] Before introducing the embodiment of the present invention, the application scenario of the embodiment of the present invention is first exemplified: As mentioned in the background technology, in order to ensure the high availability of the cluster, the cluster is usually set to a main cluster and a backup cluster with exactly the same cluster structure. In actual applications, the cluster currently communicating with the business client can be used as the main cluster, and the other cluster can be used as the backup cluster. The business client can read and write data from the main cluster. Of course, the main cluster and the backup cluster are relative concepts. When the main cluster fails and the business client needs to communicate with the backup cluster to read data, the main cluster and the backup cluster are exchanged with each other.

[0050] It should be noted that when the cluster switching solution in the prior art is used to switch the cluster, it requires the DBA to proactively contact the business party to which the business client belongs after proactively discovering the fault, so that the business party can manually change the cluster connection configuration and manually restart the business client. The cluster connection configuration can be some configurations set to achieve the communication connection between the business client and the cluster. Obviously, the cluster switching solution cannot automatically and timely sense the failure of the main cluster and cannot automatically switch to the backup cluster, and it requires human duty to monitor whether the main cluster fails, which has a high labor cost; the processing cycle from the DBA discovering the failure of the main cluster to notifying the business party to perform the corresponding operation is too long, which is obviously unacceptable to the business party for those businesses with a high degree of importance linked to finance and transactions, which is likely to cause significant losses; in addition, for large-scale clusters, such as those with hundreds or even thousands of businesses, this cluster implementation solution is difficult to implement.

[0051] In order to solve the above problems, the inventors have proposed the cluster switching method described in the following embodiments of the present invention based on a careful study of the prior art. The cluster in the cluster switching method can be a cluster under various cluster structures, such as a distributed cluster, a non-relational cluster (Not Only SQL, NoSQL), a distributed NoSQL, Hbase, etc., which are not specifically limited here. The number of clusters can be at least two, which can include a primary cluster and a backup cluster, wherein the primary cluster can be the cluster where the business is currently located, and the remaining clusters can be called backup clusters, that is, the target cluster described in the embodiments of the present invention is a cluster in the clusters where the business is not currently located.

[0052] Embodiment 1

[0053] Figure 1 This is a flow chart of a cluster switching method applicable to a cluster switching server provided in Embodiment 1 of the present invention, and the cluster switching server can be connected to at least two clusters for communication. This embodiment can be applied to the case of automatically sensing cluster failures and automatically performing cluster switching. The method can be executed by a cluster switching device provided in an embodiment of the present invention, and the device can be implemented by software and / or hardware, and the device can be configured on a cluster switching server, and the server can be integrated on a server.

[0054] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:

[0055] S110 , respectively collecting the component status of each component in each cluster, and determining whether to execute a corresponding cluster switching task according to the collected component status.

[0056] Each cluster may include multiple components, and the component may be one of the components of the cluster. In practical applications, the component may be a master node (Master) that plays a leading role as a core node, a slave node (Slave) that plays an execution role as a working node, a data block, data area performance, etc., which are not specifically limited here. The component status of each component in each cluster is collected separately, and the component status can present the health status of the corresponding component and / or the entire cluster, such as whether the master node is down, whether the slave node is down, whether the cluster has lost data blocks, whether the data area in the cluster is offline, whether the cluster performance has declined, etc.

[0057] Further, according to the collected status of each component in each cluster, it can be determined whether the cluster where the business is currently located is in a healthy state, and whether the cluster where the business is not currently located is in a healthy state. It should be noted that, in order to simplify the description, the cluster where the business is currently located is referred to as the main cluster, and the cluster where the business is not currently located is referred to as the standby cluster. In practical applications, optionally, the number of main clusters can be one, which is to concentrate all businesses in one cluster for easy management; the number of standby clusters can be at least one, which is to ensure that there must be a standby cluster for switching when the main cluster fails. Of course, under normal circumstances, one standby cluster is sufficient for application. On this basis, according to the health status of each cluster, it can be determined whether to execute the corresponding cluster switching task. The cluster switching task can present the business to be switched with the cluster switching requirement, the cluster to which the business to be switched is to be switched, and so on. Exemplarily, if there is a fault in the main cluster, the corresponding cluster switching task can be executed; if there is a fault in the standby cluster, only a prompt message can be issued, and there is no need to execute the cluster switching task.

[0058] S120 : If yes, obtain the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster.

[0059] If it is determined that the corresponding cluster switching task needs to be executed according to the status of each component, the business to be switched corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster can be obtained. The cluster switching task is a switching task that matches the status of each component, because the cluster switching tasks corresponding to different component states may be different. Specifically, the business to be switched can be a business that has a switching demand among the businesses connected to the main cluster, or a business in which the storage performance of the main cluster fails, such as a business whose storage performance is affected by reasons such as the downtime of the master node, the downtime of the slave node, the loss of data blocks, the offline of the data area, and the degradation of cluster performance. The target cluster is the cluster to which the business to be switched in each cluster is to be switched, or the cluster in which the storage performance of the business to be switched does not have any failure. The cluster connection information is the connection-related information required to successfully connect the business to be switched to the target cluster, such as the URL, user name, password, etc. of the target cluster. The business to be switched can be connected to the target cluster according to the cluster connection information.

[0060] S130 . Change the cluster connection configuration of the service to be switched according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration.

[0061] The cluster connection configuration stores the cluster connection information of the cluster (i.e., the main cluster) to which the service to be switched is currently connected, which means that before the cluster connection configuration of the service to be switched is changed according to the cluster connection information, the cluster connection configuration stores the connection information of the main cluster. In order to switch the service to be switched from the main cluster to the target cluster, the cluster connection configuration of the service to be switched can be changed according to the cluster connection information of the target cluster. In this way, the connection configuration of the main cluster in the cluster connection configuration is changed to the connection configuration pointing to the target cluster, and the main cluster is also the cluster connected to the service to be switched before the cluster connection configuration is changed according to the cluster connection information.

[0062] After the cluster switching server changes the cluster connection configuration, for the cluster connection client that matches the cluster connection server and can be set in the business client, the business client can be the client to which the business to be switched belongs. The cluster connection client can monitor the cluster connection configuration of the business to be switched in the cluster switching server, and when it monitors that it has changed, it can switch the business to be switched to the target cluster according to the changed cluster connection configuration obtained from the cluster switching server. Specifically, it can create a target connection according to the changed cluster connection configuration, and switch the business to be switched to the target cluster corresponding to the target connection according to the target connection. The process of creating the target connection can be understood as the restart process of the business client, thereby solving the problem of cumbersome operations caused by the business party manually changing the cluster connection configuration and manually restarting the business client.

[0063] According to the technical solution of the embodiment of the present invention, the cluster switching server collects the component status of each component in each cluster that is connected to the cluster switching server for communication, and determines whether to execute the corresponding cluster switching task based on the collection results, thereby solving the problem of high labor cost caused by the need for human supervision to monitor whether the cluster fails, and achieving the effect of automatic and timely perception when a cluster fails; when it is necessary to execute the task to be switched corresponding to the component status, the service to be switched that matches the task to be switched and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster can be obtained first, and then the cluster connection configuration of the service to be switched can be changed according to the cluster connection information. In this way, when the cluster switching client monitors the cluster connection configuration change, it can switch the service to be switched to the target cluster according to the changed cluster connection configuration obtained from the cluster switching server, thereby solving the problem of poor feasibility caused by the need for the business party to manually change the cluster connection configuration and restart the business client. The above technical solution automatically and timely senses the health status of the cluster, and automatically and quickly switches the service to be switched to the target cluster when a cluster connected to the service to be switched fails. This cluster switching process does not involve any manual process, thereby simplifying the implementation process of cluster switching and achieving the effect of fast, automatic and imperceptible switching of the cluster.

[0064] On this basis, an optional technical solution is to collect the component status of each component in each cluster respectively, which may specifically include: when a startup trigger event of cluster startup is detected, the corresponding collector is pulled up by starting the scheduler corresponding to the startup trigger event, and the component status of each component in each cluster is collected based on the pulled up collector. Among them, the startup trigger event is an event triggered after the cluster is started, and the scheduler and collector can be considered as a thread in a computer program. In actual applications, when a startup trigger event is detected, the thread where the corresponding scheduler is located can be started first, so as to call the thread where the corresponding collector is located based on the thread where the scheduler is located, or to pull up the corresponding collector based on the started scheduler, and then collect the component status of each component in each cluster according to the thread where the collector is located, or the pulled up collector.

[0065] An optional technical solution, respectively collecting the component status of each component in each cluster, specifically including: respectively collecting at least one of the main service status of the main service and the data block status of the data block in the distributed file system in each cluster, and the regional status of the data area in each cluster. Among them, the distributed file system (HDFS) serves as the underlying storage base of the cluster, which can store persistent data blocks, which plays a vital role in the health status of the cluster. Therefore, the main service status of the main service in the HDFS can be monitored to determine whether the main service can work normally. When storing data based on HDFS, the server nodes therein may cause temporary data block loss due to hardware failure, so the data block status of the data block in the HDFS can be monitored to determine whether there is a problem of data block loss. In addition, if the data area in the cluster is in the rit state, it may cause the data area to be unavailable and unable to provide external services, so the regional status of the data area of ​​each cluster can be monitored to determine whether the business party can read data from the data area. Specifically, the rit state is the intermediate state of the cluster (i.e., database). Taking NoSQL as an example, it is a distributed database, and each data area under it is arranged on the cluster server corresponding to the data area. When the rit on the data area is not on the cluster server for some reason, the business party at this time is invisible to the data area, that is, the business party cannot read any data from the data area. The above-mentioned component states are situations that are more likely to affect the health status of the cluster in actual applications. The effective collection of these component configurations is conducive to accurately judging the health status of the cluster. Of course, the above-mentioned component states are only exemplary descriptions of the component states that can be collected. The remaining component states that can present the health status of the cluster are still within the collection scope and are not specifically limited here.

[0066] In order to better understand the component status collection process, the following is an exemplary description of it with reference to a specific example. Figure 2 As shown, the component status collection process can be implemented based on a health perception module (healthMonitor) set in the cluster switching server. The health perception module can be software and / or hardware running in each cluster. Specifically, after the health perception module detects that the cluster is started, it starts the collector by starting the scheduler, and collects the status of each component of each cluster based on the pulled collector at a preset time interval, such as whether the main service of HDFS is down, whether the data block of HDFS is lost, and the data area in the cluster ( Figure 2 Taking the cluster as NoSQL as an example for demonstration) whether it is unavailable, etc. can present the component status of the cluster's health status. In actual applications, the above preset time interval can be 3 seconds, 5 seconds, 7 seconds, etc., thereby achieving the effect of automatic and timely perception when a cluster failure occurs. Further, for the component status collected by the health perception module, it can assemble these component states into pre-set structured data and send them to the policy storage module (PolicyStore), the policy management module (PolicyServer), etc., so as to execute subsequent steps.

[0067] Embodiment 2

[0068] Figure 3 It is a flow chart of a cluster switching method provided in the second embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, whether to execute the corresponding cluster switching task is determined according to the collected status of each component, which may specifically include: determining whether the collected status of each component satisfies the pre-configured cluster switching strategy, the cluster switching strategy includes a single-service switching strategy, a local service switching strategy and / or a full-service switching strategy; if so, according to the target switching strategy corresponding to the component status in each cluster switching strategy, determine to execute the cluster switching task corresponding to the target switching strategy. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.

[0069] See also Figure 3 The method of this embodiment may specifically include the following steps:

[0070] S210 , respectively collect the component status of each component in each cluster, and determine whether the collected component status satisfies a pre-configured cluster switching strategy, where the cluster switching strategy includes a single service switching strategy, a local service switching strategy, and / or a full service switching strategy.

[0071] Among them, the cluster switching strategy is a pre-set strategy for determining the corresponding cluster switching task according to the component state. The cluster switching strategy can include a single service switching strategy, a local service switching strategy, a full service switching strategy, etc. This is because when the main cluster fails, it may be a single, partial or all components in the main cluster that fail, that is, the performance of the main cluster is degraded, partially unavailable or completely failed. Therefore, various cluster switching strategies can be pre-configured according to different failure situations. Specifically, the single service switching strategy is a strategy that determines that only one service among the services currently connected to the main cluster needs to be clustered according to the status of each component. Correspondingly, the local switching strategy is a strategy that determines that at least two but not all services among the services currently connected to the main cluster need to be clustered according to the status of each component. The full switching strategy is a strategy that determines that all services currently connected to the main cluster need to be clustered according to the status of each component. Since the cluster switching strategy can be understood as the corresponding relationship between the component state and the cluster switching task, it can be determined whether the collected component states meet the cluster switching strategy by judging whether there is a component state corresponding to the collected component state in the cluster switching strategy, specifically, whether it meets one of the cluster switching strategies.

[0072] S220: If yes, determine to execute a cluster switching task corresponding to the target switching strategy according to the target switching strategy corresponding to the component state in each cluster switching strategy.

[0073] If the collected component states satisfy the cluster switching strategy, a target switching strategy matching the component state can be selected from the cluster switching strategies, and the target switching strategy can indicate which service is to be switched, to which cluster the service is to be switched, etc. Then, the cluster switching task corresponding to the target switching strategy can be determined and executed according to the target switching strategy.

[0074] S230: After determining the cluster switching task, obtain the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster.

[0075] S240: Change the cluster connection configuration of the service to be switched according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the service to be switched to the target cluster according to the obtained changed cluster connection configuration.

[0076] The technical solution of the embodiment of the present invention determines whether the collected status of each component satisfies a pre-configured cluster switching strategy, and determines to execute a cluster switching task that matches a target switching strategy corresponding to each component status in each cluster switching strategy when the judgment result is yes. It compares the status of each component with the pre-configured cluster switching strategy, thereby achieving the effect of convenient, fast and accurate determination of the cluster switching task.

[0077] An optional technical solution, collecting the component status of each component in each cluster separately, may include: collecting the component status of each component in each cluster separately based on a preset time interval; correspondingly, judging whether the collected component status satisfies the pre-configured cluster switching strategy, may include: taking the component status collected in each preset time interval as a group of component status, judging whether each group of component status collected in the preset time window satisfies the same pre-configured cluster switching strategy. The advantage of such a setting is that it avoids the subsequent cluster switching strategy judgment error due to a certain erroneous collection or the occurrence of some rare special circumstances. Exemplarily, assuming that the preset time interval is 5 seconds, the preset time window is 30 seconds, and the 6 groups of component status collected within 30 seconds all meet the local business switching strategy, it is considered that each group of component status meets the local business switching strategy, and at this time the main cluster is really faulty.

[0078] An optional technical solution, after collecting the component status of each component in each cluster respectively, the cluster switching method may also include: uploading the collected component status to a pre-set data storage center; correspondingly, judging whether the collected component status meets the pre-configured cluster switching strategy may include: when an update trigger event of component status update in the data storage center is monitored, obtaining the pre-configured cluster switching strategy and the component status corresponding to the update trigger event from the data storage center, and judging whether the component status corresponding to the update trigger event meets the cluster switching strategy. That is, the collected component status and the pre-configured cluster switching strategy are both stored in the data storage center, and before the subsequent step of judging whether the cluster switching strategy is met, the updated / newly added component status and cluster switching strategy are first obtained from the data storage center. The advantage of such a setting is that the data storage center can realize persistent storage of data, which means that even if the server where the cluster switching server is located suddenly loses power, the collected component status and the pre-configured cluster switching strategy will not be lost because they have been uploaded to the data storage center, thereby ensuring the stability of the cluster switching server. In actual applications, the data storage center can be Zookeeper (a distributed application coordination service), MySQL, etc.

[0079] In order to better understand the cluster switching task determination process, the following is an exemplary description of it with reference to a specific example. Figure 4 and Figure 5 As shown, the determination process of the cluster switching task can be realized by the cooperation of the policy storage module (PolicyStore) and the policy management module (PolicyServer) set in the cluster switching server. Specifically, for the policy storage module, the status of each component reported by the health perception module, the cluster switching policy pre-configured by the policy management module, the cluster connection information of each cluster, the cluster currently connected to the business, and other data can be stored, and these data can be persistently stored in the data storage center. For the policy management module, it can receive the cluster switching policy configured by the DBA through the policy configurator, trigger the cluster switching task for each component status that meets the cluster switching policy through the policy trigger, and change the cluster connection configuration in the configuration center from pointing to the main cluster to pointing to the standby cluster according to the triggered cluster switching task, and wait for the cluster switching client (USER API Client) to pull the changed cluster connection configuration from the configuration center.

[0080] Embodiment 3

[0081] Figure 6 This is a flow chart of a cluster switching method applicable to a cluster switching client provided in Embodiment 3 of the present invention. This embodiment is applicable to the case where the cluster switching is automatically implemented by the configuration center according to the acquired changed information. The method can be executed by the cluster switching device provided in the embodiment of the present invention, the device can be implemented by software and / or hardware, the device can be configured on the cluster switching client, and the client can be integrated on various terminals.

[0082] See also Figure 6 The method of the embodiment of the present invention specifically includes the following steps:

[0083] S310. When a change triggering event of a cluster connection configuration change of a to-be-switched service belonging to the cluster switching client is monitored, a changed cluster connection configuration corresponding to the change triggering event is obtained from the cluster switching server, wherein the changed cluster connection configuration includes a configuration after the cluster switching server changes the cluster connection configuration before the change according to cluster connection information, and the cluster connection information includes information determined by the cluster switching server according to component states of each component in at least two clusters that are collected and communicated with the cluster switching server.

[0084] Among them, the cluster switching client can be a client for implementing cluster switching where a service to be switched is located, and the cluster switching clients where different services to be switched are located may be the same or different. The cluster switching client can monitor the cluster connection configuration of the service to be switched associated with the cluster switching client in the cluster switching server, and when it is monitored that there is a change, it can obtain the changed cluster connection configuration of the service to be switched from the cluster switching server. It should be noted that the determination process of the changed cluster connection configuration has been described in detail in Examples 1 and 2, and will not be repeated here.

[0085] S320: Create a target connection according to the changed cluster connection configuration, and switch the service to be switched to the target cluster corresponding to the target connection according to the target connection.

[0086] Among them, the cluster switching client can create a target connection according to the changed cluster connection configuration. The target connection changes the service to be switched from the main cluster to the target cluster, and then switches the service to be switched to the target cluster corresponding to the target connection according to the target connection. The creation process of the target connection can also be understood as the restart process of the service client. By restarting the service client to connect to the target cluster, the service client can be the client for realizing the service function where the service to be switched is located, and the cluster switching client can be configured in the cluster switching client.

[0087] The technical solution of the embodiment of the present invention, when monitoring the change trigger event of the cluster connection configuration change of the to-be-switched service belonging to the cluster switching client, creates a target connection according to the changed cluster connection configuration corresponding to the change trigger event obtained from the cluster switching server, and switches the to-be-switched service to the target cluster corresponding to the target connection according to the target connection. The above technical solution solves the problem that the cluster switching process is relatively cumbersome due to the need for the service party to manually change the cluster connection configuration and manually restart the service client, and achieves the effect of switching the cluster imperceptibly and smoothly.

[0088] On this basis, an optional technical solution is that after switching the service to be switched to the target cluster corresponding to the target connection according to the target connection, the cluster switching method may also include: sending target information through a callback information sending interface, the target information may include at least one of the cluster switching reason, cluster switching strategy, cluster switching occurrence time and cluster switching consumption time, and the target information may be sent by email, SMS, WeChat, etc., which is not specifically limited here. In this way, after receiving the target information, the DBA can promptly eliminate the fault.

[0089] In order to better understand the specific implementation process of the above steps, the cluster switching method of this embodiment is exemplarily described below with reference to a specific example. Figure 7 As shown, the cluster switching client monitors the configuration center in the policy management module based on the configuration listener, and when the cluster connection configuration change of the service to be switched associated with the cluster switching client is monitored, the changed cluster connection configuration is pulled from the configuration center, and a target connection corresponding to the changed cluster connection configuration is created based on the connection manager, and the service to be switched is changed from the main cluster to the standby cluster according to the target connection. Exemplary, Figure 7 The dotted line 3 in FIG. 1 is the initial connection of the service to be switched (ie, the old connection), and the solid line 4 is the target connection of the service to be switched (ie, the new connection).

[0090] In order to better understand the roles of the cluster switching client and the cluster switching server in the cluster switching process, the following is an explanation in combination with the exemplary descriptions in the above embodiments. Figure 8As shown in the figure, the two dotted boxes are the main cluster and the backup cluster of the two column storage clusters. Here, NoSQL is HBase as an example. The zookeeper in the dotted box is a very important component in the column storage cluster. The DBA adds a cluster switching policy (Change Policy) through the service center (ServiceCenter). The policy management module stores the cluster switching policy in the policy storage module (i.e., number 2, download read & write policy / load read & write policy). The health perception module running in the active and standby clusters reports the component status collected by heartbeat to the health storage module; when the cluster switching client (i.e., user client, USER API Client) monitors the cluster connection configuration change in the policy management module, it obtains the changed cluster connection configuration (autoRedirect) from the cluster management module (i.e., number 1, download read & write policy / load read & write policy), and creates a target connection through the cluster connection configuration (i.e., number 3, connect to cluster & get region location & get synchronization data / connect to cluster&get region location&waitsync data), and then reads data from the regional slave node (Region Server) after the connection is created (i.e., number 4, readdata from Region Server), where Region Server is a node in a distributed column cluster that provides services to the outside world, which is equivalent to Slave. The above technical solution achieves high availability of the cluster and low latency of data by automatically sensing cluster failures and automatically and smoothly switching clusters.

[0091] Embodiment 4

[0092] Fig. 9 is a structural block diagram of a cluster switching system provided in Embodiment 4 of the present invention. Fig. 9, the cluster switching system may include a cluster switching server 410 and a cluster switching client 420, wherein the cluster switching server 410 is connected to at least two clusters; the cluster switching server 410 is used to collect the component status of the components in each cluster respectively, and when determining to execute the corresponding cluster switching task according to the collected component status, obtain the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster, and change the cluster connection configuration of the to-be-switched service according to the cluster connection information; the cluster switching client 420 is used to create a target connection according to the changed cluster connection configuration corresponding to the change trigger event obtained from the cluster switching server 410 when monitoring the change trigger event of the cluster connection configuration change, and switch the to-be-switched service to the target cluster according to the target connection. It should be noted that the specific implementation process of the cluster switching server 410 and the cluster switching client 420 and the remaining implementable processes have been described in detail in the above embodiments, and will not be repeated here. The above system solves the problem of the cumbersome cluster switching process through the cooperation between the cluster switching server and the cluster switching client, and achieves the effect of fast, automatic and imperceptible cluster switching.

[0093] Embodiment 5

[0094] Fig.10 This is a structural block diagram of a cluster switching device configured on a cluster switching server provided in Embodiment 5 of the present invention. The cluster switching server is connected to at least two clusters for communication. The device is used to execute the cluster switching method provided in Embodiment 1 or Embodiment 2. The device and the cluster switching method of the above corresponding embodiment belong to the same inventive concept. For details not described in detail in the embodiment of the cluster switching device, please refer to the embodiment of the above cluster switching method. Fig.10 The device may specifically include: a task determination module 510, an information acquisition module 520 and a first cluster switching module 530.

[0095] The task judgment module 510 is used to collect the component status of each component in each cluster, and judge whether to execute the corresponding cluster switching task according to the collected component status;

[0096] The information acquisition module 520 is used to acquire the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster;

[0097] The first cluster switching module 530 is used to change the cluster connection configuration of the service to be switched according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration.

[0098] Optionally, the task judgment module 510 may specifically include: a first component status collection unit, which is used to pull up the corresponding collector by starting the scheduler corresponding to the start trigger event when a start trigger event of cluster startup is monitored, and collect the component status of each component in each cluster based on the started collector.

[0099] Optionally, the task judgment module 510 may specifically include: a second component status collection unit, used to collect at least one of the main service status of the main service and the data block status of the data block in the distributed file system in each cluster, and the area status of the data area in each cluster.

[0100] Optionally, the task judgment module 510 may specifically include: a policy judgment unit, used to determine whether the collected component states meet the pre-configured cluster switching strategy, wherein the cluster switching strategy includes a single business switching strategy, a local business switching strategy, and / or a full business switching strategy; a task determination unit, used to, if so, determine to execute the cluster switching task corresponding to the target switching strategy according to the target switching strategy corresponding to the component state in each cluster switching strategy.

[0101] On this basis, optionally, the task determination module 510 may specifically include: a third component status collection unit, configured to collect the component status of each component in each cluster based on a preset time interval;

[0102] Correspondingly, the strategy judgment unit can be specifically used to: take each component state collected within each preset time interval as a group of component states, and judge whether each group of component states collected within the preset time window satisfies the same pre-configured cluster switching strategy.

[0103] On this basis, optionally, on the basis of the above device, the device may further include: a component state storage module, which is used to upload the collected component states of each component in each cluster to a pre-set data storage center after collecting the component states of each component in each cluster respectively;

[0104] Correspondingly, the policy judgment unit can be specifically used to: when an update trigger event of a component status update in the data storage center is monitored, obtain a pre-configured cluster switching policy and the status of each component corresponding to the update trigger event from the data storage center, and judge whether the status of each component corresponding to the update trigger event satisfies the cluster switching policy.

[0105] Optionally, the cluster includes a distributed cluster, and / or at least two clusters include a primary cluster and a backup cluster. Before the cluster connection configuration of the service to be switched is changed according to the cluster connection information, the cluster connected to the service to be switched is the primary cluster and the target cluster is the backup cluster.

[0106] In the cluster switching device provided in the fifth embodiment of the present invention, the cluster switching server collects the component status of each component in each cluster that is connected to the cluster switching server through the task judgment module, and determines whether to execute the corresponding cluster switching task according to the collection result, thereby solving the problem of high labor cost caused by the need for human duty to monitor whether the cluster fails, and achieving the effect of automatic and timely perception when the cluster fails; through the cooperation of the information acquisition module and the first cluster switching module, when it is necessary to execute the task to be switched corresponding to the component status, the service to be switched matching the task to be switched and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster can be obtained first, and then the cluster connection configuration of the service to be switched can be changed according to the cluster connection information. In this way, when the cluster switching client monitors the cluster connection configuration change, it can switch the service to be switched to the target cluster according to the changed cluster connection configuration obtained from the cluster switching server, thereby solving the problem of poor feasibility caused by the need for the service party to manually change the cluster connection configuration and restart the service client. The above-mentioned device automatically and timely senses the health status of the cluster, and when a cluster connected to the service to be switched fails, automatically and quickly switches the service to be switched to the target cluster. This cluster switching process does not require any manual process, thereby simplifying the implementation process of cluster switching and achieving the effect of fast, automatic and imperceptible switching of the cluster.

[0107] The cluster switching device provided in the embodiment of the present invention can execute the cluster switching method provided in the first embodiment or the second embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0108] It is worth noting that in the above-mentioned embodiment of the cluster switching device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0109] Embodiment 6

[0110] Fig.11This is a structural block diagram of a cluster switching device that can be configured on a cluster switching client provided in Embodiment 6 of the present invention. The device is used to execute the cluster switching method provided in Embodiment 3 above. The device and the cluster switching method in Embodiment 3 above belong to the same inventive concept. For details not described in detail in the embodiment of the cluster switching device, please refer to the embodiment of the cluster switching method above. Fig.11 , the device may specifically include: a configuration acquisition module 610 and a second cluster switching module 620 .

[0111] The configuration acquisition module 610 is used to acquire the changed cluster connection configuration corresponding to the change triggering event from the cluster switching server when monitoring the change triggering event of the cluster connection configuration change of the to-be-switched service belonging to the cluster switching client;

[0112] The second cluster switching module 620 is configured to create a target connection according to the changed cluster connection configuration, and switch the service to be switched to a target cluster corresponding to the target connection according to the target connection.

[0113] Optionally, based on the above device, the device may further include: an information sending module, used to send target information through a callback information sending interface, the target information including at least one of a cluster switching reason, a cluster switching strategy, a cluster switching occurrence time and a cluster switching consuming time.

[0114] The cluster switching device provided in the sixth embodiment of the present invention cooperates with the configuration acquisition module and the second cluster switching module to monitor the change trigger event of the cluster connection configuration change of the service to be switched belonging to the cluster switching client, create a target connection according to the changed cluster connection configuration corresponding to the change trigger event obtained from the cluster switching server, and switch the service to be switched to the target cluster corresponding to the target connection according to the target connection. The above device solves the problem that the cluster switching process is relatively cumbersome due to the need for the service party to manually change the cluster connection configuration and manually restart the service client, and achieves the effect of switching the cluster imperceptibly and smoothly.

[0115] The cluster switching device provided in the embodiment of the present invention can execute the cluster switching method provided in the third embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0116] It is worth noting that in the above-mentioned embodiment of the cluster switching device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0117] Embodiment 7

[0118] Fig.12 A schematic diagram of the structure of a server provided in Embodiment 7 of the present invention is shown in FIG. Fig.12 As shown, the server includes a memory 710, a processor 720, an input device 730, and an output device 740. The number of processors 720 in the server can be one or more. Fig.12 A processor 720 is used as an example; the memory 710, the processor 720, the input device 730 and the output device 740 in the server can be connected via a bus or other means. Fig.12 The connection via bus 750 is taken as an example.

[0119] The memory 710, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the cluster switching method in Embodiment 1 or Embodiment 2 of the present invention (for example, the task judgment module 510, the information acquisition module 520 and the first cluster switching module 530 in the cluster switching device). The processor 720 executes various functional applications and data processing of the server by running the software programs, instructions and modules stored in the memory 710, that is, realizing the above-mentioned cluster switching method.

[0120] The memory 710 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the server, etc. In addition, the memory 710 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 710 may further include a memory remotely arranged relative to the processor 720, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0121] The input device 730 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 740 may include a display device such as a display screen.

[0122] Embodiment 8

[0123] Fig.13 A schematic diagram of the structure of a terminal provided in Embodiment 8 of the present invention is shown in FIG. Fig.13 As shown, the terminal includes a memory 810, a processor 820, an input device 830, and an output device 840. The number of processors 820 in the terminal can be one or more. Fig.13A processor 820 is used as an example; the memory 810, the processor 820, the input device 830 and the output device 840 in the terminal can be connected via a bus or other means. Fig.13 The connection via bus 850 is taken as an example.

[0124] The memory 810, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the cluster switching method in Embodiment 3 of the present invention (for example, the configuration acquisition module 610 and the second cluster switching module 620 in the cluster switching device). The processor 820 executes various functional applications and data processing of the terminal by running the software programs, instructions and modules stored in the memory 810, that is, implements the above-mentioned cluster switching method.

[0125] The memory 810 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 810 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 810 may further include a memory remotely arranged relative to the processor 820, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0126] The input device 830 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 840 may include a display device such as a display screen.

[0127] Embodiment 9

[0128] Embodiment 9 of the present invention provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a cluster switching method applicable to a cluster switching server when executed by a computer processor, wherein the cluster switching server is communicatively connected to at least two clusters, and the method includes:

[0129] Collect the component status of each component in each cluster respectively, and determine whether to execute the corresponding cluster switching task according to the collected component status;

[0130] If yes, then obtaining the to-be-switched service corresponding to the cluster switching task and the cluster connection information of the target cluster corresponding to the cluster switching task in each cluster;

[0131] The cluster connection configuration of the service to be switched is changed according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, it switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration.

[0132] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the cluster switching method provided by any embodiment of the present invention.

[0133] Embodiment 10

[0134] Embodiment 10 of the present invention provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a cluster switching method applicable to a cluster switching client when executed by a computer processor, the method comprising:

[0135] When a change trigger event of a cluster connection configuration change of a service to be switched belonging to a cluster switching client is monitored, a changed cluster connection configuration corresponding to the change trigger event is obtained from the cluster switching server;

[0136] Create a target connection according to the changed cluster connection configuration, and switch the service to be switched to the target cluster corresponding to the target connection according to the target connection;

[0137] Among them, the changed cluster connection configuration may include the changed configuration of the cluster connection configuration before the change made by the cluster switching server according to the cluster connection information, and the cluster connection information includes information determined by the cluster switching server according to the component status of each component in at least two clusters that are communicated with the cluster switching server.

[0138] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the cluster switching method provided by any embodiment of the present invention.

[0139] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0140] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A cluster switching method, characterized in that: Applied to a cluster switching server, wherein the cluster switching server is connected to at least two clusters for communication, wherein the at least two clusters include a main cluster and a standby cluster, and the method includes: Collecting the component status of each component in each cluster respectively, and determining whether the collected component status satisfies a pre-configured cluster switching strategy, wherein the cluster switching strategy includes a single service switching strategy, a local service switching strategy, and a full service switching strategy; If so, determining to execute a cluster switching task corresponding to the target switching strategy according to the target switching strategy corresponding to the component state in each of the cluster switching strategies, wherein the target switching strategy represents the service to be switched and the target cluster to which the service to be switched in each of the clusters is to be switched, the cluster to which the service to be switched is currently connected is the primary cluster, and the target cluster is the standby cluster; Acquire the to-be-switched service corresponding to the cluster switching task, and cluster connection information of the target cluster corresponding to the cluster switching task in each of the clusters; The cluster connection configuration of the service to be switched is changed according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, the cluster switching client switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration; The collecting the component status of each component in each of the clusters respectively includes: collecting the component status of each component in each of the clusters respectively based on a preset time interval; Correspondingly, the determination of whether the collected component states satisfy a pre-configured cluster switching strategy includes: treating each component state collected within each preset time interval as a group of component states, and determining whether each group of component states collected within the preset time window satisfies the same pre-configured cluster switching strategy.

2. The method according to claim 1, characterized in that The collecting the component status of each component in each cluster respectively further includes: When a startup trigger event of cluster startup is detected, a corresponding collector is started by starting a scheduler corresponding to the startup trigger event, and component status of each component in each cluster is collected based on the started collector.

3. The method according to claim 1, characterized in that The collecting the component status of each component in each cluster respectively further includes: At least one of the main service status of the main service and the data block status of the data block in the distributed file system in each cluster and the area status of the data area in each cluster is collected respectively.

4. The method according to claim 1, characterized in that: After collecting the component status of each component in each cluster respectively, the method further includes: uploading the collected component status to a pre-set data storage center; Correspondingly, the determination of whether the collected states of each component satisfy a pre-configured cluster switching policy also includes: when an update trigger event of a component state update in the data storage center is monitored, obtaining the pre-configured cluster switching policy and the states of each component corresponding to the update trigger event from the data storage center, and determining whether the states of each component corresponding to the update trigger event satisfy the cluster switching policy.

5. The method according to claim 1, characterized in that The cluster includes a distributed cluster.

6. A cluster switching method, characterized in that: Applicable to cluster switching clients, including: When a change triggering event of a cluster connection configuration change of a service to be switched belonging to the cluster switching client is monitored, obtaining a changed cluster connection configuration corresponding to the change triggering event from the cluster switching server; Creating a target connection according to the changed cluster connection configuration, and switching the service to be switched to the target cluster corresponding to the target connection according to the target connection; The changed cluster connection configuration includes a configuration after the cluster switching server changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information is determined in the following manner: Based on preset time intervals, the component states of each component in each cluster are respectively collected, and the component states collected in each preset time interval are respectively used as a group of component states, and it is determined whether each group of component states collected in the preset time window satisfies the same pre-configured cluster switching strategy, wherein each cluster includes a main cluster and a standby cluster, and the cluster switching strategy includes a single service switching strategy, a local service switching strategy, and a full service switching strategy; If so, then according to the target switching strategy corresponding to the component status in each of the cluster switching strategies, determine to execute the cluster switching task corresponding to the target switching strategy, and obtain the service to be switched corresponding to the cluster switching task, and the cluster connection information of the target cluster corresponding to the cluster switching task in each of the clusters, wherein the target switching strategy represents the service to be switched and the target cluster, the cluster to which the service to be switched is connected before the cluster switching is performed is the main cluster, and the target cluster is the standby cluster.

7. The method according to claim 6, characterized in that After switching the service to be switched to the target cluster corresponding to the target connection according to the target connection, the method further includes: The target information is sent through the callback information sending interface, wherein the target information includes at least one of a cluster switching reason, a cluster switching strategy, a cluster switching occurrence time, and a cluster switching consumption time.

8. A cluster switching system, characterized in that: It includes a cluster switching server and a cluster switching client, wherein the cluster switching server is connected to at least two clusters for communication, and the at least two clusters include a main cluster and a standby cluster; The cluster switching service end is used to collect the component status of each component in each cluster based on a preset time interval, and use each component status collected in each preset time interval as a group of component status, and judge whether each group of component status collected in the preset time window satisfies the same pre-configured cluster switching strategy, wherein the cluster switching strategy includes a single service switching strategy, a local service switching strategy and a full service switching strategy; The cluster switching service end is further used for, if yes, determining to execute a cluster switching task corresponding to the target switching strategy according to the target switching strategy corresponding to the component state in each of the cluster switching strategies, and obtaining the service to be switched corresponding to the cluster switching task, and the cluster connection information of the target cluster corresponding to the cluster switching task in each of the clusters, and changing the cluster connection configuration of the service to be switched according to the cluster connection information, wherein the target switching strategy represents the service to be switched and the target cluster, the cluster to which the service to be switched is currently connected is the main cluster, and the target cluster is the standby cluster; The cluster switching client is used to create a target connection according to the changed cluster connection configuration corresponding to the change trigger event obtained from the cluster switching server when a change trigger event of a cluster connection configuration change is monitored, and switch the service to be switched to the target cluster according to the target connection.

9. A cluster switching device, characterized in that: The device is configured on a cluster switching service end, wherein the cluster switching service end is connected to at least two clusters for communication, wherein the at least two clusters include a main cluster and a standby cluster, and the device includes: A task judgment module, used to collect the component status of each component in each cluster, and judge whether to execute the corresponding cluster switching task according to the collected component status; An information acquisition module, used to acquire the to-be-switched service corresponding to the cluster switching task, and cluster connection information of a target cluster corresponding to the cluster switching task in each of the clusters; A first cluster switching module, configured to change the cluster connection configuration of the service to be switched according to the cluster connection information, so that when the cluster switching client monitors the cluster connection configuration change, the cluster switching client switches the service to be switched to the target cluster according to the acquired changed cluster connection configuration; Wherein, the task judgment module includes: A third component status collection unit, configured to collect the component status of each component in each of the clusters based on a preset time interval; A strategy judgment unit, used to take each of the component states collected within each of the preset time intervals as a group of the component states, and judge whether each group of the component states collected within the preset time window satisfies the same pre-configured cluster switching strategy, wherein the cluster switching strategy includes a single service switching strategy, a local service switching strategy, and a full service switching strategy; A task determination unit is used to, if yes, determine to execute a cluster switching task corresponding to the target switching strategy according to the target switching strategy corresponding to the component state in each of the cluster switching strategies, wherein the target switching strategy represents the service to be switched and the target cluster to which the service to be switched in each of the clusters is to be switched, the cluster to which the service to be switched is currently connected is the main cluster, and the target cluster is the standby cluster.

10. A cluster switching device, characterized in that: Configured on a cluster switching client, the device includes: A configuration acquisition module, configured to acquire, from a cluster switching server, a changed cluster connection configuration corresponding to the change triggering event when a change triggering event of a cluster connection configuration change of a to-be-switched service belonging to the cluster switching client is monitored; A second cluster switching module is used to create a target connection according to the changed cluster connection configuration, and switch the service to be switched to a target cluster corresponding to the target connection according to the target connection; The changed cluster connection configuration includes a configuration after the cluster switching server changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information is determined in the following manner: Based on preset time intervals, the component states of each component in each cluster are respectively collected, and the component states collected in each preset time interval are respectively used as a group of component states, and it is determined whether each group of component states collected in the preset time window satisfies the same pre-configured cluster switching strategy, wherein each cluster includes a main cluster and a standby cluster, and the cluster switching strategy includes a single service switching strategy, a local service switching strategy, and a full service switching strategy; If so, then according to the target switching strategy corresponding to the component status in each of the cluster switching strategies, determine to execute the cluster switching task corresponding to the target switching strategy, and obtain the service to be switched corresponding to the cluster switching task, and the cluster connection information of the target cluster corresponding to the cluster switching task in each of the clusters, wherein the target switching strategy represents the service to be switched and the target cluster, the cluster to which the service to be switched is connected before the cluster switching is performed is the main cluster, and the target cluster is the standby cluster.

11. A server, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the cluster switching method as described in any one of claims 1 to 5.

12. A terminal, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the cluster switching method as described in any one of claims 6 to 7.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cluster switching method according to any one of claims 1 to 7 is implemented.