CN113765690A - Cluster switching method, system, device, terminal, server and storage medium - Google Patents

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

Info

Publication number
CN113765690A
CN113765690A CN202110019669.5A CN202110019669A CN113765690A CN 113765690 A CN113765690 A CN 113765690A CN 202110019669 A CN202110019669 A CN 202110019669A CN 113765690 A CN113765690 A CN 113765690A
Authority
CN
China
Prior art keywords
cluster
switching
service
target
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110019669.5A
Other languages
Chinese (zh)
Inventor
郑思城
吴怡燃
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110019669.5A priority Critical patent/CN113765690A/en
Publication of CN113765690A publication Critical patent/CN113765690A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the invention discloses a cluster switching method, a cluster switching system, a cluster switching device, a cluster switching terminal, a cluster switching server and a storage medium. The method is applied to a cluster switching server which is in communication connection with at least two clusters, and can comprise the following steps: respectively collecting the component states of components in each cluster, and judging whether to execute a corresponding cluster switching task according to the collected component states; if so, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster; and changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the cluster connection configuration change. The technical scheme of the embodiment of the invention can simplify the implementation process of cluster switching and achieve the effects of fast, automatic and non-perception switching of the cluster.

Description

Cluster switching method, system, device, terminal, server and storage medium
Technical Field
The embodiment of the invention relates to the field of computer application, in particular to a cluster switching method, a system, a device, a terminal, a server and a storage medium.
Background
Under big data waves, the distributed columnar storage cluster is a cluster which is relatively explosive in recent years and is also one of core open source items of Apache. However, there are still many places to be improved if the cluster is to be applied to enterprises well.
Illustratively, stability is one of the important attributes of a cluster, which can guarantee high availability of services, and enterprises generally need to guarantee a Service Level Agreement (SLA) above 99.95%. For this reason, existing clusters are generally set as a master cluster and a backup cluster to achieve high availability. Specifically, when finding that a cluster switching requirement for switching a service to be switched from a main cluster to a standby cluster exists, a Database Administrator (DBA) needs to actively contact a service party to which the service to be switched belongs, so that the service party manually realizes a cluster switching process of the service to be switched.
In the process of implementing the invention, the inventor finds that the following technical problems exist in the prior art: in practical application, the number of services to be switched in communication connection with a cluster is usually more than several hundred, and the implementation process of the cluster switching scheme is complicated and has poor feasibility.
Disclosure of Invention
The embodiment of the invention provides a cluster switching method, a cluster switching system, a cluster switching device, a terminal, a server and a storage medium, and solves the problem that the cluster switching process is complicated.
In a first aspect, an embodiment of the present invention provides a cluster switching method, where the method is applicable to a cluster switching server, where the cluster switching server is in communication connection with at least two clusters, and the method may include:
respectively collecting the component states of components in each cluster, and judging whether to execute a corresponding cluster switching task according to the collected component states;
if so, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster;
and changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the cluster connection configuration change.
In a second aspect, an embodiment of the present invention further provides a cluster switching method, where the method is applied to a cluster switching client, and may include:
when a change trigger event of the cluster connection configuration change of a service to be switched which belongs to a cluster switching client is monitored, acquiring the changed cluster connection configuration corresponding to the change trigger event from a cluster switching server;
establishing target connection according to the changed cluster connection configuration, and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection;
the changed cluster connection configuration comprises the configuration after the cluster switching server side changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information can comprise information determined by the cluster switching server side according to the collected component states of components in at least two clusters in communication connection with the cluster switching server side.
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, where the cluster switching server is in communication connection with at least two clusters;
the cluster switching server is used for respectively collecting the component states of the components in each cluster, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster when determining to execute the corresponding cluster switching task according to the collected component states, and changing the cluster connection configuration of the service to be switched according to the cluster connection information;
and the cluster switching client is used for establishing target connection according to the changed cluster connection configuration which is acquired from the cluster switching server and corresponds to the change triggering event when monitoring the change triggering event of the cluster connection configuration change, and switching and connecting the service to be switched to the target cluster according to the target connection.
In a fourth aspect, an embodiment of the present invention further provides a cluster switching device, where the cluster switching device is configured at a cluster switching server, and the cluster switching server is in communication connection with at least two clusters, where the cluster switching server may include:
the task judging module is used for respectively collecting the component states of the components in each cluster and judging whether to execute the corresponding cluster switching task according to the collected component states;
the information acquisition module is used for acquiring the service to be switched corresponding to the cluster switching task and the cluster connection information of a target cluster corresponding to the cluster switching task in each cluster if the service to be switched corresponding to the cluster switching task is the target cluster;
the first cluster switching module is used for changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client side can switch and connect the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the change of the cluster connection configuration.
In a fifth aspect, an embodiment of the present invention further provides a cluster switching device, where the device is configured at a cluster switching client, and the device may include:
the configuration acquisition module is used for acquiring the changed cluster connection configuration corresponding to the change triggering event from the cluster switching server side when the change triggering event of the cluster connection configuration change of the service to be switched which belongs to the cluster switching client side is monitored;
the second cluster switching module is used for establishing target connection according to the changed cluster connection configuration and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection;
the changed cluster connection configuration comprises the configuration after the cluster switching server side changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information can comprise information determined by the cluster switching server side according to the collected component states of components in at least two clusters in communication connection with the cluster switching server side.
In a sixth aspect, an embodiment of the present invention further provides a server, where the server may 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 provided in the first embodiment or the second embodiment of the present invention.
In a seventh aspect, an embodiment of the present invention further provides a terminal, where the terminal may 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 provided by the third embodiment of the present invention.
In an eighth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the cluster switching method provided in any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, the cluster switching server acquires the component states of components in each cluster which is in communication connection with the cluster switching server, and judges whether to execute the corresponding cluster switching task according to the acquisition result, so that the problem of high labor cost caused by monitoring whether the cluster fails by needing manpower on duty is solved, and the effect of automatic and timely sensing when the cluster fails is realized; when a task to be switched corresponding to the component state needs to be executed, a service to be switched matched with the task to be switched and cluster connection information of a 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. According to the technical scheme, the health state of the cluster is automatically and timely sensed, and when the cluster connected with the service to be switched fails, the service to be switched is automatically and quickly switched to the target cluster, and the cluster switching process does not need to involve any manual process, so that the implementation process of cluster switching is simplified, and the effects of quick, automatic and non-sensing switching of the cluster are achieved.
Drawings
Fig. 1 is a flowchart of a cluster switching method in a first embodiment of the present invention;
fig. 2 is a schematic diagram of a health-aware module in a cluster switching method according to a first embodiment of the present invention;
fig. 3 is a flowchart of a cluster switching method in the second embodiment of the present invention;
fig. 4 is a schematic diagram of a policy storage module in a cluster switching method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of a policy management module in a cluster switching method according to a second embodiment of the present invention;
fig. 6 is a flowchart of a cluster switching method in the third embodiment of the present invention;
fig. 7 is a schematic diagram of a cluster switching client in a cluster switching method according to a third embodiment of the present invention;
fig. 8 is a schematic diagram illustrating mutual cooperation of parts in a cluster switching method according to a third embodiment of the present invention;
fig. 9 is a block diagram of a cluster switching system in the fourth embodiment of the present invention;
fig. 10 is a block diagram of a cluster switching device in the fifth embodiment of the present invention;
fig. 11 is a block diagram of a cluster switching device in the sixth embodiment of the present invention;
fig. 12 is a schematic structural diagram of a server in a seventh embodiment of the present invention;
fig. 13 is a schematic structural diagram of a terminal in an eighth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before the embodiment of the present invention is described, an application scenario of the embodiment of the present invention is exemplarily described: as mentioned in the background, in order to ensure high availability of a cluster, the cluster is usually configured as a main cluster and a standby cluster with the same cluster structure, in practical applications, a cluster currently communicatively connected to a service client may be used as the main cluster, and another cluster may be used as the standby cluster, and the service client may read and write data from the main cluster. Of course, the main cluster and the standby cluster are relative concepts, and when the main cluster fails and causes the service client to need to be in communication connection with the standby cluster to read data, the main cluster and the standby cluster are exchanged.
It should be noted that, when a cluster is switched by using a cluster switching scheme in the prior art, because it needs the DBA to actively contact a service party to which the service client belongs after actively finding a fault, so that the service party manually changes a cluster connection configuration, and manually restarts the service client, the cluster connection configuration may be some configurations set for implementing communication connection between the service client and the cluster. Obviously, the cluster switching scheme cannot automatically sense the fault of the main cluster in time and cannot automatically switch to the standby cluster, and the manpowered supervision is needed to monitor whether the main cluster has the fault, so that the labor cost is high; the processing cycle from the DBA finding the main cluster failure to the notification of the business party to execute the corresponding operation is too long, which is obviously unacceptable for the business with higher importance degree to finance and transaction, and this is likely to bring significant loss; in addition, for large-scale clusters, such as those with a service of hundreds, even thousands or more, such a cluster implementation scheme is difficult to implement.
In order to solve the above problems, the inventors have proposed a cluster switching method according to embodiments of the present invention, which is described below, based on a detailed study of the prior art, and a cluster in the cluster switching method may be a cluster in various cluster structures, such as a distributed cluster, a non-relational cluster (Not Only SQL, NoSQL), a distributed NoSQL, and Hbase, which are Not specifically limited herein. The number of the clusters may be at least two, and they may include a main cluster and a standby cluster, where the main cluster may be a cluster where the service is currently located, and the remaining clusters may be referred to as standby clusters, that is, the target cluster described in the embodiments of the present invention is one of the clusters where the service is not currently located.
Example one
Fig. 1 is a flowchart of a cluster switching method applicable to a cluster switching server according to a first embodiment of the present invention, where the cluster switching server may be in communication connection with at least two clusters. The embodiment can be applied to the situation of automatically sensing cluster faults and automatically executing cluster switching. The method may be executed by the cluster switching apparatus provided in the embodiment of the present invention, and the apparatus may be implemented by software and/or hardware, and the apparatus may be configured on a cluster switching server, and the server may be integrated on a server.
Referring to fig. 1, the method of the embodiment of the present invention specifically includes the following steps:
s110, respectively collecting the component states of the components in each cluster, and judging whether to execute the corresponding cluster switching task according to the collected component states.
Each cluster may include a plurality of components, and the component may be one of the components of the cluster, and in practical applications, the component may be a Master node (Master) functioning as a core node, a Slave node (Slave) functioning as a work node, a data block, a data area capability, and the like, which are not specifically limited herein. The component states of the components in each cluster are collected respectively, and the component states can present the health states of the corresponding components and/or the whole cluster, such as whether a master node is down, whether a slave node is down, whether a data block of the cluster is lost, whether a data area in the cluster is down, whether the cluster performance is degraded and the like.
Further, whether the cluster where the service is currently located is in a healthy state or not and whether the cluster where the service is not currently located is in a healthy state or not can be judged according to the collected component states in each cluster. For simplicity, the cluster in which the service currently exists is referred to as a master cluster, and the cluster in which the service currently does not exist is referred to as a standby cluster. In practical applications, optionally, the number of the master clusters may be one, which is to collect all the services in one cluster for convenient management; the number of backup clusters may be at least one, in order to ensure that there must be one backup cluster to switch when the primary cluster fails, although, in general, one backup cluster is sufficient for application. On the basis, whether to execute a corresponding cluster switching task can be judged according to the health state of each cluster, and the cluster switching task can present a service to be switched with a cluster switching requirement, a cluster to which the service to be switched is to be switched, and the like. Illustratively, if the primary cluster has a failure, a corresponding cluster switching task may be performed; if the standby cluster has a fault, only prompt information can be sent out, and the cluster switching task does not need to be executed.
And S120, if so, acquiring 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 cluster.
If it is determined that a corresponding cluster switching task needs to be executed according to the states of the components, 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 cluster can be acquired, and the cluster switching task is a switching task matched with the states of the components because the cluster switching tasks corresponding to different component states may have differences. Specifically, the service to be switched may be a service that has a switching requirement among services communicatively connected to the main cluster, or a service that has a failure in the storage performance of the main cluster, for example, a service whose storage performance is affected due to a failure of the main node, a failure of a slave node, a loss of a data block, a data area offline, a decrease in cluster performance, and the like. The target cluster is the cluster to which the service to be switched is connected in each cluster, or the cluster in which the storage performance of the service to be switched does not have any fault. The cluster connection information is information related to connection required for successfully connecting the service to be switched to the target cluster, such as a URL, a user name, a password, and the like of the target cluster, and the service to be switched can be connected to the target cluster according to the cluster connection information.
S130, changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the cluster connection configuration change.
The cluster connection configuration stores cluster connection information of a cluster (i.e., a main cluster) to which a 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 connection information of the main cluster. In order to switch and connect the service to be switched to the target cluster from the main cluster, the cluster connection configuration of the service to be switched may be changed according to the cluster connection information of the target cluster, so that 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 with the service to be switched before the cluster connection configuration is changed according to the cluster connection information.
After the cluster switching server changes the cluster connection configuration, the cluster switching server aims at a cluster connection client which is matched with the cluster connection server and can be arranged in a service client, the service client can be a client to which a service to be switched belongs, the cluster connection client can monitor the cluster connection configuration of the service to be switched in the cluster switching server, and when the change of the cluster connection client is monitored, the service to be switched can be switched and connected to a target cluster according to the changed cluster connection configuration obtained from the cluster switching server. Specifically, the target connection can be created according to the changed cluster connection configuration, and the service to be switched is switched and connected to the target cluster corresponding to the target connection according to the target connection, and the creation process of the target connection can be understood as the restarting process of the service client, so that the problem that the operation is complicated because the service party needs to manually change the cluster connection configuration and manually restart the service client is solved.
According to the technical scheme of the embodiment of the invention, the cluster switching server acquires the component states of components in each cluster which is in communication connection with the cluster switching server, and judges whether to execute the corresponding cluster switching task according to the acquisition result, so that the problem of high labor cost caused by monitoring whether the cluster fails by needing manpower on duty is solved, and the effect of automatic and timely sensing when the cluster fails is realized; when a task to be switched corresponding to the component state needs to be executed, a service to be switched matched with the task to be switched and cluster connection information of a 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. According to the technical scheme, the health state of the cluster is automatically and timely sensed, and when the cluster connected with the service to be switched fails, the service to be switched is automatically and quickly switched to the target cluster, and the cluster switching process does not need to involve any manual process, so that the implementation process of cluster switching is simplified, and the effects of quick, automatic and non-sensing switching of the cluster are achieved.
On this basis, an optional technical solution is to collect the component states of the components in each cluster, and may specifically include: when a starting trigger event of cluster starting is monitored, a corresponding collector is pulled up by starting a scheduler corresponding to the starting trigger event, and the component states of components in each cluster are collected respectively based on the pulled-up collector. In practical application, when the start triggering event is monitored, the thread where the corresponding scheduler is located may be started first, so that the thread where the corresponding collector is located is called based on the thread where the scheduler is located, or the corresponding collector is pulled up based on the started scheduler, and then component states of components in each cluster are collected according to the thread where the collector is located, or the pulled-up collector.
An optional technical solution is to collect component states of components in each cluster, and specifically may include: and respectively collecting at least one of the main service state of the main service and the data block state of the data block in the distributed file system in each cluster and the area state of the data area in each cluster. The distributed file system (HDFS) is used as a bottom storage base of the cluster, persistent data blocks can be stored in the HDFS, and the HDFS plays a vital role in the health state of the cluster, so that the main service state of main services in the HDFS can be monitored, and whether the main services can work normally or not is judged. When data are stored based on the HDFS, a server node therein may cause a short data block loss due to a hardware failure, and thus, a data block state of a data block in the HDFS may be monitored, so as to determine whether a problem of data block loss exists. In addition, if the data area in the cluster is in the rit state, the data area may not be served to the outside due to unavailability, so the area state of the data area of each cluster can be monitored, and whether a service party can read data from the data area or not can be determined. Specifically, the rit state is an intermediate state of a cluster (i.e., a database), and in the case of NoSQL, the rit state belongs to a distributed database, each data region below the distributed database is respectively arranged on a cluster server corresponding to the data region, and when the rit on the data region is not on the cluster server for some reason, the service party at this time is invisible to the data region, that is, the service party cannot read any data from the data region. The states of the components are the conditions that the health state of the cluster is easily influenced in practical application, and the effective collection of the component configurations is beneficial to accurately judging the health state of the cluster. Of course, the above several component states are merely exemplary illustrations of the collectable component states, and the rest of the component states that may present the health state of the cluster still remain in the collection range, which is not specifically limited herein.
In order to better understand the collection process of the component states, the following description is made for illustrative purposes with reference to specific examples. For example, as shown in fig. 2, the collection process of the component state may be implemented based on a health sensing module (health monitor) disposed in the cluster switching server, where the health sensing module may be software and/or hardware running in each cluster. Specifically, after monitoring that the cluster is started, the health sensing module starts the scheduler to pull up the collector, and collects the states of the components of each cluster based on a preset time interval on the basis of the pulled-up collector, where the states of the components may present the health state of the cluster, for example, whether a main service of the HDFS is down, whether a data block of the HDFS is lost, whether a data area (shown in fig. 2 by taking the cluster as NoSQL as an example) in the cluster is unavailable, and the like. In practical applications, the preset time interval may be 3 seconds, 5 seconds, 7 seconds, and the like, thereby achieving the effect of automatic and timely sensing when the cluster fails. Further, for the component states collected by the health awareness module, it may assemble these component states into preset structured data to be sent to a policy storage module (PolicyStore), a policy management module (PolicyServer), and so on, so as to perform the subsequent steps.
Example two
Fig. 3 is a flowchart of a cluster switching method provided in the second embodiment of the present invention. The present embodiment is optimized based on the above technical solutions. In this embodiment, optionally, determining whether to execute a corresponding cluster switching task according to the collected states of the components may specifically include: judging whether the acquired states of the components meet a pre-configured cluster switching strategy or not, wherein the cluster switching strategy comprises a single service switching strategy, a local service switching strategy and/or a total service switching strategy; if so, determining 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. The same or corresponding terms as those in the above embodiments are not explained in detail herein.
Referring to fig. 3, the method of this embodiment may specifically include the following steps:
s210, respectively collecting the component state of each component in each cluster, and judging whether the collected component state meets a cluster switching strategy configured in advance, wherein the cluster switching strategy comprises a single service switching strategy, a local service switching strategy and/or a total service switching strategy.
The cluster switching policy is a preset policy for determining a corresponding cluster switching task according to the component state, and the cluster switching policy may include a single service switching policy, a local service switching policy, a total service switching policy, and the like, because when a main cluster fails, a single component, a part of the components, or all of the components in the main cluster may fail, that is, performance of the main cluster decreases, the components are partially unavailable, or the components fail, and thus various cluster switching policies may be preconfigured according to different failure conditions. Specifically, the single service switching strategy is a strategy for determining that only one service in services currently connected to the main cluster needs to be subjected to cluster switching according to the states of the components, correspondingly, the local switching strategy is a strategy for determining that at least two services but not all services in the services currently connected to the main cluster need to be subjected to cluster switching according to the states of the components, and the all switching strategy is a strategy for determining that all services currently connected to the main cluster need to be subjected to cluster switching according to the states of the components. Since the cluster switching policy can be understood as a correspondence between the component states and the cluster switching tasks, it can be determined whether the collected component states satisfy the cluster switching policy, specifically, whether one of the cluster switching policies is satisfied by determining whether the component states corresponding to the collected component states exist in the cluster switching policy.
And S220, if so, determining 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.
If the collected states of the components meet the cluster switching strategy, a target switching strategy matched with the states of the components can be screened from the cluster switching strategies, and the target switching strategy can indicate which service to be switched is, which cluster the service to be switched is to be switched to, and the like. Further, the cluster switching task corresponding to the target switching policy may be determined to be executed according to the target switching policy.
S230, after the cluster switching task is determined, 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 cluster are obtained.
S240, changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the cluster connection configuration change.
According to the technical scheme of the embodiment of the invention, whether the acquired component states meet the pre-configured cluster switching strategy is judged, the cluster switching task matched with the target switching strategy corresponding to the component states in the cluster switching strategies is determined to be executed if the judgment result is yes, and the component states are compared with the pre-configured cluster switching strategy, so that the effect of conveniently, quickly and accurately determining the cluster switching task is achieved.
An optional technical solution, which collects component states of components in each cluster respectively, may include: respectively collecting the component states of the components in each cluster based on a preset time interval; correspondingly, the determining whether the collected states of the components meet the preconfigured cluster switching policy may include: and respectively taking the component states acquired in each preset time interval as a group of component states, and judging whether the component states acquired in the preset time window all meet the same cluster switching strategy configured in advance. The method has the advantage of avoiding the subsequent cluster switching strategy judgment error caused by the reasons of certain error acquisition or the occurrence of certain rare special conditions. For example, assuming that the preset time interval is 5 seconds, the preset time window is 30 seconds, and all of the 6 groups of component states collected within 30 seconds satisfy the local service switching policy, it is considered that each group of component states satisfy the local service switching policy, and at this time, the master cluster is only really failed.
In an optional technical solution, after the component states of the components in each cluster are respectively collected, the cluster switching method may further include: uploading the acquired states of the components to a preset data storage center; correspondingly, the determining whether the collected states of the components meet the preconfigured cluster switching policy may include: when an update triggering event of updating the component state in the data storage center is monitored, a pre-configured cluster switching strategy and each component state corresponding to the update triggering event are obtained from the data storage center, and whether each component state corresponding to the update triggering event meets the cluster switching strategy is judged. The collected component states and the pre-configured cluster switching strategies are stored in the data storage center, and the updated/newly added component states and the cluster switching strategies are obtained from the data storage center before the step of judging whether the cluster switching strategies are met or not. The advantage of such an arrangement is that the data storage center can implement persistent storage of data, which means that even if a server where the cluster switching server is located suddenly loses power, the problem of data loss will not occur due to the fact that the collected states of the components and the pre-configured cluster switching strategy are uploaded to the data storage center, and therefore stability of the cluster switching server is ensured. In practical applications, the data storage center may be zookeeper (a distributed application coordination service), MySQL, or the like.
To better understand the determination process of the cluster switching task, it is exemplarily described below with reference to specific examples. For example, as shown in fig. 4 and fig. 5, the determination process of the cluster switching task may be implemented by a policy storage module (PolicyStore) and a policy management module (PolicyServer) which are disposed in the cluster switching service end and cooperate with each other. Specifically, for the policy storage module, data such as the states of the components reported by the health awareness module, the cluster switching policy configured in advance by the policy management module, the cluster connection information of the clusters, the cluster to which the service is currently connected, and the like may be stored in the policy storage module, and the data may be persistently stored in the data storage center. For the policy management module, the policy management module may receive a cluster switching policy configured by the DBA through the policy configurator, trigger a cluster switching task for the states of the components satisfying the cluster switching policy through the policy trigger, change the cluster connection configuration in the configuration center from pointing to the master cluster to pointing to the slave cluster according to the triggered cluster switching task, and wait for a cluster switching Client (USER API Client) to pull the changed cluster connection configuration from the configuration center.
EXAMPLE III
Fig. 6 is a flowchart of a cluster switching method applicable to a cluster switching client according to the third embodiment of the present invention. The embodiment can be applied to the situation that the cluster switching is automatically realized by the information configuration center after the obtained change. The method may be executed by the cluster switching apparatus provided in the embodiment of the present invention, and the apparatus may be implemented by software and/or hardware, and the apparatus may be configured on a cluster switching client, and the client may be integrated on various terminals.
Referring to fig. 6, the method of the embodiment of the present invention specifically includes the following steps:
s310, when a change trigger event of a cluster connection configuration change of a service to be switched which belongs to the cluster switching client is monitored, obtaining a changed cluster connection configuration corresponding to the change trigger event from a cluster switching server, wherein the changed cluster connection configuration comprises a configuration which is obtained by the cluster switching server after the cluster switching server changes the cluster connection configuration before the change according to cluster connection information, and the cluster connection information comprises information which is obtained by the cluster switching server and is determined according to the collected component states of components in at least two clusters which are in communication connection with the cluster switching server.
The cluster switching client may be a client where a certain service to be switched is located for implementing cluster switching, 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, which is associated with the cluster switching client, in the cluster switching server, and can acquire the changed cluster connection configuration of the service to be switched from the cluster switching server when monitoring that the change occurs. It should be noted that the determination process of the changed cluster connection configuration is described in detail in the first and second embodiments, and is not described herein again.
S320, establishing target connection according to the changed cluster connection configuration, and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection.
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, the service to be switched is switched and connected 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 a restarting process of the service client, the service client is restarted to be connected to the target cluster, the service client can be a client where the service to be switched is located and used for achieving a service function, and the cluster switching client can be configured in the cluster switching client.
According to the technical scheme of the embodiment of the invention, when a change trigger event of cluster connection configuration change of the service to be switched which belongs to a cluster switching client is monitored, target connection is established according to the changed cluster connection configuration which is acquired from a cluster switching server and corresponds to the change trigger event, and the service to be switched is switched and connected to a target cluster corresponding to the target connection according to the target connection. By the technical scheme, the problem that a cluster switching process is complicated due to the fact that a service party needs to manually change cluster connection configuration and manually restart a service client is solved, and the effect of switching the clusters smoothly without perception is achieved.
On this basis, an optional technical solution, after the service to be switched is switched and connected to the target cluster corresponding to the target connection according to the target connection, the cluster switching method may further include: the target information is sent through the callback information sending interface, where the target information may include at least one of a cluster handover reason, a cluster handover policy, cluster handover occurrence time, and cluster handover elapsed time, and a sending mode of the target information may be a mail, a short message, a WeChat, and the like, which is not specifically limited herein. Therefore, the DBA can timely eliminate the fault after receiving the target information.
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 specific examples. For example, as shown in fig. 7, the cluster switching client monitors a configuration center in the policy management module based on a configuration monitor, and when monitoring that the cluster connection configuration of the service to be switched associated with the cluster switching client is changed, pulls the changed cluster connection configuration from the configuration center, creates a target connection corresponding to the changed cluster connection configuration based on the connection manager, and changes the service to be switched from the master cluster to the standby cluster according to the target connection. Illustratively, the dashed line 3 in fig. 7 is the initial connection (i.e., old connection) of the service to be switched, and the solid line 4 is the target connection (i.e., new connection) of the service to be switched.
In order to better understand the role of the cluster switching client and the cluster switching server in the cluster switching process as a whole, the following description is made in conjunction with the exemplary descriptions in the foregoing embodiments. Illustratively, as shown in fig. 8, two dashed boxes are a primary cluster and a backup cluster of two columnar storage clusters, which is shown by taking NoSQL as HBase as an example, and zookeeper in the dashed box is a very important component of the columnar storage cluster. The DBA adds a cluster switching strategy (Change Policy) through a service center (service center), a strategy management module stores the cluster switching strategy into a strategy storage module (namely, the number 2, downloads a read/write strategy/load read/write Policy), and a health perception module running in a main cluster and a standby cluster reports component states collected by heartbeats (heartbeat) to a health storage module; when a cluster switching Client (i.e., a USER Client, USER API Client) monitors that a cluster connection configuration in a policy management module is changed, an autoRedirect (i.e., number 1) is obtained from the cluster management module, and a target connection (i.e., number 3, which is connected to a cluster and obtains a zone location and obtains synchronization data/connect to a cluster and get a zone location and wait sync data) is created through the cluster connection configuration, and then data (i.e., number 4, a read data from a zone Slave Server) is read from a zone Slave node (i.e., a Slave Server) after the connection is created, where the Slave Server is a node that provides an external service in a distributed columnar cluster and is equivalent to a Slave. According to the technical scheme, the high availability of the cluster and the low delay of data are realized by automatically sensing the cluster fault and automatically and smoothly switching the cluster.
Example four
Fig. 9 is a block diagram of a cluster switching system provided in the fourth embodiment of the present invention. As shown in 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 communicatively connected to at least two clusters; the cluster switching server 410 is configured to collect component states of components in each cluster, acquire a service to be switched corresponding to a cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster when determining to execute a corresponding cluster switching task according to the collected component states, and change cluster connection configuration of the service to be switched according to the cluster connection information; the cluster switching client 420 is configured to, when a change trigger event of cluster connection configuration change is monitored, create a target connection according to a changed cluster connection configuration corresponding to the change trigger event, which is obtained from the cluster switching server 410, and switch and connect a service to be switched to a target cluster according to the target connection. It should be noted that specific implementation processes of the cluster switching server 410 and the cluster switching client 420 and other implementation processes have been described in detail in the foregoing embodiments, and are not described herein again. According to the system, the cluster switching server side and the cluster switching client side are matched with each other, the problem that the cluster switching process is complex is solved, and the effects of quick, automatic and non-sensing switching of the clusters are achieved.
EXAMPLE five
Fig. 10 is a block diagram of a cluster switching device configured on a cluster switching server according to a fifth embodiment of the present invention, where the cluster switching server is communicatively connected to at least two clusters, and the cluster switching device is configured to execute the cluster switching method according to the first embodiment or the second embodiment. The device and the cluster switching method of the corresponding embodiment belong to the same inventive concept, and details which are not described in detail in the embodiment of the cluster switching device may refer to the embodiment of the cluster switching method. Referring to fig. 10, the apparatus may specifically include: a task determining module 510, an information obtaining module 520, and a first cluster switching module 530. Wherein the content of the first and second substances,
a task determining module 510, configured to collect component states of components in each cluster, and determine whether to execute a corresponding cluster switching task according to the collected component states;
an information obtaining module 520, configured to obtain, if yes, a to-be-switched service corresponding to a cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster;
the first cluster switching module 530 is 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 change of the cluster connection configuration, the service to be switched is switched and connected to the target cluster according to the obtained changed cluster connection configuration.
Optionally, the task determining module 510 may specifically include: and the first component state acquisition unit is used for pulling up the corresponding collector by starting the scheduler corresponding to the starting trigger event when the starting trigger event of cluster starting is monitored, and acquiring the component state of each component in each cluster based on the pulled-up collector.
Optionally, the task determining module 510 may specifically include: and the second component state acquisition unit is used for respectively acquiring at least one of a main service state of the main service in the distributed file system in each cluster, a data block state of the data block and an area state of the data area in each cluster.
Optionally, the task determining module 510 may specifically include: the strategy judgment unit is used for judging whether the acquired states of all the components meet a pre-configured cluster switching strategy or not, wherein the cluster switching strategy comprises a single service switching strategy, a local service switching strategy and/or a total service switching strategy; and if so, determining 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.
On this basis, optionally, the task determining module 510 may specifically include: the third component state acquisition unit is used for respectively acquiring the component states of the components in each cluster based on a preset time interval;
correspondingly, the policy determining unit may be specifically configured to: and respectively taking the component states acquired in each preset time interval as a group of component states, and judging whether the component states acquired in the preset time window all meet the same cluster switching strategy configured in advance.
On this basis, optionally, on the basis of the above apparatus, the apparatus may further include: the component state storage module is used for uploading the acquired component states to a preset data storage center after the component states of the components in each cluster are acquired respectively;
correspondingly, the policy determining unit may be specifically configured to: when an update triggering event of updating the component state in the data storage center is monitored, a pre-configured cluster switching strategy and each component state corresponding to the update triggering event are obtained from the data storage center, and whether each component state corresponding to the update triggering event meets the cluster switching strategy is judged.
Optionally, the cluster includes a distributed cluster, and/or the at least two clusters include a main cluster and a standby 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 main cluster, and the target cluster is the standby cluster.
In the cluster switching device provided by the fifth embodiment of the invention, the cluster switching server acquires the component states of components in each cluster in communication connection with the cluster switching server through the task judgment module, and judges whether to execute a corresponding cluster switching task according to the acquisition result, so that the problem of high labor cost caused by monitoring whether the cluster fails by needing human power supervision is solved, and the effect of automatic and timely sensing when the cluster fails is realized; through the mutual cooperation of the information acquisition module and the first cluster switching module, when a task to be switched corresponding to the component state needs to be executed, a service to be switched matched with the task to be switched and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster can be acquired first, and then the cluster connection configuration of the service to be switched can be changed according to the cluster connection information. According to the device, the health state of the cluster is sensed automatically and timely, and when the cluster connected with the service to be switched fails, the service to be switched is automatically and quickly switched to the target cluster, and the cluster switching process does not need to involve any manual process, so that the implementation process of cluster switching is simplified, and the effects of quick, automatic and sensorless switching of the cluster are achieved.
The cluster switching device provided by the embodiment of the invention can execute the cluster switching method provided by the first embodiment or the second embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiment of the cluster switching device, each included unit and module are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
EXAMPLE six
Fig. 11 is a block diagram of a cluster switching device that can be configured on a cluster switching client according to a sixth embodiment of the present invention, where the cluster switching device is configured to execute the cluster switching method according to the third embodiment. The device and the cluster switching method of the third embodiment belong to the same inventive concept, and details that are not described in detail in the embodiment of the cluster switching device may refer to the embodiment of the cluster switching method. Referring to fig. 11, the apparatus may specifically include: a configuration acquisition module 610 and a second cluster switching module 620.
The configuration acquiring module 610 is configured to acquire, when a change trigger event of a change of a cluster connection configuration of a service to be switched which is subordinate to a cluster switching client is monitored, a changed cluster connection configuration corresponding to the change trigger event from a cluster switching server;
and a second cluster switching module 620, configured to 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.
Optionally, on the basis of the above apparatus, the apparatus may further include: and the information sending module is used for sending target information through the callback information sending interface, wherein the target information comprises at least one of cluster switching reasons, cluster switching strategies, cluster switching occurrence time and cluster switching consumption time.
In the cluster switching device provided in the sixth embodiment of the present invention, through mutual cooperation of the configuration acquisition module and the second cluster switching module, when a change trigger event of a cluster connection configuration change of a service to be switched which is subordinate to the cluster switching client is monitored, a target connection is created according to a changed cluster connection configuration which is acquired from the cluster switching server and corresponds to the change trigger event, and the service to be switched is switched and connected to a target cluster corresponding to the target connection according to the target connection. By the device, the problem that a cluster switching process is complicated due to the fact that a service party needs to manually change cluster connection configuration and manually restart a service client is solved, and the effect of switching clusters smoothly without perception is achieved.
The cluster switching device provided by the embodiment of the invention can execute the cluster switching method provided by the third embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiment of the cluster switching device, each included unit and module are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
EXAMPLE seven
Fig. 12 is a schematic structural diagram of a server according to a seventh embodiment of the present invention, and as shown in fig. 12, the server includes a memory 710, a processor 720, an input device 730, and an output device 740. The number of the processors 720 in the server may be one or more, and one processor 720 is taken as an example in fig. 12; the memory 710, processor 720, input device 730, and output device 740 in the server may be connected by a bus or other means, such as by bus 750 in fig. 12.
The memory 710 is used as a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the cluster switching method in the first embodiment or the second embodiment of the present invention (for example, the task determining module 510, the information obtaining module 520, and the first cluster switching module 530 in the cluster switching apparatus). The processor 720 executes various functional applications of the server and data processing by executing software programs, instructions and modules stored in the memory 710, that is, the cluster switching method described above is implemented.
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, an application program required for at least one function; the storage data area may store data created according to the use of the server, and the like. Further, the memory 710 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 710 may further include memory located remotely from processor 720, which may be connected to devices through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 730 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the device. The output device 740 may include a display device such as a display screen.
Example eight
Fig. 13 is a schematic structural diagram of a terminal according to an eighth embodiment of the present invention, and as shown in fig. 13, the terminal includes a memory 810, a processor 820, an input device 830, and an output device 840. The number of the processors 820 in the terminal may be one or more, and one processor 820 is taken as an example in fig. 13; the memory 810, processor 820, input device 830 and output device 840 in the terminal may be connected by a bus or other means, such as by bus 850 in fig. 13.
The memory 810 is a computer-readable storage medium and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules (for example, the configuration acquisition module 610 and the second cluster switching module 620 in the cluster switching apparatus) corresponding to the cluster switching method in the third embodiment of the present invention. The processor 820 executes various functional applications and data processing of the terminal by running software programs, instructions and modules stored in the memory 810, that is, implements the cluster switching method described above.
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 program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 810 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 810 may further include memory located remotely from processor 820, which may be connected to devices through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 830 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the device. The output device 840 may include a display device such as a display screen.
Example nine
An embodiment of the present invention provides a storage medium containing computer-executable instructions, where the computer-executable instructions are executed by a computer processor to perform a cluster switching method applicable to a cluster switching server, where the cluster switching server is communicatively connected to at least two clusters, and the method includes:
respectively collecting the component states of components in each cluster, and judging whether to execute a corresponding cluster switching task according to the collected component states;
if so, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster;
and changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the cluster connection configuration change.
Of course, the storage medium provided in the embodiment of the present invention includes computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the cluster switching method provided in any embodiment of the present invention.
Example ten
An embodiment of the present invention provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a cluster switching method applicable to a cluster switching client, where the method includes:
when a change trigger event of the cluster connection configuration change of a service to be switched which belongs to a cluster switching client is monitored, acquiring the changed cluster connection configuration corresponding to the change trigger event from a cluster switching server;
establishing target connection according to the changed cluster connection configuration, and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection;
the changed cluster connection configuration may include a configuration after the cluster switching server performs change on the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information includes information determined by the cluster switching server according to the collected component states of components in at least two clusters in communication connection with the cluster switching server.
Of course, the storage medium provided in the embodiment of the present invention includes computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the cluster switching method provided in any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. With this understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (15)

