Data processing method and device, electronic equipment and computer readable storage medium

By automatically judging the proportion of abnormal database instances and switching to the target computer room, the problem of difficulty in master-slave switching in the existing technology of master-slave replication architecture in complex business scenarios is solved, and the self-awareness of computer room-level failures and core service access is realized. Assure.

CN119094313APending Publication Date: 2024-12-06DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411190936.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing database cluster with master-slave replication architecture is difficult to adapt to different levels of cluster redundancy and data consistency requirements when the business usage scenarios are complex, resulting in a lot of manual repair work required during master-slave switching, and it is difficult to identify computer room-level faults. and ensure core business access.

Method used

By determining the proportion of abnormal database instances, when the preset threshold is reached, it is determined to be a computer room-level network failure, and the database instance is automatically switched to the target computer room, and the traffic load priority is allocated according to the service priority.

Benefits of technology

It realizes self-judgment and self-perception of network failures in the computer room, reduces manual repair work, and ensures that core business access is not affected during major network failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094313A_ABST
    Figure CN119094313A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method and device, electronic equipment and a computer readable storage medium, and relates to the technical field of data processing. The data processing method comprises the following steps: determining database exception instances in at least two machine rooms and distribution of the database exception instances in the at least two machine rooms; determining the proportion of the database exception instances of each machine room in the at least two machine rooms; when the proportion of the database abnormal instances of at least one machine room in the at least two machine rooms reaches a first preset threshold value, determining the at least one machine room as an abnormal machine room; the abnormal machine room is a machine room with a machine room-level network fault; determining a target machine room in the at least two machine rooms; and switching each database instance in the abnormal machine room to the target machine room based on a preset priority of a service corresponding to each database instance in the abnormal machine room. According to the invention, machine room switching can be carried out on the premise of guaranteeing different service priorities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, device, electronic device and computer-readable storage medium. Background Art

[0002] Database technology is an important branch of computer science and technology, mainly used to solve non-numerical computing problems in data processing. As the most effective means of data management, it has greatly promoted the development of computer applications. The master-slave structure of a database is a database architecture model, which mainly consists of two parts: a master database and a slave database. In this architecture, the master database is the database instance responsible for processing read and write requests, that is, the master-slave instance. The slave database is a database instance that replicates the data and operations in the master database, that is, a read-only instance. The main advantages of this architecture model are that it can improve the read and write performance of the database, improve data availability, and achieve real-time data backup.

[0003] In the related art, for the database cluster of the master-slave replication architecture described above, when a fault occurs that requires a master-slave switch, the exception handling of the read-only instance and the grouping of the read-only instance need to be handled by the user based on a general switching solution. If there are multiple sets of database clusters, the master-slave switching action also needs to be performed on multiple clusters in sequence. However, in the case of complex business usage scenarios, due to the different redundancy of instances in cluster computer rooms at different levels and different requirements for data consistency, the above-mentioned general switching solution cannot adapt to the existence of multiple differentiated clusters. When using this switching solution for master-slave switching, a large amount of manual post-repair work is required. Summary of the invention

[0004] According to a first aspect of the present disclosure, a data processing method is provided, comprising: determining database abnormal instances in at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms; determining the proportion of the database abnormal instances in each of the at least two computer rooms based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms; when the proportion of the database abnormal instances in at least one of the at least two computer rooms reaches a first preset threshold, determining that the at least one computer room is an abnormal computer room; the abnormal computer room is a computer room with a computer room-level network failure; determining a target computer room among the at least two computer rooms; and switching each of the database instances in the abnormal computer room to the target computer room based on the preset priority of the services corresponding to each database instance in the abnormal computer room.

[0005] According to a second aspect of the present disclosure, a data processing device is provided, comprising: a determination module, used to determine database abnormality instances in at least two computer rooms and the distribution of the database abnormality instances in the at least two computer rooms; the determination module is also used to determine the proportion of the database abnormality instances in each of the at least two computer rooms based on the database abnormality instances in the at least two computer rooms and the distribution of the database abnormality instances in the at least two computer rooms; the determination module is also used to determine that at least one computer room is an abnormal computer room when the proportion of the database abnormality instances in at least one computer room of the at least two computer rooms reaches a first preset threshold; the abnormal computer room is a computer room with a computer room-level network failure; the determination module is also used to determine a target computer room among the at least two computer rooms; a switching module is used to switch each of the database instances in the abnormal computer room to the target computer room based on the preset priority of the services corresponding to each of the database instances in the abnormal computer room.

[0006] According to a third aspect of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory storing a program, wherein the program comprises instructions, which, when executed by the processor, cause the processor to perform the above-mentioned data processing method.

[0007] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the above-mentioned data processing method.

[0008] The exemplary embodiments of the present disclosure may have some or all of the following beneficial effects:

[0009] In the data processing method provided by the exemplary implementation of the present disclosure, the database abnormal instances in at least two computer rooms and the distribution of the database abnormal instances in at least two computer rooms are determined; the proportion of the database abnormal instances in each of the at least two computer rooms is determined based on the database abnormal instances in at least two computer rooms and the distribution of the database abnormal instances in at least two computer rooms; when the proportion of the database abnormal instances in at least one computer room in at least two computer rooms reaches a first preset threshold, at least one computer room is determined to be an abnormal computer room; wherein the abnormal computer room is a computer room with a computer room-level network failure; the target computer room in at least two computer rooms is determined; based on the preset priority of the corresponding business of each database instance in the abnormal computer room, each database instance in the abnormal computer room is switched to the target computer room. In the embodiment of the present disclosure, by determining the proportion of the database abnormal instances in the computer room, and when the proportion of the database abnormal instances reaches the preset threshold, the current fault is determined to be a computer room-level network failure, so as to realize the self-judgment and self-perception of the computer room network failure; at the same time, when performing the computer room switching, the present disclosure takes into account the preset priority of each database instance, so as to ensure that the traffic load priority of the corresponding data database instance does not degenerate after the switching is completed. Furthermore, during major network failure switching, access to core services can be prioritized.

