Distributed database-oriented cluster state processing method and electronic equipment
Through real-time monitoring and automatic disposal of distributed database cluster status, the problem that the existing technology cannot effectively ensure the correctness of cluster status is solved, and the integrity and consistency of cluster data are achieved.
Patent Information
- Application Number
- CN202411730816.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art cannot effectively ensure the correctness of the distributed database cluster state, resulting in the possibility of mismatch and loss of cluster data.
By responding to cluster status monitoring instructions, determine the target cluster, obtain pre-set monitoring policies, monitor the cluster status in real time, and automatically handle the cluster status when the status does not meet expectations and the duration exceeds the preset time.
Real-time monitoring and automatic disposal of distributed database cluster status is realized to ensure the integrity and consistency of cluster data and avoid data confusion and loss.
Smart Images

Figure CN119621480A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a cluster state processing method and electronic device for a distributed database. Background Art
[0002] For distributed databases, the correct cluster status can ensure strong consistency under the multi-copy architecture, thereby avoiding cluster data confusion and loss due to cluster failures.
[0003] However, the current processing solution for cluster status cannot guarantee that cluster data will not be disordered or lost, which needs to be solved urgently. Summary of the invention
[0004] The embodiment of the present invention provides a cluster state processing method and electronic device for a distributed database to ensure that cluster data will not be disordered or lost.
[0005] According to one aspect of the present invention, a cluster state handling method for a distributed database is provided, which may include:
[0006] In response to a cluster status monitoring instruction for a distributed database, determining a target cluster in the distributed database that has a cluster status monitoring requirement;
[0007] Obtain the cluster status monitoring policy pre-set for the target cluster, and monitor the cluster status of the target cluster based on the cluster status monitoring policy;
[0008] If the cluster state does not conform to the expected state, and the duration of the cluster state not conforming to the expected state exceeds a preset duration, the cluster state is disposed as the expected state.
[0009] According to another aspect of the present invention, there is provided an electronic device, which may include:
[0010] at least one processor; and
[0011] a memory communicatively connected to at least one processor; wherein,
[0012] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor implements the cluster state handling method for distributed databases provided by any embodiment of the present invention when executing the computer program.
[0013] The technical solution of the embodiment of the present invention determines the target cluster in the distributed database that has the cluster status monitoring demand by responding to the cluster status monitoring instruction for the distributed database, thereby accurately determining the monitoring object of the cluster status; obtains the cluster status monitoring strategy pre-set for the target cluster, and monitors the cluster status of the target cluster based on the cluster status monitoring strategy, thereby realizing real-time monitoring of the cluster status; when the cluster status does not meet the expected status, and the duration of the cluster status not meeting the expected status exceeds the preset duration, the cluster status is disposed as the expected status, thereby realizing automatic disposal of the cluster status. The above technical solution can monitor the cluster status of the target cluster in the distributed database in real time, and automatically dispose of the cluster status after the cluster status does not meet the expected status and continues for a preset duration, thereby providing guarantee for the operation and maintenance of the distributed database, and ensuring that the cluster data will not be confused or lost.
[0014] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 This is a flow chart of a cluster state handling method for a distributed database provided in accordance with an embodiment of the present invention;
[0017] Figure 2 is a flow chart of another cluster state handling method for a distributed database provided according to an embodiment of the present invention;
[0018] Figure 3 is a flow chart of another cluster state handling method for a distributed database provided according to an embodiment of the present invention;
[0019] Figure 4 is a schematic diagram of an optional example of another cluster state handling method for a distributed database provided according to an embodiment of the present invention;
[0020] Figure 5 This is a structural block diagram of a cluster state processing device for distributed databases provided according to an embodiment of the present invention;
[0021] Figure 6It is a structural schematic diagram of an electronic device for implementing the cluster state handling method for a distributed database according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The situations of "target", "original", etc. are similar and will not be repeated here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] Figure 1 This is a flow chart of a cluster state handling method for a distributed database provided by an embodiment of the present invention. This embodiment can be applied to situations where the cluster state is monitored in real time and the cluster state is handled automatically. The method can be executed by a cluster state handling device for a distributed database provided by an embodiment of the present invention, which can be implemented by software and / or hardware, and can be integrated on an electronic device, which can be various user terminals or servers.
[0025] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:
[0026] S110 . In response to a cluster status monitoring instruction for a distributed database, determine a target cluster in the distributed database that has a cluster status monitoring requirement.
[0027] Among them, a distributed database can be understood as a database system that stores data on multiple physical nodes and manages data through distributed computing and storage technology. It should be noted that compared with traditional stand-alone databases, distributed databases have higher scalability and fault tolerance, and can handle large-scale data and high-concurrency access requests. On this basis, combined with the application scenarios that may be involved in the embodiments of the present invention, optionally, the distributed database can be an open source distributed structured query language (Distributed Structured Query Language, DSQL); of course, it can also be other types of distributed databases, which can be selected according to actual needs and are not specifically limited here.
[0028] The cluster status monitoring instruction can be understood as a cluster status instruction instructing to monitor at least part of the clusters in the distributed database. In response to the cluster status monitoring instruction, a target cluster with cluster status monitoring requirements in the distributed database is determined. In the embodiment of the present invention, the number of the target clusters can be one, two or more, which is related to the actual situation and is not specifically limited here.
[0029] S120: Obtain a cluster state monitoring policy pre-set for the target cluster, and monitor the cluster state of the target cluster based on the cluster state monitoring policy.
[0030] Among them, the cluster status monitoring strategy can be understood as a strategy that is pre-set for the target cluster to monitor the cluster status of the target cluster. In an embodiment of the present invention, optionally, the strategy can characterize the monitoring time and / or monitoring items, etc., which can be set according to actual needs and is not specifically limited here.
[0031] Acquire the cluster state monitoring policy. On this basis, in combination with the application scenarios that may be involved in the embodiments of the present invention, the target cluster includes a control node, and the cluster state monitoring policy can be pre-mounted on the control node, so the cluster state monitoring policy can be acquired from the control node.
[0032] S130: When the cluster state does not meet the expected state, and the duration of the cluster state not meeting the expected state exceeds a preset duration, the cluster state is treated as the expected state.
[0033] The expected state can be understood as the state of the preset desired target cluster, which can ensure the normal operation of the target cluster. In the embodiment of the present invention, the expected state can optionally include a synchronization state and / or a no-cut state, etc., which can be set according to actual needs and is not specifically limited here.
[0034] When the cluster status does not meet the expected status, and the duration of the cluster status not meeting the expected status has exceeded the preset duration, if this situation continues, it may cause the target cluster to fail, and further cause confusion and loss of cluster data in the target cluster. At this time, the cluster status can be automatically processed to the expected status, thereby ensuring the normal operation of the target cluster, and further ensuring that the cluster data in the target cluster will not be confused or lost.
[0035] On this basis, combined with the application scenarios that may be involved in the embodiments of the present invention, optionally, when the cluster state does not meet the expected state, an alarm can be issued in time to prompt manual intervention to avoid the cluster state that does not meet the expected state from continuing, thereby avoiding failure of the target cluster.
[0036] The technical solution of the embodiment of the present invention determines the target cluster in the distributed database that has the cluster status monitoring demand by responding to the cluster status monitoring instruction for the distributed database, thereby accurately determining the monitoring object of the cluster status; obtains the cluster status monitoring strategy pre-set for the target cluster, and monitors the cluster status of the target cluster based on the cluster status monitoring strategy, thereby realizing real-time monitoring of the cluster status; when the cluster status does not meet the expected status, and the duration of the cluster status not meeting the expected status exceeds the preset duration, the cluster status is disposed as the expected status, thereby realizing automatic disposal of the cluster status. The above technical solution can monitor the cluster status of the target cluster in the distributed database in real time, and automatically dispose of the cluster status after the cluster status does not meet the expected status and continues for a preset duration, thereby providing guarantee for the operation and maintenance of the distributed database, and ensuring that the cluster data will not be confused or lost.
[0037] On this basis, an optional technical solution is that the cluster state monitoring strategy includes cluster state monitoring items and threshold rules corresponding to the cluster state monitoring items;
[0038] Based on the cluster status monitoring policy, monitor the cluster status of the target cluster, including:
[0039] Based on cluster status monitoring items, monitor the cluster status of the target cluster;
[0040] After monitoring the cluster status of the target cluster, the cluster status handling method further includes:
[0041] Based on the threshold rules, determine whether the cluster status meets the expected status.
[0042] The above technical solution realizes accurate monitoring of the cluster status by applying cluster status monitoring items; on this basis, further, by applying threshold rules corresponding to the cluster status monitoring items, it realizes accurate judgment of whether the cluster status meets the expected status.
[0043] Figure 2 It is a flowchart of another cluster state handling method for distributed databases provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, after determining the target cluster in the distributed database where cluster state monitoring requirements exist, the above-mentioned cluster state handling method may also include: determining the target instance in the target cluster where cluster state monitoring requirements exist; monitoring the cluster state of the target cluster may include: obtaining the cluster state of the target cluster by monitoring the instance state of the target instance. Among them, the explanations of the terms that are the same as or corresponding to the above-mentioned embodiments are not repeated here.
[0044] See also Figure 2 The method of this embodiment may specifically include the following steps:
[0045] S210 . In response to a cluster status monitoring instruction for a distributed database, determine a target cluster in the distributed database that has a cluster status monitoring requirement.
[0046] S220: Determine a target instance in the target cluster that has a cluster status monitoring requirement.
[0047] Among them, multiple instances are allocated to the target cluster. The instance can be understood as a minimum unit of database service collection actually used by the user; the instance may be a distributed instance or a non-distributed instance, which is related to the actual situation and is not specifically limited here.
[0048] The target instance can be understood as an instance of all instances that have a cluster status monitoring requirement. In the embodiment of the present invention, the number of the target instance can be one, two or more, which depends on the actual situation and is not specifically limited here. The target instance is determined.
[0049] S230: Obtain a cluster state monitoring policy pre-set for the target cluster, and obtain the cluster state of the target cluster by monitoring the instance state of the target instance based on the cluster state monitoring policy.
[0050] Among them, since the target instance is an instance in the target cluster that has a cluster status monitoring requirement, the cluster status of the target cluster can be obtained by monitoring the instance status of the target instance.
[0051] S240: When the cluster state does not meet the expected state, and the duration of the cluster state not meeting the expected state exceeds a preset duration, the cluster state is treated as the expected state.
[0052] The technical solution of the embodiment of the present invention determines a target instance in the target cluster that has a cluster status monitoring requirement, and then obtains the cluster status of the target cluster by monitoring the instance status of the target instance, thereby achieving fine-grained monitoring of the cluster status.
[0053] On this basis, an optional technical solution is to obtain the cluster status of the target cluster by monitoring the instance status of the target instance, including:
[0054] By monitoring the node status of each node in the target instance, the instance status of the target instance is obtained, and based on the instance status, the cluster status of the target cluster is obtained.
[0055] The target instance may be understood as a single node or a collection of multiple nodes. For example, a non-distributed instance is a single node, while a distributed instance is generally a plurality of nodes.
[0056] In practical applications, the above nodes can also be called sets, data nodes or shards. Specifically, a node is the smallest data unit in a distributed instance. A distributed instance consists of n (n≥2) nodes, each of which stores data of a different range. The n nodes together form a full copy of the data.
[0057] On this basis, the instance status can be obtained by monitoring the node status of each node in the target instance, and then the cluster status can be obtained based on the instance status. Here, by monitoring the node status, fine-grained monitoring of the instance status is achieved, and then fine-grained monitoring of the cluster status is achieved.
[0058] On this basis, optionally, each cluster in the distributed database corresponds to a different uniform resource locator; in response to a cluster status monitoring instruction for the distributed database, determining a target cluster in the distributed database that has a cluster status monitoring requirement includes:
[0059] In the case of detecting a cluster state monitoring instruction for a distributed database, obtaining a target uniform resource locator corresponding to the cluster state monitoring instruction, wherein each uniform resource locator includes a target uniform resource locator;
[0060] Based on the target uniform resource locator, a target cluster having a cluster status monitoring requirement in the distributed database is determined.
[0061] The above technical solution realizes accurate determination of the target cluster by utilizing the uniform resource locator.
[0062] Figure 3It is a flow chart of another cluster state handling method for a distributed database provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, each cluster in the distributed database corresponds to a different uniform resource locator; in response to a cluster state monitoring instruction for a distributed database, a target cluster in the distributed database that has a cluster state monitoring requirement is determined, including: when a cluster state monitoring instruction for a distributed database is detected, a target uniform resource locator corresponding to the cluster state monitoring instruction is obtained, wherein each uniform resource locator includes a target uniform resource locator; based on the target uniform resource locator, a target cluster in the distributed database that has a cluster state monitoring requirement is determined. Among them, the explanations of the terms that are the same as or corresponding to the above-mentioned embodiments are not repeated here.
[0063] See also Figure 3 The method of this embodiment may specifically include the following steps:
[0064] S310: when a cluster state monitoring instruction for a distributed database is detected, obtaining a target uniform resource locator corresponding to the cluster state monitoring instruction;
[0065] Each cluster in the distributed database corresponds to a different uniform resource locator, and each uniform resource locator includes a target uniform resource locator.
[0066] Among them, under the premise that each cluster in the distributed database corresponds to a different Universal Resource Locator (URL), after detecting the cluster status monitoring instruction, the target URL corresponding to the cluster status monitoring instruction can be obtained, and the target URL is at least part of all URLs corresponding to the distributed data.
[0067] S320: Determine a target cluster in the distributed database that has a cluster status monitoring requirement based on the target uniform resource locator.
[0068] After the target URL is obtained, the cluster represented by the URL consistent with the target URL among all the URLs corresponding to the distributed database can be used as the target cluster.
[0069] S330: Determine a target instance in the target cluster that has a cluster status monitoring requirement.
[0070] S340: Obtain a cluster state monitoring policy pre-set for the target cluster, and obtain the cluster state of the target cluster by monitoring the instance state of the target instance based on the cluster state monitoring policy.
[0071] S350: When the cluster state does not meet the expected state, and the duration of the cluster state not meeting the expected state exceeds a preset duration, the cluster state is treated as the expected state.
[0072] The technical solution of the embodiment of the present invention realizes accurate determination of the target cluster by utilizing the URL.
[0073] An optional technical solution is that each instance in each cluster in the distributed database is pre-encapsulated with an interface;
[0074] Determine the target instances in the target cluster that require cluster status monitoring, including:
[0075] A target interface corresponding to the target uniform resource locator is obtained, and based on the target interface, a target instance having a cluster status monitoring requirement in the target cluster is determined.
[0076] In which, each instance involved in the distributed database can be pre-encapsulated with an interface, and then the interface encapsulation results of each instance can be stored in an interface document. In this way, after obtaining the target URL, the interface encapsulation result (herein referred to as the target interface) corresponding to the target URL can be obtained from the interface document, and then the instance represented by the target interface is used as the target instance.
[0077] The above technical solution realizes accurate determination of the target instance by pre-encapsulating the interfaces of the distributed instances and non-distributed instances in the distributed database and utilizing the interface encapsulation results.
[0078] On this basis, optionally, the target uniform resource locator is pre-constructed as follows:
[0079] Get the Internet Protocol address of the target cluster's operation interface;
[0080] Wrap the Internet Protocol address to obtain the target Uniform Resource Locator.
[0081] Each cluster in the distributed database has its own Internet Protocol (IP) address, which is the IP address of the operation interface of the corresponding cluster. On this basis, for each cluster, the IP address corresponding to the cluster can be packaged to obtain the URL of the cluster.
[0082] The above technical solution realizes the effective acquisition of the URL (ie, target URL) of the target cluster by packaging the IP address corresponding to the target cluster.
[0083] In order to better understand the above-mentioned technical solutions as a whole, the following is an exemplary description with reference to specific examples. Figure 4 The cluster state processing device for distributed database shown in the figure is mainly divided into a monitoring item module, a policy mounting module and an automatic processing module. Specifically,
[0084] (1) Monitoring item module
[0085] The monitoring item module can be divided into the interface layer, address resolution layer and status query layer.
[0086] A. The interface layer encapsulates the interface. There are mainly two types of encapsulation interfaces:
[0087] 1. Query cluster information (GetGroup)
[0088] Description: Query the cluster information of the groupshard cluster.
[0089] 1) When using this interface, you can query the cluster information of a specific group. If you query the cluster information of all groushards, it will be slow;
[0090] 2) When groups is empty, query all groupshards; when id is specified, only cluster information of the specified id is returned.
[0091] 2. GetInstance
[0092] Description: Query the cluster information of noshard in the current distributed database cluster.
[0093] B. Address resolution layer: Each cluster of the distributed database has a corresponding IP address, which can be obtained from the management node in the policy mounting module. The following statement can be used to package the IP address into a URL. The instance information is extracted and parsed by using the URL and the corresponding interface as inputs to the do_post function. The check function takes the return value of the address resolution layer and a status identifier as parameter input to check whether the address resolution is correct.
[0094] C. Status query layer: It mainly queries and checks the node status of the set of distributed instances and non-distributed instances in the cluster obtained after the above processing. The name of the synchronization status parameter corresponding to the set is sqlasyn, and then returns the status identifier, which can be understood as the corresponding value of sqlasyn.
[0095] (2) Policy Mounting Module
[0096] A cluster status monitoring policy can be created in the monitoring module (Monitor module) of the integrated production and operation platform, in which the cluster status monitoring items to be detected and the corresponding threshold rules are added, and the cluster status monitoring policy with the added cluster status monitoring items is mounted to the corresponding management and control node.
[0097] (3) Automatic processing module
[0098] When a status that does not meet the expected state is detected, an alarm is generated, and after a preset period of time, the interface of the corresponding module of the target platform is automatically called to modify the cluster state of the corresponding cluster.
[0099] The above example has at least the following advantages:
[0100] 1. Implemented interface encapsulation for distributed instances and non-distributed instances in distributed databases.
[0101] 2. Real-time monitoring of the cluster status of clusters in distributed databases is realized.
[0102] 3. Realizes automatic handling of cluster status of clusters in distributed databases.
[0103] Figure 5 This is a block diagram of a cluster state handling device for distributed databases provided in an embodiment of the present invention. The device is used to execute the cluster state handling method for distributed databases provided in any of the above embodiments. The device and the cluster state handling method for distributed databases in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the cluster state handling device for distributed databases, please refer to the above embodiments of the cluster state handling method for distributed databases. Figure 5 The device may specifically include: a target cluster determination module 410 , a cluster state monitoring module 420 and a cluster state handling module 430 .
[0104] The target cluster determination module 410 is used to determine a target cluster in the distributed database that has a cluster status monitoring requirement in response to a cluster status monitoring instruction for the distributed database;
[0105] The cluster state monitoring module 420 is used to obtain a cluster state monitoring policy preset for the target cluster, and monitor the cluster state of the target cluster based on the cluster state monitoring policy;
[0106] The cluster state handling module 430 is used to handle the cluster state to the expected state when the cluster state does not meet the expected state and the duration of the cluster state not meeting the expected state exceeds a preset duration.
[0107] Optionally, the cluster state processing device may further include:
[0108] A target instance determination module is used to determine a target instance having a cluster status monitoring requirement in the target cluster after determining a target cluster having a cluster status monitoring requirement in the distributed database;
[0109] The cluster status monitoring module 420 includes:
[0110] The cluster status obtaining unit is used to obtain the cluster status of the target cluster by monitoring the instance status of the target instance.
[0111] On this basis, an optional cluster status obtaining unit is specifically used to:
[0112] By monitoring the node status of each node in the target instance, the instance status of the target instance is obtained, and based on the instance status, the cluster status of the target cluster is obtained.
[0113] Alternatively, each cluster in the distributed database corresponds to a different uniform resource locator;
[0114] The target cluster determination module 410 is specifically configured to:
[0115] In the case of detecting a cluster state monitoring instruction for a distributed database, obtaining a target uniform resource locator corresponding to the cluster state monitoring instruction, wherein each uniform resource locator includes a target uniform resource locator;
[0116] Based on the target uniform resource locator, a target cluster having a cluster status monitoring requirement in the distributed database is determined.
[0117] On this basis, optionally, each instance in each cluster of the distributed database is pre-encapsulated with an interface;
[0118] The target instance determination module includes:
[0119] The target instance determination unit is used to obtain a target interface corresponding to the target uniform resource locator, and determine a target instance in the target cluster that has a cluster status monitoring requirement based on the target interface.
[0120] On this basis, optionally, the target uniform resource locator is pre-built through the following modules:
[0121] An Internet Protocol address acquisition module, which can be used to obtain the Internet Protocol address of the operation interface of the target cluster;
[0122] The target uniform resource locator obtaining module can be used to package the Internet Protocol address to obtain the target uniform resource locator.
[0123] Optionally, the cluster state monitoring strategy includes cluster state monitoring items and threshold rules corresponding to the cluster state monitoring items;
[0124] The cluster status monitoring module 420 includes:
[0125] A cluster status monitoring unit is used to monitor the cluster status of the target cluster based on cluster status monitoring items;
[0126] The above cluster state processing device further includes:
[0127] The cluster status judgment module is used to judge whether the cluster status meets the expected status based on the threshold rule after monitoring the cluster status of the target cluster.
[0128] Optionally, the above cluster state processing device further includes:
[0129] The alarm module is used to generate an alarm when the cluster status of the target cluster does not meet the expected status after monitoring the cluster status of the target cluster.
[0130] Optionally, the cluster status monitoring module 420 includes:
[0131] The cluster status monitoring policy acquisition unit is used to acquire the cluster status monitoring policy pre-set for the target cluster from the management and control node.
[0132] The cluster state handling device for distributed databases provided in the embodiment of the present invention can respond to the cluster state monitoring instruction for distributed databases through the target cluster determination module, determine the target cluster in the distributed database that has the cluster state monitoring demand, and accurately determine the monitoring object of the cluster state; through the cluster state monitoring module, the cluster state monitoring strategy pre-set for the target cluster can be obtained, and based on the cluster state monitoring strategy, the cluster state of the target cluster can be monitored, thereby realizing real-time monitoring of the cluster state; through the cluster state handling module, when the cluster state does not meet the expected state, and the duration of the cluster state not meeting the expected state exceeds the preset duration, the cluster state can be handled as the expected state, thereby realizing automatic handling of the cluster state. The above device can monitor the cluster state of the target cluster in the distributed database in real time, and automatically handle the cluster state after the cluster state does not meet the expected state and continues for a preset duration, thereby providing guarantee for the operation and maintenance of the distributed database, and ensuring that the cluster data will not be disordered or lost.
[0133] The cluster state handling device for distributed databases provided in the embodiment of the present invention can execute the cluster state handling method for distributed databases provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0134] It is worth noting that in the above-mentioned embodiment of the cluster state handling device for distributed databases, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0135] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, 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 (such as helmets, glasses, watches, etc.) 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 invention described and / or required herein.
[0136] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0137] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0138] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a cluster state handling method for a distributed database.
[0139] In some embodiments, the cluster state handling method for distributed databases may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the cluster state handling method for distributed databases described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the cluster state handling method for distributed databases in any other appropriate manner (e.g., by means of firmware).
[0140] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0142] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. 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.
[0143] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0144] The systems and techniques described herein may be implemented in a computing system that includes backend 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 frontend 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 backend components, middleware components, or frontend 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), a blockchain network, and the Internet.
[0145] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0146] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0147] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A cluster state handling method for a distributed database, characterized in that: include: In response to a cluster status monitoring instruction for a distributed database, determining a target cluster in the distributed database that has a cluster status monitoring requirement; Acquire a cluster state monitoring policy pre-set for the target cluster, and monitor the cluster state of the target cluster based on the cluster state monitoring policy; If the cluster state does not conform to the expected state, and the duration for which the cluster state does not conform to the expected state exceeds a preset duration, the cluster state is handled as the expected state.
2. The method according to claim 1, characterized in that After determining that a target cluster having a cluster status monitoring requirement exists in the distributed database, the method further includes: Determine a target instance in the target cluster that has a cluster status monitoring requirement; The monitoring the cluster status of the target cluster includes: The cluster state of the target cluster is obtained by monitoring the instance state of the target instance.
3. The method according to claim 2, characterized in that The obtaining the cluster state of the target cluster by monitoring the instance state of the target instance includes: The instance state of the target instance is obtained by monitoring the node state of each node in the target instance, and the cluster state of the target cluster is obtained according to the instance state.
4. The method according to claim 2 or 3, characterized in that: Each cluster in the distributed database corresponds to a different uniform resource locator; The step of responding to a distributed database-oriented cluster state monitoring instruction and determining a target cluster in the distributed database that has a cluster state monitoring requirement includes: In the case of detecting a cluster state monitoring instruction for a distributed database, obtaining a target uniform resource locator corresponding to the cluster state monitoring instruction, wherein each uniform resource locator includes the target uniform resource locator; Based on the target uniform resource locator, a target cluster having a cluster status monitoring requirement in the distributed database is determined.
5. The method according to claim 4, characterized in that Each instance in each cluster of the distributed database is pre-encapsulated with an interface; The determining that there is a target instance in the target cluster that requires cluster status monitoring includes: A target interface corresponding to the target uniform resource locator is acquired, and based on the target interface, a target instance having a cluster status monitoring requirement in the target cluster is determined.
6. The method according to claim 5, characterized in that The target uniform resource locator is pre-constructed in the following manner: Obtaining an Internet Protocol address of an operation interface of the target cluster; The Internet Protocol address is packaged to obtain the target uniform resource locator.
7. The method according to claim 1, characterized in that The cluster state monitoring strategy includes cluster state monitoring items and threshold rules corresponding to the cluster state monitoring items; The monitoring the cluster state of the target cluster based on the cluster state monitoring strategy includes: Based on the cluster status monitoring item, monitoring the cluster status of the target cluster; After monitoring the cluster state of the target cluster, the method further includes: Based on the threshold rule, it is determined whether the cluster state meets the expected state.
8. The method according to claim 1, characterized in that: After monitoring the cluster state of the target cluster, the method further includes: When the cluster state does not conform to the expected state, an alarm is issued.
9. The method according to claim 1, characterized in that: The target cluster includes a management and control node, and the obtaining of a cluster status monitoring strategy preset for the target cluster includes: A cluster status monitoring policy pre-set for the target cluster is obtained from the management and control node.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the cluster state handling method for a distributed database according to any one of claims 1 to 9.