1. A cluster switching method is applied to a cluster switching server, wherein the cluster switching server is in communication connection with at least two clusters, and the method comprises the following steps:
respectively collecting the component state of each component in each cluster, and judging whether to execute a corresponding cluster switching task according to the collected component state;
if so, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster;
and changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client switches and connects the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the change of the cluster connection configuration.
2. The method of claim 1, wherein the separately collecting component states of components within each cluster comprises:
when a starting trigger event of cluster starting is monitored, a corresponding collector is pulled up by starting a scheduler corresponding to the starting trigger event, and the component states of components in each cluster are collected respectively based on the pulled-up collector.
3. The method of claim 1, wherein the separately collecting component states of components within each cluster comprises:
and respectively collecting at least one of a main service state of a main service and a data block state of a data block in the distributed file system in each cluster and an area state of a data area in each cluster.
4. The method of claim 1, wherein the determining whether to execute the corresponding cluster switching task according to the collected states of the components comprises:
judging whether the acquired states of the components meet a pre-configured cluster switching strategy or not, wherein the cluster switching strategy comprises a single service switching strategy, a local service switching strategy and/or a total service switching strategy;
if so, determining 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.
5. The method of claim 4, wherein the separately collecting component states of components within each cluster comprises: respectively collecting the component states of the components in each cluster based on a preset time interval;
correspondingly, the judging whether the acquired states of the components meet a preconfigured cluster switching policy includes: and respectively taking the component states acquired in each preset time interval as a group of component states, and judging whether the component states acquired in a preset time window all meet the same cluster switching strategy configured in advance.
6. The method of claim 4, wherein after said separately collecting component states of components within each of said clusters, further comprising: uploading the acquired states of the components to a preset data storage center;
correspondingly, the judging whether the acquired states of the components meet a preconfigured cluster switching policy includes: when an update triggering event of updating component states in the data storage center is monitored, a pre-configured cluster switching strategy and each component state corresponding to the update triggering event are obtained from the data storage center, and whether each component state corresponding to the update triggering event meets the cluster switching strategy is judged.
7. The method according to claim 1, wherein the cluster comprises a distributed cluster, and/or wherein the at least two clusters comprise a primary cluster and a secondary cluster, and before the change of the cluster connection configuration of the service to be switched 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 secondary cluster.
8. A cluster switching method is applied to a cluster switching client, and comprises the following steps:
when a change trigger event of the cluster connection configuration change of the service to be switched which belongs to the cluster switching client is monitored, acquiring the changed cluster connection configuration corresponding to the change trigger event from a cluster switching server;
creating a target connection according to the changed cluster connection configuration, and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection;
the changed cluster connection configuration comprises the configuration of the cluster switching server after the cluster switching server changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information comprises the information determined by the cluster switching server according to the collected component states of components in at least two clusters in communication connection with the cluster switching server.
9. The method according to claim 8, further comprising, after the switching and connecting the service to be switched to the target cluster corresponding to the target connection according to the target connection, the method further comprising:
and sending target information through a callback information sending interface, wherein the target information comprises at least one of cluster switching reasons, cluster switching strategies, cluster switching occurrence time and cluster switching consumption time.
10. A cluster switching system is characterized by comprising a cluster switching server and a cluster switching client, wherein the cluster switching server is in communication connection with at least two clusters;
the cluster switching server is used for respectively collecting the component states of the components in each cluster, acquiring a service to be switched corresponding to the cluster switching task and cluster connection information of a target cluster corresponding to the cluster switching task in each cluster when determining to execute the corresponding cluster switching task according to the collected component states, and changing the cluster connection configuration of the service to be switched according to the cluster connection information;
the cluster switching client is used for creating target connection according to the changed cluster connection configuration which is obtained from the cluster switching server and corresponds to the change triggering event when monitoring the change triggering event of the cluster connection configuration change, and switching and connecting the service to be switched to the target cluster according to the target connection.
11. A cluster switching device, configured to a cluster switching server, wherein the cluster switching server is communicatively connected to at least two clusters, the device comprising:
the task judging module is used for respectively collecting the component states of the components in each cluster and judging whether to execute the corresponding cluster switching task according to the collected component states;
an information obtaining module, configured to, if yes, obtain a 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 cluster;
and the first cluster switching module is used for changing the cluster connection configuration of the service to be switched according to the cluster connection information so that the cluster switching client side can switch and connect the service to be switched to the target cluster according to the obtained changed cluster connection configuration when monitoring the change of the cluster connection configuration.
12. A cluster switching apparatus configured at a cluster switching client, the apparatus comprising:
a configuration obtaining module, configured to obtain, from a cluster switching server, a changed cluster connection configuration corresponding to a change trigger event of a cluster connection configuration change of a service to be switched that is subordinate to the cluster switching client;
the second cluster switching module is used for establishing target connection according to the changed cluster connection configuration and switching and connecting the service to be switched to a target cluster corresponding to the target connection according to the target connection;
the changed cluster connection configuration comprises the configuration of the cluster switching server after the cluster switching server changes the cluster connection configuration before the change according to the cluster connection information, and the cluster connection information comprises the information determined by the cluster switching server according to the collected component states of components in at least two clusters in communication connection with the cluster switching server.
13. A server, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the cluster switching method of any of claims 1-7.
14. A terminal, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the cluster switching method of any one of claims 8-9.
15. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the cluster switching method according to any one of claims 1 to 9.
CN202110019669.5A 2021-01-07 2021-01-07 Cluster switching method, system, device, terminal, server and storage medium Pending CN113765690A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110019669.5A CN113765690A (en) 2021-01-07 2021-01-07 Cluster switching method, system, device, terminal, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110019669.5A CN113765690A (en) 2021-01-07 2021-01-07 Cluster switching method, system, device, terminal, server and storage medium