[0010] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0012] Figure 1 A flow chart of a data processing method according to an exemplary embodiment of the present disclosure is shown;

[0013] Figure 2 A flowchart showing another data processing method according to an exemplary embodiment of the present disclosure is shown;

[0014] Figure 3 A flow chart of a method for switching a computer room before a failure is shown according to a specific embodiment of an exemplary embodiment of the present disclosure;

[0015] Figure 4 A flow chart of a method for switching within a cluster according to a specific embodiment of an exemplary embodiment of the present disclosure is shown;

[0016] Figure 5 A flow chart of a method for switching a computer room after a failure according to a specific embodiment of an exemplary embodiment of the present disclosure is shown;

[0017] Figure 6A schematic block diagram of a data processing device according to an exemplary embodiment of the present disclosure is shown;

[0018] Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0020] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0021] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0024] Database technology is an important branch of computer science and technology, mainly used to solve non-numerical computing problems in data processing. As the most effective means of data management, it has greatly promoted the development of computer applications. The master-slave structure of a database is a database architecture model, which mainly consists of two parts: a master database and a slave database. In this architecture, the master database is the database instance responsible for processing read and write requests, that is, the master-slave instance. The slave database is a database instance that replicates the data and operations in the master database, that is, a read-only instance. The main advantages of this architecture model are that it can improve the read and write performance of the database, improve data availability, and achieve real-time data backup.

[0025] In the scenario of database products, what is usually delivered is a database cluster with a master-slave replication architecture, which only distinguishes between master and slave instances and read-only instances. When a fault occurs that requires master-slave switching, the cluster is switched from master to slave. The exception handling of read-only instances and the grouping of read-only instances need to be handled by the user. If there are multiple database clusters, the master-slave switching action also needs to be performed on multiple clusters in sequence. This is the current mainstream delivery solution, which manages an individual. These individuals have different configurations due to different user usage methods and business complexity. For example, read-only instances are distinguished as offline, and whether semi-synchronization is enabled between the master and the slave. Therefore, operations within the individual need to be completed by the user.

[0026] However, in the case of complex business usage scenarios, due to the offline multi-entry access of the cluster, different levels of cluster room instances have different redundancy and different requirements for data consistency, the above-mentioned general single switching solution is slightly weak in the face of such a cluster with multiple differences, and requires a lot of manual post-repair work. For example, room-level switching, when the target room instance is insufficient, how to ensure that the capacity of the business read request is not degraded or which priority is guaranteed in the case of insufficient capacity; how to identify a single room failure in a network failure, rather than a single cluster switch that is determined to be an abnormality of an individual instance of the cluster; in response to the above problems, hundreds of database clusters with different topological configurations can be built, and existing technologies usually require limited room-level switching to be achieved under planning that conforms to standard usage.

[0027] In order to solve the above problems, the embodiments of the present disclosure provide a data processing method, device, electronic device and computer-readable storage medium. The following describes the solutions of the present disclosure with reference to the accompanying drawings.

[0028] The present disclosure first provides a data processing method. Figure 1 As shown, the data processing method specifically includes the following steps:

[0029] S110: Determine abnormal database instances in at least two computer rooms and the distribution of abnormal database instances in at least two computer rooms;

[0030] S120: Determine a proportion of database abnormal instances in each of the at least two computer rooms based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms;

[0031] S130: When the proportion of abnormal database instances in at least one of the at least two computer rooms reaches a first preset threshold, determine that at least one computer room is an abnormal computer room; wherein the abnormal computer room is a computer room with a computer room-level network failure;

[0032] S140: Determine a target computer room among at least two computer rooms;

[0033] S150: Based on the preset priorities of the services corresponding to the database instances in the abnormal computer room, the database instances in the abnormal computer room are switched to the target computer room.

[0034] In the embodiment of the present disclosure, by determining the proportion of abnormal database instances in the computer room, and when the proportion of abnormal database instances reaches a preset threshold, the current fault is determined as a computer room-level network fault, thereby achieving self-judgment and self-perception of computer room network faults; at the same time, when performing computer room switching, the present disclosure takes into account the preset priority of each database instance, ensuring that the traffic load priority of the corresponding data database instance does not degrade after the switching is completed. Furthermore, in the process of switching a major network fault, access to core services can be prioritized.

[0035] Next, in another embodiment, the above steps are described in more detail.

[0036] In step S110, abnormal database instances in at least two computer rooms and distribution of abnormal database instances in at least two computer rooms are determined.

[0037] In the embodiments of the present disclosure, the above-mentioned computer room refers to telecommunications, Netcom, mobile, dual-line, power, government or enterprise, etc., where servers are stored and IT services are provided to users and employees.

[0038] In the disclosed embodiment, the above-mentioned database is a warehouse for storing data, and is a computer software system that stores and manages data according to a data structure. Exemplarily, the above-mentioned database can be a MySQL database. The master-slave architecture of MySQL refers to the establishment of two completely identical databases, one of which is the main database and the other is a secondary database. They generally store more important data in the enterprise, and need to be configured with a master-slave to prevent data loss due to database server downtime, while ensuring the quality of service when there is too much business volume, too much data, and too many visitors. The master-slave can also provide functions such as fault switching, read-write separation, and backup.

[0039] In the disclosed embodiment, the database architecture mode of the above database can be a master-slave structure. In this architecture, the master database is a database instance responsible for processing read and write requests, that is, a master-slave instance. The slave database is a database instance that replicates the data and operations in the master database and can only be responsible for read requests, that is, a read-only instance. The main advantages of this architecture mode are that it can improve the read and write performance of the database, improve the availability of data, and realize real-time backup of data.

