CN117130719A - Data source switching method, device, electronic equipment and computer readable medium - Google Patents

Data source switching method, device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN117130719A
CN117130719A CN202210549564.5A CN202210549564A CN117130719A CN 117130719 A CN117130719 A CN 117130719A CN 202210549564 A CN202210549564 A CN 202210549564A CN 117130719 A CN117130719 A CN 117130719A
Authority
CN
China
Prior art keywords
cluster
index information
operation index
switching
data source
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
CN202210549564.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 Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi 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 Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202210549564.5A priority Critical patent/CN117130719A/en
Publication of CN117130719A publication Critical patent/CN117130719A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the disclosure discloses a data source switching method, a data source switching device, electronic equipment and a computer readable medium. One embodiment of the method comprises the following steps: generating a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster; responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster; determining whether the cluster operates abnormally according to the operation index information set; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation. The embodiment reduces the error reporting times when processing the data request and shortens the time for switching the clusters.

Description

Data source switching method, device, electronic equipment and computer readable medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a data source switching method, a data source switching device, an electronic device, and a computer readable medium.
Background
With the development of computer technology, the data volume of various application platforms is gradually increased, and clusters are needed to store data. To meet user access requirements under traffic peaks, dual clusters may be employed to store data. Currently, when switching between dual clusters, the following methods are generally adopted: when one cluster is not available, it is manually switched to another cluster.
However, when switching between dual clusters in the above manner, there are often the following technical problems: the cluster is not available and is switched to another cluster, so that the error times are high when the data request is processed, and the cluster is switched manually, so that the cluster switching time is long.
Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a data source switching method, apparatus, electronic device, and computer readable medium to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a data source switching method, the method including: generating a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster; responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster; determining whether the cluster operates abnormally according to the operation index information set; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation.
Optionally, the cluster configuration information includes a task execution period; and executing the cluster operation index information acquisition task to obtain an operation index information set in response to the cluster operation index information acquisition task meeting a preset trigger condition, including: and executing the cluster operation index information acquisition task to obtain an operation index information set in response to the current time being the task execution time corresponding to the task execution period.
Optionally, the determining whether the cluster is abnormal according to the operation index information set includes: generating cluster operation health corresponding to the clusters according to the operation index information set; and determining that the cluster operation is abnormal in response to the cluster operation health degree meeting a preset cluster operation health degree abnormal condition.
Optionally, the determining whether the cluster is abnormal according to the operation index information set includes: generating a cluster running state type corresponding to the cluster according to the running index information set; and determining the cluster operation abnormality in response to the cluster operation state type being a cluster operation state abnormality type.
Optionally, the method further comprises: and storing the operation index information set.
Optionally, in response to determining that the cluster is abnormal in operation, switching the candidate cluster to a data source corresponding to the data request of the cluster includes: responding to the determined abnormal cluster operation, and sending cluster switching prompt information to a terminal of a user account corresponding to the cluster configuration information; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to receiving the confirmation switching operation information record corresponding to the cluster switching prompt information.
Optionally, the switching the candidate cluster to a data source corresponding to the data request of the cluster includes: and synchronizing the cluster switching information to a distributed coordination system, so that a server side of the cluster request data monitors the cluster switching information in the distributed coordination system to switch the data request address, wherein the cluster switching information comprises the cluster address of the alternative cluster.
In a second aspect, some embodiments of the present disclosure provide a data source switching apparatus, the apparatus comprising: the generating unit is configured to generate a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster; the execution unit is configured to respond to the cluster operation index information acquisition task meeting a preset trigger condition, execute the cluster operation index information acquisition task and obtain an operation index information set corresponding to the cluster; a determining unit configured to determine whether the cluster is abnormal according to the operation index information set; and the switching unit is configured to switch the alternative cluster into a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation.
Optionally, the cluster configuration information includes a task execution period.
Optionally, the execution unit is further configured to: and executing the cluster operation index information acquisition task to obtain an operation index information set in response to the current time being the task execution time corresponding to the task execution period.
Optionally, the determining unit is further configured to: generating cluster operation health corresponding to the clusters according to the operation index information set; and determining that the cluster operation is abnormal in response to the cluster operation health degree meeting a preset cluster operation health degree abnormal condition.
Optionally, the determining unit is further configured to: generating a cluster running state type corresponding to the cluster according to the running index information set; and determining the cluster operation abnormality in response to the cluster operation state type being a cluster operation state abnormality type.
Optionally, the data source switching device further includes: and a storage unit configured to store the operation index information set.
Optionally, the switching unit is further configured to: responding to the determined abnormal cluster operation, and sending cluster switching prompt information to a terminal of a user account corresponding to the cluster configuration information; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to receiving the confirmation switching operation information record corresponding to the cluster switching prompt information.
Optionally, the switching unit is further configured to: and synchronizing the cluster switching information to a distributed coordination system, so that a server side of the cluster request data monitors the cluster switching information in the distributed coordination system to switch the data request address, wherein the cluster switching information comprises the cluster address of the alternative cluster.
In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors causes the one or more processors to implement the method described in any of the implementations of the first aspect above.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
The above embodiments of the present disclosure have the following advantageous effects: by the data source switching method of some embodiments of the present disclosure, the number of errors in processing the data request is reduced, and the duration of switching clusters is shortened. Specifically, the reason why the number of errors in processing the data request is large and the cluster switching time is long is that: the cluster is not available and is switched to another cluster, so that the error times are high when the data request is processed, and the cluster is switched manually, so that the cluster switching time is long. Based on this, in the data source switching method according to some embodiments of the present disclosure, first, a cluster operation index information acquisition task corresponding to the above cluster is generated according to the received cluster configuration information of the cluster. Wherein the clusters correspond to alternative clusters. Therefore, the cluster operation index information acquisition task for acquiring the operation related index data of the cluster can be automatically generated according to the cluster configuration information. And then, responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster. Therefore, the operation index information set can be acquired after the generated cluster operation index information acquisition task triggers the corresponding trigger condition. And then, determining whether the cluster operates abnormally or not according to the operation index information set. Therefore, the running state of the cluster can be judged according to the current running related index data of the cluster. And finally, switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation. Thus, when the current running state of the cluster is abnormal, the alternative cluster of the current cluster can be switched to the data source of the data request. And because the running state of the cluster is judged by the current running related index data of the cluster, the abnormal state in the running of the cluster can be identified, and then the data source can be automatically switched in the running of the cluster. Therefore, the number of times of error reporting when processing the data request is reduced, and the time for switching the clusters is shortened.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a schematic illustration of one application scenario of a data source switching method according to some embodiments of the present disclosure;
FIG. 2 is a flow chart of some embodiments of a data source switching method according to the present disclosure;
FIG. 3 is a flow chart of further embodiments of a data source switching method according to the present disclosure;
FIG. 4 is a flow chart of yet other embodiments of a data source switching method according to the present disclosure;
FIG. 5 is a schematic diagram of the structure of some embodiments of a data source switching device according to the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of an application scenario of a data source switching method according to some embodiments of the present disclosure.
In the application scenario of fig. 1, first, the computing device 101 may generate, according to the received cluster configuration information 103 of the cluster 102, a cluster operation index information acquisition task 104 corresponding to the cluster 102. Wherein the clusters 102 correspond to alternative clusters 105. Then, the computing device 101 may execute the cluster operation index information acquisition task 104 in response to the cluster operation index information acquisition task 104 satisfying a preset trigger condition, to obtain the operation index information set 106 corresponding to the cluster 102. Thereafter, the computing device 101 may determine whether the cluster 102 is operating abnormally based on the set of operating metrics information 106. Finally, computing device 101 may switch the candidate cluster 105 to a data source corresponding to the data request of the cluster 102 in response to determining that the cluster 102 is abnormally operated.
The computing device 101 may be hardware or software. When the computing device is hardware, the computing device may be implemented as a distributed cluster formed by a plurality of servers or terminal devices, or may be implemented as a single server or a single terminal device. When the computing device is embodied as software, it may be installed in the hardware devices listed above. It may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention is not particularly limited herein.
It should be understood that the number of computing devices in fig. 1 is merely illustrative. There may be any number of computing devices, as desired for an implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a data source switching method according to the present disclosure is shown. The data source switching method comprises the following steps:
step 201, generating a cluster operation index information acquisition task of a corresponding cluster according to the received cluster configuration information of the cluster.
In some embodiments, an execution body of the data source switching method (for example, the computing device 101 shown in fig. 1) may generate, according to the received cluster configuration information of the cluster, a cluster operation index information acquisition task corresponding to the above-mentioned cluster. Wherein the cluster may be a collection of devices for deploying a distributed database. The cluster configuration information may be related parameters configured by the user for the cluster, and may include: cluster identification, cluster connection information and identification of an alternative cluster corresponding to the cluster identification. The cluster configuration information may also include, but is not limited to, at least one of the following: user name, user password. For example, the cluster configuration information may be various parameters configured and submitted by the user through the cluster configuration page of the web end. The cluster configuration page may be a page for a user to fill in various cluster-related parameters. The cluster identifier may uniquely represent the cluster, and may be, for example, a name of the cluster. The cluster connection information may be information for connecting the clusters, and may be, for example, URL (Uniform Resource Locator, uniform resource locator system) of the clusters. The alternative cluster may be a cluster that may replace the cluster response request. For example, when the cluster is a master cluster, the candidate cluster may be a slave cluster corresponding to the master cluster. When the cluster is a slave cluster, the candidate cluster may be a master cluster corresponding to the slave cluster. The user name may be an account name of a user submitting the cluster configuration information. The user password may be an account password of the user submitting the cluster configuration information.
In practice, the execution body may register the cluster operation index information acquisition task corresponding to the cluster locally. In practice, the execution body may generate the cluster operation index information acquisition task corresponding to the cluster through a dynamic byte code generation technology. The task for obtaining the cluster operation index information may be a task for obtaining operation index information of each cluster node in the cluster. The operation index information may be information related to a performance index of the device when the cluster node operates, and may include, but is not limited to, at least one of the following: occupancy rate of the central processing unit, occupancy rate of the memory, utilization rate of the disk, inquiry rate per second and garbage recovery time. The garbage collection time period may be an object collection time period of a garbage collector of Java. Therefore, the cluster operation index information acquisition task for acquiring the operation related index data of the cluster can be automatically generated according to the cluster configuration information.
Step 202, executing the cluster operation index information acquisition task to obtain an operation index information set of a corresponding cluster in response to the cluster operation index information acquisition task meeting a preset trigger condition.
In some embodiments, the executing body may execute the cluster operation index information acquisition task to obtain the operation index information set corresponding to the cluster in response to the cluster operation index information acquisition task meeting a preset trigger condition. The preset trigger condition may be "the current time detects a task execution operation acting on the cluster operation index information acquisition task". The task execution operation may be an operation of determining to execute the cluster operation index information acquisition task. For example, the user may click on a control corresponding to the cluster operation index information acquisition task, so that the cluster operation index information acquisition task is executed. Therefore, the operation index information set can be acquired after the generated cluster operation index information acquisition task triggers the corresponding trigger condition.
In some optional implementations of some embodiments, the cluster configuration information may include a task execution period. The task execution period may represent an execution period of the cluster operation index information acquisition task. For example, the task execution cycle may be "8 points, 10 points, 14 points, 16 points per day". The execution body may execute the cluster operation index information acquisition task in response to the current time being a task execution time corresponding to the task execution period, to obtain an operation index information set. In practice, the executing body may determine that the cluster operation index information acquiring task meets the preset trigger condition in response to the current time being a task execution time corresponding to the task execution period. And then, executing the cluster operation index information acquisition task to obtain an operation index information set. The task execution time may be a task execution time corresponding to the task execution period. For example, the task execution times corresponding to the above-described task execution periods "8 points, 10 points, 14 points, and 16 points per day" are 8 points, 10 points, 14 points, and 16 points. As an example, when the current time is 8 points, the execution body may execute the task of obtaining the cluster operation index information to obtain an operation index information set. Therefore, the cluster operation index information acquisition task can be automatically executed to acquire the operation index information set of the cluster.
Step 203, determining whether the cluster is abnormal according to the operation index information set.
In some embodiments, the execution body may determine whether the cluster is abnormally operated according to the operation index information set. In practice, the operation index information in the operation index information set may include an occupancy rate of the central processing unit, a memory occupancy rate, a disk utilization rate, and a query rate per second. First, the execution body may determine the maximum cpu occupancy rate included in the operation index information set as a target cpu occupancy rate. Then, the maximum memory occupancy rate included in the operation index information set may be determined as the target memory occupancy rate. Then, the maximum disk utilization rate included in the operation index information set may be determined as the target disk utilization rate. Second, the minimum query rate per second included in the above-described operation index information set may be determined as the target query rate per second. Finally, the cluster operation anomaly may be determined in response to determining that the target central processing unit occupancy rate is greater than a preset central processing unit occupancy rate, the target memory occupancy rate is greater than a preset memory occupancy rate, the target disk utilization rate is greater than a preset disk utilization rate, and the target query rate per second is less than a preset query rate per second. Here, specific settings for presetting the cpu occupancy rate, presetting the memory occupancy rate, presetting the disk utilization rate, and presetting the inquiry rate per second are not limited. Therefore, the running state of the cluster can be judged according to the current running related index data of the cluster.
In some optional implementations of some embodiments, first, the execution body may generate a cluster operation health corresponding to the cluster according to the operation index information set. In practice, the execution subject may generate the cluster operation health corresponding to the cluster by:
the first step, determining the largest central processing unit occupancy rate, memory occupancy rate, disk utilization rate and garbage collection time length included in each operation index information in the operation index information set as a central processing unit parameter, a memory parameter, a disk parameter and a garbage collection parameter respectively.
And secondly, determining the minimum query rate per second included in each piece of operation index information in the operation index information set as a query parameter.
And thirdly, inputting the central processing unit parameters, the memory parameters, the disk parameters, the garbage collection parameters and the query parameters into a pre-trained cluster operation health degree generation model to obtain the cluster operation health degree corresponding to the clusters. The cluster operation health degree generation model may be a regression model using a central processing unit parameter, a memory parameter, a disk parameter, a garbage collection parameter and a query parameter as input data and using the cluster operation health degree as output data. For example, the cluster operation health degree generation model may be a regression model obtained by fitting a regression algorithm to each historical central processing unit parameter, historical memory parameter, historical disk parameter, historical garbage collection parameter and historical query parameter. The regression algorithm may be a stepwise regression algorithm.
Then, the cluster operation anomaly may be determined in response to the cluster operation health satisfying a preset cluster operation health anomaly condition. The abnormal condition of the preset cluster operation health degree may be that the cluster operation health degree is smaller than or equal to a preset cluster operation health degree threshold. Here, the specific setting of the preset cluster operation health threshold is not limited.
Thus, whether the cluster is abnormal or not can be determined through the quantified cluster operation health.
In some optional implementations of some embodiments, first, the execution body may generate a cluster running state type corresponding to the cluster according to the running index information set. In practice, the execution body may input each operation index information in the operation index information set to a pre-trained cluster operation state type generation model to obtain a cluster operation state type. The cluster operation state type generation model may be a classification model using an operation index information set as input data and a cluster operation state type corresponding to the operation index information set as output data. For example, the cluster operation state type generation model may be a classification model obtained by training each set of historical operation index information and the historical cluster operation state type corresponding to each set of operation index information by using a classification algorithm. For example, the classification algorithm may be a decision tree algorithm.
Then, the cluster operation anomaly may be determined in response to the cluster operation state type being a cluster operation state anomaly class. The cluster operation state exception class may be a class that characterizes the cluster operation exception.
Therefore, whether the cluster runs abnormally or not can be directly determined through the generated cluster running state type.
In response to determining that the cluster is operating abnormally, the alternative cluster is switched to the data source of the data request of the corresponding cluster, step 204.
In some embodiments, the execution body may switch the candidate cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormally operated. The data request may be a network request for requesting to acquire data from the cluster. In practice, the manner in which the execution body switches the candidate cluster to the data source corresponding to the data request of the cluster may be: and redirecting the data request corresponding to the cluster URL of the alternative cluster. Thus, when the current running state of the cluster is abnormal, the alternative cluster of the current cluster can be switched to the data source of the data request.
Alternatively, the execution body may store the operation index information set. In practice, the execution body may store the running index information set locally. The execution body may store the operation index information set in a distributed database. Thus, the stored operation index information set can be used as a historical operation index information set for training of the cluster operation health generation model or the cluster operation state type generation model.
The above embodiments of the present disclosure have the following advantageous effects: by the data source switching method of some embodiments of the present disclosure, the number of errors in processing the data request is reduced, and the duration of switching clusters is shortened. Specifically, the reason why the number of errors in processing the data request is large and the cluster switching time is long is that: the cluster is not available and is switched to another cluster, so that the error times are high when the data request is processed, and the cluster is switched manually, so that the cluster switching time is long. Based on this, in the data source switching method according to some embodiments of the present disclosure, first, a cluster operation index information acquisition task corresponding to the above cluster is generated according to the received cluster configuration information of the cluster. Wherein the clusters correspond to alternative clusters. Therefore, the cluster operation index information acquisition task for acquiring the operation related index data of the cluster can be automatically generated according to the cluster configuration information. And then, responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster. Therefore, the operation index information set can be acquired after the generated cluster operation index information acquisition task triggers the corresponding trigger condition. And then, determining whether the cluster operates abnormally or not according to the operation index information set. Therefore, the running state of the cluster can be judged according to the current running related index data of the cluster. And finally, switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation. Thus, when the current running state of the cluster is abnormal, the alternative cluster of the current cluster can be switched to the data source of the data request. And because the running state of the cluster is judged by the current running related index data of the cluster, the abnormal state in the running of the cluster can be identified, and then the data source can be automatically switched in the running of the cluster. Therefore, the number of times of error reporting when processing the data request is reduced, and the time for switching the clusters is shortened.
With further reference to FIG. 3, a flow 300 of further embodiments of a data source switching method is shown. The flow 300 of the data source switching method includes the following steps:
step 301, generating a cluster operation index information acquisition task of a corresponding cluster according to the received cluster configuration information of the cluster.
Step 302, executing the cluster operation index information acquisition task to obtain an operation index information set of a corresponding cluster in response to the cluster operation index information acquisition task meeting a preset trigger condition.
Step 303, determining whether the cluster is abnormal according to the operation index information set.
In some embodiments, the specific implementation of steps 301 to 303 and the technical effects thereof may refer to steps 201 to 203 in those embodiments corresponding to fig. 2, which are not described herein.
And step 304, in response to determining that the cluster operation is abnormal, the cluster switching prompt information is sent to the terminal of the user account corresponding to the cluster configuration information.
In some embodiments, an execution body of the data source switching method (e.g., the computing device 101 shown in fig. 1) may send cluster switching prompt information to a terminal of a user account corresponding to the cluster configuration information in response to determining that the cluster is abnormal. The cluster switching prompt information may be information for prompting the user to switch the cluster serving as the data source, and may include, but is not limited to: the identification of the cluster currently serving as the data source, the identification of the cluster needing to be switched, and the running state of the cluster currently serving as the data source. For example, the cluster switch prompt message may be "cluster 1 is running abnormally, please confirm whether to switch to cluster 2". The user account may be an account logged into a cluster configuration page. The terminal of the user account may be a terminal in which the user account is currently logged in. The terminal can display cluster switching prompt information. In practice, the executing body may send the cluster switching prompt information to the terminal of the user account corresponding to the cluster configuration information through a wired connection mode or a wireless connection mode. Therefore, the terminal of the user account can display cluster switching prompt information so as to prompt the user to manually switch the clusters.
In step 305, in response to receiving the record of the confirm switch operation of the corresponding cluster switch prompt information, the candidate cluster is switched to the data source of the data request of the corresponding cluster.
In some embodiments, the executing entity may switch the candidate cluster to a data source corresponding to the data request of the cluster in response to receiving the confirmation switch operation information record corresponding to the cluster switch prompt information. The information record for confirming the switching operation may be an information record representing the user confirmation switching cluster generated by the terminal after the user performs the operation for confirming the switching cluster. For example, the above-described confirmation switching operation information record may be "Y". Here, the specific expression of the confirmation switching operation information record is not limited. In practice, the manner in which the execution body switches the candidate cluster to the data source corresponding to the data request of the cluster may refer to step 204 in the embodiments corresponding to fig. 2, which is not described herein again.
As can be seen in fig. 3, the flow 300 of the data source switching method in some embodiments corresponding to fig. 3 embodies the step of expanding the cluster switching hint information as compared to the description of some embodiments corresponding to fig. 2. Therefore, the schemes described in the embodiments can enable the terminal of the user account to display cluster switching prompt information so as to prompt the user to manually switch the clusters. Therefore, when the user confirms to switch the clusters through the terminal, the alternative clusters can be switched to the data sources corresponding to the data requests of the clusters. Further, the user may manually switch clusters of data sources that are data requests when the clusters are out of operation.
With further reference to fig. 4, a flow 400 of still further embodiments of a data source switching method is shown. The flow 400 of the data source switching method includes the following steps:
step 401, generating a cluster operation index information acquisition task of a corresponding cluster according to the received cluster configuration information of the cluster.
And step 402, executing the cluster operation index information acquisition task to obtain an operation index information set of a corresponding cluster in response to the cluster operation index information acquisition task meeting a preset trigger condition.
Step 403, determining whether the cluster is abnormal according to the operation index information set.
In some embodiments, the specific implementation of the steps 401 to 403 and the technical effects thereof may refer to the steps 201 to 203 in those embodiments corresponding to fig. 2, which are not described herein.
Step 404, synchronizing cluster switching information to the distributed coordination system.
In some embodiments, an execution body of the data source switching method (e.g., the computing device 101 shown in fig. 1) may synchronize cluster switching information to a distributed coordination system, so that a server that requests data from the cluster listens to the cluster switching information in the distributed coordination system to switch the data request address. The distributed coordination system may refer to a system for providing a consistency service for a distributed application. For example, the distributed coordination system may be a zookeeper. The cluster switching information may be information for switching the current cluster. The cluster switching information may include a cluster address of the candidate cluster. The cluster address may be a URL of a cluster.
As can be seen in fig. 4, the flow 400 of the data source switching method in some embodiments corresponding to fig. 4 embodies the step of expanding the cluster switching information as compared to the description of some embodiments corresponding to fig. 2. Therefore, the schemes described in the embodiments can enable a server side requesting data from a cluster to monitor cluster switching information in a distributed coordination system so as to automatically switch a data request address.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present disclosure provides some embodiments of a data source switching apparatus, which apparatus embodiments correspond to those method embodiments shown in fig. 2, and which apparatus is particularly applicable in various electronic devices.
As shown in fig. 5, the data source switching apparatus 500 of some embodiments includes: a generating unit 501, an executing unit 502, a determining unit 503, and a switching unit 504. The generating unit 501 is configured to generate a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, where the cluster corresponds to an alternative cluster; the execution unit 502 is configured to execute the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster in response to the cluster operation index information acquisition task meeting a preset trigger condition; the determining unit 503 is configured to determine whether the cluster is abnormal according to the operation index information set; the switching unit 504 is configured to switch the candidate cluster to a data source corresponding to a data request of the cluster in response to determining that the cluster is abnormally operated.
Optionally, the cluster configuration information includes a task execution period.
Optionally, the execution unit 502 may be further configured to: and executing the cluster operation index information acquisition task to obtain an operation index information set in response to the current time being the task execution time corresponding to the task execution period.
Optionally, the determining unit 503 may be further configured to: generating cluster operation health corresponding to the clusters according to the operation index information set; and determining that the cluster operation is abnormal in response to the cluster operation health degree meeting a preset cluster operation health degree abnormal condition.
Optionally, the determining unit 503 may be further configured to: generating a cluster running state type corresponding to the cluster according to the running index information set; and determining the cluster operation abnormality in response to the cluster operation state type being a cluster operation state abnormality type.
Optionally, the data source switching apparatus 500 may further include: a storage unit (not shown) configured to store the operation index information set.
Optionally, the switching unit 504 may be further configured to: responding to the determined abnormal cluster operation, and sending cluster switching prompt information to a terminal of a user account corresponding to the cluster configuration information; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to receiving the confirmation switching operation information record corresponding to the cluster switching prompt information.
Optionally, the switching unit 504 may be further configured to: and synchronizing the cluster switching information to a distributed coordination system, so that a server side of the cluster request data monitors the cluster switching information in the distributed coordination system to switch the data request address, wherein the cluster switching information comprises the cluster address of the alternative cluster.
It will be appreciated that the elements described in the apparatus 500 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting benefits described above with respect to the method are equally applicable to the apparatus 500 and the units contained therein, and are not described in detail herein.
Referring now to FIG. 6, a schematic diagram of an electronic device 600 (e.g., computing device 101 of FIG. 1) suitable for use in implementing some embodiments of the disclosure is shown. The electronic device shown in fig. 6 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 6 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications device 609, or from storage device 608, or from ROM 602. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 601.
It should be noted that, the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: generating a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster; responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster; determining whether the cluster operates abnormally according to the operation index information set; and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor comprising: the device comprises a generating unit, an executing unit, a determining unit and a switching unit. The names of these units do not limit the unit itself in some cases, and the determining unit may also be described as "a unit that determines whether the cluster is abnormal or not running according to the running index information set".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (10)