Publications (1)

Publication Number Publication Date
CN113765690A true CN113765690A (en) 2021-12-07

Family

ID=78786267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110019669.5A Pending CN113765690A (en) 2021-01-07 2021-01-07 Cluster switching method, system, device, terminal, server and storage medium

Country Status (1)

Country Link
CN (1) CN113765690A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344327A (en) * 2022-08-19 2022-11-15 中电金信软件有限公司 Application module switching method and device, electronic equipment and readable storage medium
CN115499299A (en) * 2022-09-13 2022-12-20 航天信息股份有限公司 Cluster equipment monitoring method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030033412A1 (en) * 2001-08-08 2003-02-13 Sharad Sundaresan Seamless fail-over support for virtual interface architecture (VIA) or the like
CN107769943A (en) * 2016-08-17 2018-03-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of active and standby cluster switching
CN109245908A (en) * 2017-07-10 2019-01-18 北京京东尚科信息技术有限公司 A kind of method and apparatus of principal and subordinate's cluster switching
CN111865632A (en) * 2019-04-28 2020-10-30 阿里巴巴集团控股有限公司 Switching method of distributed data storage cluster and switching instruction sending method and device
CN111901395A (en) * 2020-07-07 2020-11-06 青岛海尔科技有限公司 Multi-cluster switching method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030033412A1 (en) * 2001-08-08 2003-02-13 Sharad Sundaresan Seamless fail-over support for virtual interface architecture (VIA) or the like
CN107769943A (en) * 2016-08-17 2018-03-06 阿里巴巴集团控股有限公司 A kind of method and apparatus of active and standby cluster switching
CN109245908A (en) * 2017-07-10 2019-01-18 北京京东尚科信息技术有限公司 A kind of method and apparatus of principal and subordinate's cluster switching
CN111865632A (en) * 2019-04-28 2020-10-30 阿里巴巴集团控股有限公司 Switching method of distributed data storage cluster and switching instruction sending method and device
CN111901395A (en) * 2020-07-07 2020-11-06 青岛海尔科技有限公司 Multi-cluster switching method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344327A (en) * 2022-08-19 2022-11-15 中电金信软件有限公司 Application module switching method and device, electronic equipment and readable storage medium
CN115344327B (en) * 2022-08-19 2023-07-28 中电金信软件有限公司 Application module switching method and device, electronic equipment and readable storage medium
CN115499299A (en) * 2022-09-13 2022-12-20 航天信息股份有限公司 Cluster equipment monitoring method and device