[0040] In the embodiments of the present disclosure, a database instance refers to a running instance of a database system, which is composed of a database server process and corresponding system resources (such as memory, disk space, and system files). The instance includes all operating system environments required to run the database. The database instance is the basis for database operation. It includes one or more background processes, which are used to process various requests from the database, such as user query requests, data write requests, etc. In addition, the database instance also includes shared memory for storing cached data, lock information, etc. of the database.

[0041] In the embodiments of the present disclosure, the above-mentioned abnormal database instance refers to a database instance that cannot provide services normally due to network failure, computer room failure, natural disasters, etc.

[0042] In the embodiment of the present disclosure, the above-mentioned determination of database abnormality instances in at least two computer rooms and the distribution of database abnormality instances in at least two computer rooms can be achieved by the following method: obtaining the heartbeat of each database instance in at least two computer rooms and the master-slave replication relationship of the database; based on the heartbeat of each database instance and the master-slave replication relationship of the database, determining the database abnormality instances in at least two computer rooms and the distribution of database abnormality instances in at least two computer rooms.

[0043] For example, the heartbeat of each database instance and the master-slave replication relationship of the database can be reported to the server program by the physical software (Agent) corresponding to each database instance. The Agent is usually a physical software that can perform tasks autonomously and can actively notify the server program of the latest work progress of the database instance according to the agreement.

[0044] In step S120, the proportion of database abnormal instances in each of the at least two computer rooms is determined based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms.

[0045] In an embodiment of the present disclosure, after obtaining the database anomaly instances in the at least two computer rooms and the distribution of the database anomaly instances in the at least two computer rooms, further, the proportion of database anomaly instances in each of the at least two computer rooms can be determined based on the database anomaly instances in the at least two computer rooms and the distribution of the database anomaly instances in the at least two computer rooms.

[0046] Exemplarily, the above-mentioned determination of the proportion of database anomaly instances in each of at least two computer rooms can be implemented as follows: determine the computer room where the database anomaly instance is located through the distribution of the database anomaly instances in at least two computer rooms, and in each computer room, determine the proportion of database anomaly instances in each of at least two computer rooms by calculating the ratio of the database anomaly instance to all database instances.

[0047] In step S130, when the proportion of database abnormal instances in at least one of the at least two computer rooms reaches a first preset threshold, at least one computer room is determined to be an abnormal computer room; wherein the abnormal computer room is a computer room with a computer room-level network failure.

[0048] In the embodiment of the present disclosure, the above-mentioned first preset threshold is a parameter used to determine whether there is a fault in the computer room. Exemplarily, the first preset threshold can be set by the computer room fault configuration, and the computer room fault configuration mainly involves aspects such as the physical environment, power supply configuration, hardware inspection, and daily maintenance process of the computer room. Exemplarily, the first preset threshold can be set during the computer room fault configuration process. When the proportion of abnormal database instances in the computer room is greater than the first preset threshold, the computer room is determined to be an abnormal computer room.

[0049] Taking the above-mentioned MySQL database as an example, the process of determining the proportion of abnormal database instances in each computer room and determining the abnormal computer room through the proportion of abnormal database instances in the computer room can be implemented as follows: the Agent corresponding to the database instance reports the heartbeat of the database instance to the central service, and also reports to the central service whether the replication relationship between the master-slave architecture of the MySQL database is connected; through the above-mentioned star-shaped connectivity network, the central service blurs the concept of cluster and judges the abnormal situation of the database instances in each cluster. If the abnormal instance is a small range in a single computer room, it is determined to be a cluster-level fault; if the abnormal instance is all instances in a single computer room, it is determined to be a computer room-level fault.

[0050] Through the above process, it can be determined whether the current network is a local network failure or a computer room network failure, and which computer room the failure is in. In addition, in the above process, in addition to judging the heartbeat report of each instance, the embodiment of the present disclosure also introduces the judgment of the master-slave relationship of the cluster. Through bypass interpretation, it avoids the situation where the report is abnormal due to the master instance report abnormality, the central service jitter, etc.; and realizes the self-judgment and self-perception of the computer room network failure.

[0051] In step S140, a target computer room among at least two computer rooms is determined.

[0052] In the embodiment of the present disclosure, the target computer room is a computer room that provides database services after executing computer room switching when a computer room-level failure occurs, and the target computer room does not have a computer room failure.

[0053] In the embodiment of the present disclosure, the process of determining the target computer room among the at least two computer rooms can be determined based on the distribution of database abnormal instances in the at least two computer rooms. For example, when it is determined that there is no abnormal instance in the corresponding computer room through the distribution of database abnormal instances in the computer room, the computer room can be determined as the target computer room.

[0054] In step S150, each database instance in the abnormal computer room is switched to the target computer room based on the preset priority of the service corresponding to each database instance in the abnormal computer room.

[0055] In the embodiment of the present disclosure, the above preset priority is used to define the priority of the business corresponding to the database instance.

[0056] In the disclosed embodiment, the process of switching each database instance in the abnormal computer room to the target computer room based on the preset priority of the business corresponding to each database instance in the abnormal computer room can be implemented as follows: obtaining a preset concurrency, which is the number of clusters for a single parallel switching that is preset, that is, the number of clusters switched each time; obtaining a full cluster list corresponding to the abnormal computer room, which includes the clusters in the abnormal computer room and the instance information of the database instances corresponding to each cluster; within the cluster corresponding to the abnormal computer room, switching each database instance to the target computer room based on the preset concurrency and the full cluster list.

[0057] In the disclosed embodiment, the above-mentioned full cluster list can be obtained from the metadata database. The above-mentioned metadata database is a database of data about other data. It contains information about data structure, data meaning, data source and their relationship. In the metadata database, metadata is used to describe data, provide data management, support data search and retrieval, and ensure data quality. The core role of the metadata database is to help organizations manage and utilize data resources more efficiently. That is, the above-mentioned full cluster list can be obtained from the metadata, and the full cluster list includes cluster information of all clusters in the abnormal computer room, as well as instance information of each data implementation example in the cluster.

[0058] In the disclosed embodiment, by allocating the database instances in the target computer room after the computer room switching to the corresponding services according to the priority, it is ensured that the database instances are preferentially allocated to the services with higher priority when the overall instances of the cluster are reduced.

[0059] Exemplarily, the above-mentioned effect of allocating the database instances in the target computer room after the computer room switching to the corresponding services according to the priority can be achieved by grouping the embodiments in the target computer room according to the priority to obtain instance groups of different priorities. For example, in the cluster corresponding to the abnormal computer room, based on the preset concurrency and the full cluster list, the process of switching each database instance to the target computer room can be implemented as follows: based on the full cluster list, the instance information of each database instance in the corresponding cluster is obtained; the target instance in the target computer room is determined, and the target instance is divided into multiple instance groups, wherein the priority of each instance group is different, and the target instance is the database instance that provides services for the upper-layer business after the computer room is switched; based on the instance information, the preset priority of each database instance is determined, and each database instance is switched to the corresponding instance group in the target computer room based on the preset priority.

[0060] Exemplarily, the above-mentioned instance grouping may include an online instance group and an offline instance group, wherein the priority of the online instance group is higher than that of the offline instance group. Then, when the number of target instances in the online instance group reaches the second preset threshold, the above-mentioned process of instance grouping the target instances in the target computer room may be implemented as follows: when the number of target instances in the online instance group reaches the second preset threshold, determine whether the number of target instances in the offline instance group reaches the third preset threshold; if the number of target instances in the offline instance group reaches the third preset threshold, determine the instance grouping based on the number of target instances in the online instance group and the number of target instances in the offline instance group; if the number of target instances in the offline instance group does not reach the third preset threshold, determine the redundant number of target instances in the online instance group; if the redundant number of target instances in the online instance group is greater than the fourth preset threshold, adjust the preset number of target instances in the online instance group to the target instances in the offline instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group and the number of target instances in the offline instance group.

[0061] When the number of target instances in the online instance group does not reach the second preset threshold, the above-mentioned process of instance grouping the target instances in the target computer room can be implemented as follows: when the number of target instances in the online instance group does not reach the second preset threshold, determine the difference between the number of target instances in the online instance group and the second preset threshold; determine whether the number of target instances in the offline instance group is greater than the difference; if the number of target instances in the offline instance group is greater than the difference, adjust the preset number of target instances in the offline instance group to the target instances in the online instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group and the number of target instances in the offline instance group; if the number of target instances in the offline instance group is greater than the difference, adjust all target instances in the offline instance group to the target instances in the online instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group.

[0062] The above data processing method is used to implement the switch of the computer room after a computer room failure occurs. In practical applications, for computer room problems that can be predicted in advance, such as Figure 2 As shown, the embodiment of the present disclosure can also perform machine room switching by following steps:

[0063] S210: Receive a machine room switching instruction.

[0064] In the embodiment of the present disclosure, the above-mentioned computer room switching instruction is used to evoke computer room switching. Exemplarily, when the computer room failure can be predicted in advance, the user can trigger the computer room switching instruction through the manual operation platform before the computer room failure occurs. Exemplarily, the user can trigger the above-mentioned computer room switching instruction through the control provided by the manual operation platform. After receiving the computer room switching instruction triggered by the user, the manual operation platform can trigger the subsequent computer room switching.

[0065] S220: In response to the computer room switching instruction, obtain a full cluster list corresponding to the preset concurrency and the abnormal computer room.

[0066] S230: In the cluster corresponding to the abnormal computer room, based on the preset concurrency and the full cluster list, each database instance is switched to the target computer room.

[0067] S240: Determine the number of clusters in which switching fails.

[0068] In the embodiment of the present disclosure, during the switching of the computer room, abnormal network or frequent switching failures due to unknown errors may occur. In order to avoid the complication of the fault problem, the embodiment of the present disclosure can also timely interrupt the switching action and roll back the pre-switching operation based on the anti-shake strategy. The number of clusters that failed to switch is the judgment criterion of the anti-shake strategy.

[0069] S250: When the number of clusters in which switching fails meets a preset condition, the switching is terminated.

[0070] In the embodiment of the present disclosure, the above-mentioned preset condition is the above-mentioned anti-shake strategy. Exemplarily, when the number of clusters that fail to switch meets the preset condition, the process of terminating the switching can be implemented as follows: when the number of clusters that have completed the switching is greater than the fifth preset threshold, and the proportion of clusters that fail to switch is greater than the sixth preset threshold, the switching is terminated.

[0071] Specifically, the anti-shake strategy may be as follows: the configuration rules of the anti-shake strategy may be as follows: configure the minimum number of anti-shake clusters, that is, the fifth preset threshold, assuming it is 10, and configure the sixth preset threshold to 20%. Then, under the anti-shake strategy, when switching 100 clusters, the preset conditions may be as follows: if the number of clusters that have completed the switching is n and is greater than 10, when the number of clusters that have failed to switch is less than n*0.2, ignore the clusters that have failed to switch and continue to execute the switching task; when the number of clusters that have failed to switch is greater than n*0.2, it is deemed that an unknown error has occurred, the switching is terminated, the clusters that have completed the switching are not processed, and the clusters being switched are rolled back.

[0072] Below, in a specific embodiment, taking the MySQL master-slave replication architecture as an example, the above data processing method is described in detail:

[0073] First, the idea involved in this specific embodiment is explained:

[0074] Computer room network judgment: used to judge whether the current network is a local network failure or a computer room network failure, and which computer room the failure is in. The implementation idea is: each database instance has an agent corresponding to it, and the corresponding agent reports the heartbeat of the database instance and the connectivity of the replication relationship between the MySQL master-slave architecture to the central service; through these star-shaped connectivity networks, the central service blurs the concept of clusters and judges the abnormal conditions of hundreds of clusters and thousands of instances. If the abnormal instance is a small range in a single computer room, it is judged as a cluster-level failure; if the abnormal instance is all instances in a single computer room, it is judged as a computer room-level failure.

[0075] Traffic priority satisfaction: It is used to transform the roles of the existing computer room instances through the pre-set group priority when the overall cluster instances are reduced during the computer room switching process, giving priority to the access needs of high-priority services. The implementation idea is: different service access levels are different. When resources are squeezed, the rights and interests of higher-priority services are prioritized; in the upper-level services, different services access the database through different links. When the upper-level service requests fall on different database instances, different instance roles can be distinguished through the link whitelist permission group; when necessary, the database instances of other groups are cleared of existing whitelist permissions, and the new whitelist permission group is authorized according to the priority to complete the role transformation, so as to transform some or all of the database instances of ordinary services into the whitelist permission group to provide services for higher-priority services.

[0076] It should be noted that the above traffic priority process needs to meet the principle of mutual exclusion. That is, a database instance can only have one set of whitelist permission groups and can only serve one set of upper-layer service requests at the same time, so as to avoid resource competition among services in different groups.

[0077] Data synchronization global switch: This is the general switch that downgrades the cluster replication relationship of MySQL semi-synchronous replication to asynchronous. It is used to ensure the data consistency of the cluster with semi-synchronous replication enabled while ensuring the business write performance in different network abnormality scenarios. The implementation idea is: use MySQL native semi-synchronous replication configuration, turn on the semi-synchronous configuration of the master instance and the slave instance in the different data center from the master instance, and configure the semi-synchronous timeout to 86400s. Since this time is much longer than the stop loss time, it will not completely degenerate to asynchronous replication in theory.

[0078] The above timeout settings need to be reasonably set according to the actual situation. If it is set too small, the master database may frequently enter the asynchronous replication mode; if it is set too large, it may increase the delay time of the master database.

[0079] The above MySQL semi-synchronous replication means that after the master database executes the transaction submitted by the client, it does not return to the client immediately, but waits for at least one slave database to receive and write it before returning to the client. MySQL asynchronous replication means that after the master database submits the transaction, it returns it directly to the client without waiting for the confirmation of the slave database. Asynchronous replication has low data security and there is a risk of data loss.

[0080] Switching anti-shake: In the scenario where abnormal network occurs or frequent switching failures are caused by unknown errors, the switching action is interrupted in time based on the anti-shake strategy, and the pre-switching operation is rolled back to avoid the complication of the fault problem. This anti-shake strategy is mainly used in the scenario where the failure of the computer room can be predicted and the user actively triggers the switching of the computer room before the failure occurs. Its implementation idea is: configure the minimum number of anti-shake clusters, assuming it is 10, and configure the anti-shake strategy threshold to 20%; under this configuration rule, when switching 100 clusters, if the number of clusters that have completed the switching is n and greater than 10, when the number of clusters that failed to switch is less than n*0.2, ignore the clusters that failed to switch and continue to execute the switching task. When the number of clusters that failed to switch is greater than n*0.2, it is considered that an unknown error has occurred, the switching is terminated, the clusters that have completed the switching are not processed, and the clusters in the switching are rolled back.

[0081] Next, the process of switching the computer room based on the above data processing method is described in detail in combination with the ideas of network judgment of the computer room, traffic priority satisfaction, global switch of data synchronization and switching anti-shake:

[0082] Specifically, the above-mentioned computer room switching may include two scenarios: pre-failure switching and post-failure switching.

[0083] The above-mentioned pre-failure switching is that when the computer room failure can be predicted, before the computer room failure occurs, the user performs database switching through the manual operation platform. This switching process is mainly implemented based on the switching anti-shake idea. Figure 3 As shown, the computer room switching process can be implemented as follows:

[0084] S310: Receive a machine room switching instruction.

[0085] S320: Obtain the cluster concurrency of the computer room switching and the target computer room.

[0086] In this specific embodiment, the cluster concurrency is the number of clusters that are switched each time. The computer room switching can be divided into multiple subtasks through the cluster concurrency. For example, when 100 clusters need to be switched to the target computer room, if the cluster concurrency is set to 10, the computer room switching can be divided into 10 subtasks through the cluster concurrency, and the computer room switching is completed by performing 10 rounds of cluster switching.

[0087] S330: Obtain a full cluster list from the metadata database, and initiate cluster switching based on cluster concurrency.

[0088] S340: Shield the middleware instances except the target computer room.

[0089] In this specific embodiment, the above-mentioned middleware instance is a middleware instance between a database instance and an upper-layer service, and is used to provide intermediate services for read and write requests between the database instance and the upper-layer service.

[0090] S350: Determine the target instance in the target computer room and perform intra-cluster switching.

[0091] S360: When the current subtask switching is completed, it is determined whether the number of clusters that failed to switch in the subtask satisfies the above-mentioned switching anti-shake strategy.

[0092] In this specific embodiment, if the number of clusters that fail to switch in the above subtask meets the above switching anti-shake strategy, then continue to execute S370; if the number of clusters that fail to switch in the above subtask does not meet the above switching anti-shake strategy, then return to execute S350.

[0093] S370: Terminate the switching.

[0094] In this specific embodiment, Figure 4 As shown, the above S350 "determine the target instance in the target computer room and switch within the cluster" is a process of master-slave switching and traffic distribution adjustment within a cluster after the central service initiates the switching process, which mainly involves the above traffic priority satisfaction idea. Exemplarily, the above process can be implemented through the following steps:

[0095] S410: Acquire instance information of each database instance in the cluster from the metadata repository.

[0096] In this specific embodiment, the instance information can be obtained from the above-mentioned full cluster list. The instance information may include information such as role, status and computer room. Exemplarily, the above-mentioned roles include master instance, online slave instance and offline instance, wherein the master instance is the master database instance, and the online slave instance has a higher priority than the offline instance. The above-mentioned status refers to whether the current status of the database instance is a normal instance or an abnormal instance. The above-mentioned computer room refers to the computer room to which the database instance belongs.

[0097] S420: Determine a target instance in a target computer room.

[0098] In this specific embodiment, the target instance is an instance in the target computer room that replaces the abnormal instance to provide services for the corresponding upper-layer business.

[0099] S430: Divide the target instance into three groups: a master instance group, an online slave instance group, and an offline instance group.

[0100] S440: Determine whether the number of online slave instance groups reaches the minimum number of online instances configured.

[0101] In this specific embodiment, the above-mentioned minimum number of online instances is configured as a pre-configured minimum number of instances that satisfies the service corresponding to the online instance. If the number of instances of the online slave instance group reaches the minimum number of online instances, then continue to execute S450; otherwise, continue to execute S460.

[0102] S450: Determine whether there is an instance in the offline instance group.

[0103] In this specific embodiment, it can be determined whether there is an instance in the offline instance group by determining whether the number of instances in the offline instance group is greater than or equal to 1. If there is no instance in the offline instance group, S470 is continued to be executed; if there is an instance in the offline instance group, S490 is continued to be executed.

[0104] S460: Converting instances in the offline instance group to instances in the online slave instance group based on preset rules.

[0105] In this specific embodiment, the preset rule may be: retain one instance in the offline instance group, and convert the other instances into online slave instances and add them to the online slave instance group. It should be noted that if the number of instances in the offline instance group is less than the gap in the online slave instance group, all instances in the offline instance group are converted into online slave instances and added to the online slave instance group.

[0106] S470: Determine whether there is a redundant instance in the online slave instance group.

[0107] In this specific embodiment, if there is a redundant instance in the online slave instance group, then S480 is continued to be executed; otherwise, S490 is continued to be executed.

[0108] S480: Convert a redundant instance in the online slave instance group into an offline instance, and add the instance to the offline instance group.

[0109] S490: Perform intra-cluster switching based on the adjusted instance grouping topology.

[0110] In addition, this specific embodiment can also automatically switch the computer room after a computer room failure occurs. This scenario is mainly when there is network jitter and a major network failure or computer room failure, the central service determines the scope of the failure and automatically initiates the corresponding switching process. This switching process mainly designs the above-mentioned computer room network judgment and data synchronization global switch idea. Figure 5 As shown, the post-failure switching can be achieved by the following steps:

[0111] S510: Determine whether there is a network failure.

[0112] In this specific embodiment, the accuracy of network fault judgment can be improved by repeatedly executing the judgment process for multiple times. The process can be implemented based on the database instance heartbeat reported by the Agent corresponding to the database instance and the master-slave replication relationship of MySQL.

[0113] In the above-mentioned computer room network judgment process, in addition to judging the heartbeat report of each instance, this specific embodiment also introduces the judgment of the master-slave relationship of the cluster. Through bypass judgment, it avoids the situation where the master instance reports abnormally, the central service jitter, etc. cause abnormal reports; and realizes self-judgment and self-perception of computer room network failures.

[0114] S520: When a network failure occurs, obtain database abnormality instances and their distribution in the computer room.

[0115] S530: Determine whether the proportion of abnormal instances is lower than the equipment room fault configuration.

[0116] In this specific embodiment, the above-mentioned computer room fault configuration is the configuration of the above-mentioned first preset threshold, and the first preset threshold is used to determine whether the current network fault is a cluster-level fault or a computer room-level fault. Specifically, if the abnormal instance ratio is lower than the computer room fault configuration, the current network fault is determined to be a cluster-level fault, and S540 is continued to be executed; if the abnormal instance ratio is not lower than the computer room fault configuration, the current network fault is determined to be a computer room-level fault, and S550 is continued to be executed.

[0117] S540: Disable the global semi-synchronous service.

[0118] In this specific embodiment, the global semi-synchronous switch of the database is used to ensure the consistency of data in the computer room. Different from the traditional automatic degradation of MySQL and asynchronous replication, this solution combines the computer room network judgment module and integrates the semi-synchronous switch in the central service. When a major computer room network failure occurs, the global semi-synchronous switch is turned on to ensure the data consistency between the two computer rooms; when a small range of network jitter occurs, the global semi-synchronous switch is turned off to ensure the normal writing of business data.

[0119] S550: Determine a target computer room based on the distribution of abnormal instances in the computer rooms.

[0120] S560: Switch the computer room.

[0121] In this specific embodiment, the step of switching the computer room is implemented by the above-mentioned methods S320 to S350, which will not be described in detail here.

[0122] It should be noted that, since the current fault is a machine room level fault, there is no need to perform steps S360 and S370 to perform switching anti-shake judgment. That is, machine room switching must be performed in this scenario.

[0123] This specific embodiment is applicable to switching of large-scale business clusters, and ensures data consistency in the computer room through global synchronization switches. At the same time, through the preset cluster grouping configuration, it is ensured that the load priority of the read traffic of the online instance is not degraded after the switching is completed.

[0124] The present disclosure also provides a data processing device. Figure 6 As shown, the data processing device 600 may include a determination module 610 and a switching module 620, wherein:

[0125] A determination module 610, configured to determine database anomaly instances in at least two computer rooms and distribution of database anomaly instances in at least two computer rooms;

[0126] The determination module 610 is further configured to determine a proportion of database abnormal instances in each of the at least two computer rooms based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms;

[0127] The determination module 610 is further configured to determine that at least one computer room is an abnormal computer room when the proportion of abnormal database instances in at least one computer room among the at least two computer rooms reaches a first preset threshold; the abnormal computer room is a computer room with a computer room-level network failure;

[0128] The determination module 610 is further used to determine a target computer room among the at least two computer rooms;

[0129] The switching module 620 is used to switch each database instance in the abnormal computer room to the target computer room based on the preset priority of the business corresponding to each database instance in the abnormal computer room.

[0130] In the embodiment of the present disclosure, the above-mentioned determination module is specifically used to: obtain the heartbeat of each database instance in at least two computer rooms and the master-slave replication relationship of the database; based on the heartbeat of each database instance and the master-slave replication relationship of the database, determine the database abnormal instances in at least two computer rooms and the distribution of the database abnormal instances in at least two computer rooms.

[0131] In the embodiment of the present disclosure, the above-mentioned determination module is specifically used to: determine the target computer room among at least two computer rooms based on the distribution of database abnormal instances in at least two computer rooms; then the above-mentioned switching module is specifically used to: obtain a preset concurrency; the preset concurrency is the number of clusters for a single parallel switching that is preset; the cluster includes multiple database instances; obtain a full cluster list corresponding to the abnormal computer room; the full cluster list includes instance information of database instances corresponding to each cluster in the abnormal computer room; within the cluster corresponding to the abnormal computer room, switch each database instance to the target computer room based on the preset concurrency and the full cluster list.

[0132] In the embodiment of the present disclosure, the above-mentioned switching module is specifically used to: obtain instance information of each database instance in the corresponding cluster based on the full cluster list; determine the target instance in the target computer room, and divide the target instance into multiple instance groups; each instance group has a different priority; determine the preset priority of each database instance based on the instance information, and switch each database instance to the corresponding instance group in the target computer room based on the preset priority.

[0133] In an embodiment of the present disclosure, the above-mentioned instance grouping includes an online instance group and an offline instance group; the above-mentioned switching module is specifically used to: when the number of target instances in the online instance group reaches a second preset threshold, determine whether the number of target instances in the offline instance group reaches a third preset threshold; if the number of target instances in the offline instance group reaches the third preset threshold, determine the instance grouping based on the number of target instances in the online instance group and the number of target instances in the offline instance group; if the number of target instances in the offline instance group does not reach the third preset threshold, determine the redundant number of target instances in the online instance group; if the redundant number of target instances in the online instance group is greater than the fourth preset threshold, adjust the preset number of target instances in the online instance group to the target instances in the offline instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group and the number of target instances in the offline instance group.

[0134] In an embodiment of the present disclosure, the above-mentioned instance grouping includes an online instance group and an offline instance group; the above-mentioned switching module is specifically used to: when the number of target instances in the online instance group does not reach the second preset threshold, determine the difference between the number of target instances in the online instance group and the second preset threshold; determine whether the number of target instances in the offline instance group is greater than the difference; if the number of target instances in the offline instance group is greater than the difference, adjust the preset number of target instances in the offline instance group to the target instances in the online instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group and the number of target instances in the offline instance group; if the number of target instances in the offline instance group is greater than the difference, adjust all target instances in the offline instance group to the target instances in the online instance group, and determine the instance grouping based on the adjusted number of target instances in the online instance group.

[0135] In an embodiment of the present disclosure, the above-mentioned data processing device also includes a receiving module, which is used to receive a computer room switching instruction; then the above-mentioned switching module is also specifically used to: respond to the computer room switching instruction, obtain a preset concurrency and a full cluster list corresponding to the abnormal computer room; the preset concurrency is the number of clusters for a single parallel switch that is preset; the cluster includes multiple database instances; the full cluster list includes instance information of database instances corresponding to each cluster in the abnormal computer room; within the cluster corresponding to the abnormal computer room, based on the preset concurrency and the full cluster list, each database instance is switched to the target computer room; determine the number of clusters that failed to switch; when the number of clusters that failed to switch meets a preset condition, terminate the switching.

[0136] In the embodiment of the present disclosure, the switching module is specifically used to terminate the switching when the number of clusters that have completed the switching is greater than a fifth preset threshold and the proportion of clusters that have failed the switching is greater than a sixth preset threshold.

[0137] In addition, the specific implementation details of the above-mentioned data processing device have been described in detail in the corresponding position of the data processing method, so they will not be repeated here.

[0138] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0139] The exemplary embodiment of the present disclosure also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication. The memory stores a computer program that can be executed by the at least one processor, and the computer program is used to cause the electronic device to perform the method according to the embodiment of the present disclosure when executed by the at least one processor.

[0140] The exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform the method according to the embodiments of the present disclosure.

[0141] The exemplary embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, the computer is used to enable the computer to perform the method according to the embodiments of the present disclosure.

[0142] refer to Figure 7, a block diagram of an electronic device 700 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0143] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0144] A plurality of components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the electronic device 700, and the input unit 706 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 may be any type of device capable of presenting information, and may include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 may include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0145] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, Figures 1 to 5 The corresponding method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 may be configured to perform the above data processing method in any other appropriate manner (e.g., by means of firmware).

[0146] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0147] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0148] As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0149] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0150] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by 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), and the Internet.

[0151] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

Claims

1. A data processing method, characterized in that: include: Determine database anomaly instances in at least two computer rooms and distribution of the database anomaly instances in the at least two computer rooms; Determine a proportion of the database abnormal instances in each of the at least two computer rooms based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms; When the proportion of abnormal database instances in at least one of the at least two computer rooms reaches a first preset threshold, the at least one computer room is determined to be an abnormal computer room; the abnormal computer room is a computer room with a computer room-level network failure; Determining a target computer room among the at least two computer rooms; Based on the preset priority of the services corresponding to the database instances in the abnormal computer room, the database instances in the abnormal computer room are switched to the target computer room.

2. The data processing method according to claim 1, characterized in that: The determining of abnormal database instances in at least two computer rooms and distribution of the abnormal database instances in the at least two computer rooms includes: Obtaining the heartbeat of each database instance in the at least two computer rooms and the master-slave replication relationship of the database; Based on the heartbeat of each database instance and the master-slave replication relationship of the database, the abnormal database instances in the at least two computer rooms and the distribution of the abnormal database instances in the at least two computer rooms are determined.

3. The data processing method according to claim 1, characterized in that: The determining of the target computer room among the at least two computer rooms comprises: Determine a target computer room among the at least two computer rooms based on the distribution of the abnormal database instances in the at least two computer rooms; The switching of each of the database instances in the abnormal computer room to the target computer room based on the preset priority of the services corresponding to each of the database instances in the abnormal computer room includes: Obtaining a preset concurrency; the preset concurrency is the number of clusters that are preset for a single parallel switch; the cluster includes a plurality of the database instances; Obtain a full cluster list corresponding to the abnormal computer room; the full cluster list includes instance information of the database instance corresponding to each cluster in the abnormal computer room; In the cluster corresponding to the abnormal computer room, each of the database instances is switched to the target computer room based on the preset concurrency and the full cluster list.

4. The data processing method according to claim 3, characterized in that: The step of switching each of the database instances to the target computer room in the cluster corresponding to the abnormal computer room based on the preset concurrency and the full cluster list includes: Acquire the instance information of each of the database instances in the corresponding cluster based on the full cluster list; Determine a target instance in the target computer room, and divide the target instance into a plurality of instance groups; each instance group has a different priority; The preset priority of each of the database instances is determined based on the instance information, and each of the database instances is switched to the corresponding instance group in the target computer room based on the preset priority.

5. The data processing method according to claim 4, characterized in that: The instance grouping includes an online instance group and an offline instance group; and dividing the target instance into a plurality of instance groups includes: When the number of the target instances in the online instance group reaches a second preset threshold, determining whether the number of the target instances in the offline instance group reaches a third preset threshold; If the number of the target instances in the offline instance group reaches a third preset threshold, determining the instance grouping based on the number of the target instances in the online instance group and the number of the target instances in the offline instance group; If the number of the target instances in the offline instance group does not reach a third preset threshold, determining the redundant number of the target instances in the online instance group; If the redundant number of the target instances in the online instance group is greater than a fourth preset threshold, the preset number of target instances in the online instance group is adjusted to the target instances in the offline instance group, and the instance grouping is determined based on the adjusted number of the target instances in the online instance group and the number of the target instances in the offline instance group.

6. The data processing method according to claim 4, characterized in that: The instance grouping includes an online instance group and an offline instance group; and dividing the target instance into a plurality of instance groups includes: When the number of the target instances in the online instance group does not reach a second preset threshold, determining a difference between the number of the target instances in the online instance group and the second preset threshold; Determining whether the number of the target instances in the offline instance group is greater than the difference; If the number of the target instances in the offline instance group is greater than the difference, adjusting a preset number of the target instances in the offline instance group to the target instances in the online instance group, and determining the instance grouping based on the adjusted number of the target instances in the online instance group and the number of the target instances in the offline instance group; If the number of the target instances in the offline instance group is greater than the difference, all the target instances in the offline instance group are adjusted to the target instances in the online instance group, and the instance grouping is determined based on the adjusted number of the target instances in the online instance group.

7. The data processing method according to claim 1, characterized in that: The method further comprises: Receive room switching instructions; After receiving the computer room switching instruction, switching each of the database instances in the abnormal computer room to the target computer room based on the preset priority of the services corresponding to each of the database instances in the abnormal computer room includes: In response to the computer room switching instruction, a preset concurrency and a full cluster list corresponding to the abnormal computer room are obtained; the preset concurrency is the number of clusters for a single parallel switching that is preset; the cluster includes multiple database instances; the full cluster list includes instance information of the database instance corresponding to each cluster in the abnormal computer room; In the cluster corresponding to the abnormal computer room, based on the preset concurrency and the full cluster list, each of the database instances is switched to the target computer room; Determining the number of clusters for which switching fails; When the number of the clusters in which the switching fails meets a preset condition, the switching is terminated.

8. The data processing method according to claim 7, characterized in that: When the number of the clusters that fail to switch meets a preset condition, stopping switching each database instance to the target computer room includes: When the number of the clusters that have completed the switching is greater than a fifth preset threshold, and the proportion of the clusters that have failed the switching is greater than a sixth preset threshold, the switching is terminated.

9. A data processing device, characterized in that: include: A determination module, used to determine database anomaly instances in at least two computer rooms and the distribution of the database anomaly instances in the at least two computer rooms; The determination module is further configured to determine a proportion of the database abnormal instances in each of the at least two computer rooms based on the database abnormal instances in the at least two computer rooms and the distribution of the database abnormal instances in the at least two computer rooms; The determination module is further configured to determine that at least one computer room is an abnormal computer room when the proportion of abnormal database instances in at least one computer room among the at least two computer rooms reaches a first preset threshold; the abnormal computer room is a computer room with a computer room-level network failure; The determination module is further used to determine a target computer room among the at least two computer rooms; The switching module is used to switch each of the database instances in the abnormal computer room to the target computer room based on the preset priority of the services corresponding to each of the database instances in the abnormal computer room.

10. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.

Citation Information

Cited By

  • Fault processing method of cluster node, electronic equipment, medium and program product

    CN119728396A

  • Fault handling method for cluster nodes, electronic device, medium, and program product

    CN119728396B

  • Fault handling method for cluster node, and electronic device, medium and program product

    WO2026179147A1