1. A data source switching method, comprising:
generating a cluster operation index information acquisition task corresponding to a cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster;
responding to the cluster operation index information acquisition task meeting a preset triggering condition, and executing the cluster operation index information acquisition task to obtain an operation index information set corresponding to the cluster;
determining whether the cluster operates abnormally according to the operation index information set;
and switching the alternative cluster to a data source corresponding to the data request of the cluster in response to determining that the cluster is abnormal in operation.
2. The method of claim 1, wherein the cluster configuration information includes a task execution period; and
the responding to the cluster operation index information obtaining task meeting a preset triggering condition, executing the cluster operation index information obtaining task to obtain an operation index information set, including:
and executing the cluster operation index information acquisition task to obtain an operation index information set in response to the current time being the task execution time corresponding to the task execution period.
3. The method of claim 1, wherein the determining whether the cluster is abnormally operated according to the set of operation index information comprises:
generating cluster operation health corresponding to the clusters according to the operation index information set;
and determining that the cluster operation is abnormal in response to the cluster operation health degree meeting a preset cluster operation health degree abnormal condition.
4. The method of claim 1, wherein the determining whether the cluster is abnormally operated according to the set of operation index information comprises:
generating a cluster running state type corresponding to the cluster according to the running index information set;
and determining that the cluster operation is abnormal in response to the cluster operation state type being a cluster operation state abnormal type.
5. The method of claim 1, wherein the method further comprises:
and storing the operation index information set.
6. The method of claim 1, wherein the switching the alternative cluster to the data source corresponding to the data request of the cluster in response to determining that the cluster is abnormally operated comprises:
responding to the determined abnormal cluster operation, and sending cluster switching prompt information to a terminal of a user account corresponding to the cluster configuration information;
And switching the alternative cluster to a data source corresponding to the data request of the cluster in response to receiving the confirmation switching operation information record corresponding to the cluster switching prompt information.
7. The method of claim 1 or 6, wherein the switching the alternative cluster to the data source corresponding to the data request of the cluster comprises:
and synchronizing cluster switching information to a distributed coordination system, so that a server side requesting data from the clusters monitors the cluster switching information in the distributed coordination system to switch data request addresses, wherein the cluster switching information comprises cluster addresses of the alternative clusters.
8. A data source switching apparatus comprising:
the generating unit is configured to generate a cluster operation index information acquisition task corresponding to the cluster according to the received cluster configuration information of the cluster, wherein the cluster corresponds to an alternative cluster;
the execution unit is configured to respond to the cluster operation index information acquisition task meeting a preset trigger condition, execute the cluster operation index information acquisition task and obtain an operation index information set corresponding to the cluster;
A determining unit configured to determine whether the cluster is abnormal in operation according to the operation index information set;
and a switching unit configured to switch the alternative cluster to a data source corresponding to a data request of the cluster in response to determining that the cluster is abnormally operated.
9. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1-7.
CN202210549564.5A 2022-05-20 2022-05-20 Data source switching method, device, electronic equipment and computer readable medium Pending CN117130719A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210549564.5A CN117130719A (en) 2022-05-20 2022-05-20 Data source switching method, device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210549564.5A CN117130719A (en) 2022-05-20 2022-05-20 Data source switching method, device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN117130719A true CN117130719A (en) 2023-11-28

Family

ID=88856942

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210549564.5A Pending CN117130719A (en) 2022-05-20 2022-05-20 Data source switching method, device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN117130719A (en)

Similar Documents

Publication Publication Date Title
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN112256733A (en) Data caching method and device, electronic equipment and computer readable storage medium
CN114513552B (en) Data processing method, device, equipment and storage medium
CN111161072A (en) Block chain-based random number generation method, equipment and storage medium
CN113553206B (en) Data event execution method and device, electronic equipment and computer readable medium
CN113420400B (en) Routing relation establishment method, request processing method, device and equipment
CN117130719A (en) Data source switching method, device, electronic equipment and computer readable medium
CN112507676B (en) Method and device for generating energy report, electronic equipment and computer readable medium
CN113378041B (en) Prompt message pushing method, device, electronic equipment and computer readable medium
CN115996187A (en) Routing information processing method and device, routing information interaction system and routing equipment
CN114679472A (en) Communication system, method, apparatus, storage medium, and electronic device
CN112307071A (en) Monitoring data acquisition method and device, electronic equipment and computer readable medium
CN114035861A (en) Cluster configuration method and device, electronic equipment and computer readable medium
CN112256714A (en) Data synchronization method and device, electronic equipment and computer readable medium
CN112559087B (en) Information generation method, apparatus, electronic device and computer readable medium
CN114172946B (en) Request result sending method, device, electronic equipment and computer readable medium
CN116894538B (en) Node carbon emission information generation method and device, electronic equipment and medium
CN112311833B (en) Data updating method and device
CN113472565B (en) Method, apparatus, device and computer readable medium for expanding server function
CN115292081B (en) Information sending method, device, electronic equipment and medium
CN113850988B (en) Key value correction method, device, equipment and computer readable medium
CN113486968B (en) Method, device, equipment and medium for monitoring life cycle of camera
CN118158082B (en) Method, device, equipment and medium for updating communication resource message of intelligent household equipment
CN112822247B (en) System asynchronous communication method, device, electronic equipment and computer readable medium

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