Similar Documents

Publication Publication Date Title
CN106331098B (en) Server cluster system
CN113014634B (en) Cluster election processing method, device, equipment and storage medium
CN108847982B (en) Distributed storage cluster and node fault switching method and device thereof
CN109960634B (en) Application program monitoring method, device and system
JPS61500751A (en) Method for stopping program processes in multiprocessing systems
CN112506702B (en) Disaster recovery method, device, equipment and storage medium for data center
CN103036719A (en) Cross-regional service disaster method and device based on main cluster servers
EP3671461A1 (en) Systems and methods of monitoring software application processes
CN107995029A (en) Elect control method and device, electoral machinery and device
CN111459639B (en) Distributed task management platform and method supporting global multi-machine room deployment
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN113660350A (en) Distributed lock coordination method, device, equipment and storage medium
CN111752488B (en) Management method and device of storage cluster, management node and storage medium
CN112333249A (en) Business service system and method
CN110635941A (en) Database node cluster fault migration method and device
CN111342986B (en) Distributed node management method and device, distributed system and storage medium
CN106506278B (en) Service availability monitoring method and device
US9973569B2 (en) System, method and computing apparatus to manage process in cloud infrastructure
CN116346834A (en) Session synchronization method, device, computing equipment and computer storage medium
CN111309515A (en) Disaster recovery control method, device and system
CN114422335A (en) Communication method, communication device, server and storage medium
CN116668269A (en) Arbitration method, device and system for dual-activity data center
CN115145782A (en) Server switching method, mooseFS system and storage medium
CN110266790B (en) Edge cluster management method and device, edge cluster and readable storage medium
CN109474694A (en) A kind of management-control method and device of the NAS cluster based on SAN storage array

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination