Database instance state updating method and device, equipment and storage medium
By obtaining and combining database operation requests, task status information and instance status information, and combining request status conversion relationships, real-time monitoring and updating of database instance status is solved, which solves the problem of low status update accuracy in cloud database management services and enables rapid location of anomalies. The ability to reason improves the reliability and efficiency of management services.
Patent Information
- Application Number
- CN202310444997.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-24
- Publication Date
- 2024-10-25
AI Technical Summary
Existing cloud database management services have low accuracy when monitoring and updating database instance status, making it difficult to quickly locate the cause of anomalies.
By obtaining the database operation request, task status information and instance status information sent by the task executor, combined with the request status conversion relationship, real-time monitoring and updating of the database instance status is performed to improve the accuracy of status updates.
It achieves fine-grained monitoring and accurate updating of database instance status, can quickly locate the cause of exceptions when database nodes are abnormal, and improves the reliability and efficiency of cloud database management services.
Smart Images

Figure CN118838901A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a database instance state updating method, device, equipment and storage medium. Background Art
[0002] With the continuous development of cloud computing technology, cloud databases with high scalability, high availability and support for effective resource distribution have emerged. With the popularization of cloud database technology, various types of cloud database management services have also emerged. A large number of database instances are running in various cloud database management services. Therefore, how to effectively monitor, manage and update the operating status of a large number of databases is crucial.
[0003] The current cloud database management service can only simply display the database instance status during the entire life cycle of the cloud database instance to understand the overall operating status of the database instance. The update method of the database instance status is relatively simple and has low accuracy, which is not convenient for quickly locating the cause of the abnormality when the database node is abnormal. Summary of the invention
[0004] The present invention provides a database instance state updating method, device, equipment and storage medium to improve the updating accuracy of the database instance state.
[0005] According to one aspect of the present invention, a method for updating a database instance state is provided, the method comprising:
[0006] Obtaining a database operation request; the database operation request includes request status information of a target database cluster;
[0007] Acquiring task status information sent by a task executor; the task executor is used to execute the database operation request to obtain the task status information of the target database cluster; and,
[0008] Perform instance status monitoring on at least one database cluster, and when the instance status of the target database cluster is monitored, obtain database instance status information of the target database cluster;
[0009] The instance state of the target database cluster is updated according to the request state information, the task state information and the database instance state information.
[0010] Optionally, updating the instance state of the target database cluster according to the request state information, the task state information, and the database instance state information includes:
[0011] Determine a target request state transition relationship associated with the database operation request;
[0012] Determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship;
[0013] The instance state of the target database cluster is updated according to the first state to be converted, the task state information, and the database instance state information.
[0014] The above technical solution combines the target request state transition relationship to achieve accurate update of the instance state of the target database cluster at different time nodes during the execution of the corresponding task. It fully considers the rationality of the instance state involved in the entire life cycle of the database instance, and is flexibly compatible with various types of databases, with good scalability and versatility.
[0015] Optionally, the determining a target request state conversion relationship associated with the database operation request includes:
[0016] Determine a target database type of the target database cluster;
[0017] Acquire a target state conversion relationship table corresponding to the target database type from at least one candidate state conversion relationship table; the target state conversion relationship table includes at least one candidate request state conversion relationship;
[0018] A target request state transition relationship associated with the database operation request is selected from each of the candidate request state transition relationships.
[0019] The above technical solution determines the target database type of the target database cluster, obtains the target state transition relationship table corresponding to the target database type from at least one candidate state transition relationship table, and selects the target request state transition relationship associated with the database operation request from each candidate request state transition relationship in the target state transition relationship table, thereby achieving accurate determination of the target request state transition relationship, thereby facilitating more accurate positioning of the state to be converted of the target database cluster in the future, thereby improving the accuracy of subsequent updates to the instance state of the target database cluster.
[0020] Optionally, updating the instance state of the target database cluster according to the first state to be converted, the task state information, and the database instance state information includes:
[0021] Determine whether the task status information is consistent with the first state to be converted;
[0022] If so, the instance state of the target database cluster is updated according to the database instance state information and the first state to be converted.
[0023] The above technical solution determines whether the task status information is consistent with the first state to be converted, and when the states are determined to be consistent, updates the instance state of the target database cluster according to the database instance status information and the first state to be converted, thereby realizing fine-grained comparison and analysis of the instance state of the target database cluster and improving the accuracy of updating the instance state of the target database cluster.
[0024] Optionally, updating the instance state of the target database cluster according to the database instance state information and the first state to be converted includes:
[0025] Using the first state to be converted, updating the instance state of the target database cluster to obtain the current instance state;
[0026] Determining a second state to be converted of the target database cluster according to the first state to be converted;
[0027] If the second state to be converted is consistent with the database instance state information, the second state to be converted is adopted to update the current instance state of the target database cluster.
[0028] The above technical solution adopts the first state to be converted to update the instance state of the target database cluster to obtain the current instance state, and determines the second state to be converted of the target database cluster according to the first state to be converted. When it is determined that the second state to be converted is consistent with the database instance state information, the second state to be converted is adopted to update the current instance state of the target database cluster, thereby further improving the update accuracy of the instance state of the target database cluster.
[0029] Optionally, the task executor executes the database operation request to obtain the task status information of the target database cluster in the following manner:
[0030] The task executor executes the database operation request to obtain the node status fed back by each database node of the target database cluster during the execution of the database operation request;
[0031] According to the status of each node, task status information of the target database cluster is generated.
[0032] The above technical solution executes database operation requests through the task executor, obtains the node status fed back by each database node of the target database cluster during the execution of the database operation request, and generates task status information of the target database cluster based on the status of each node, thereby realizing real-time monitoring of the node status of the database nodes of the target database cluster, improving the accuracy of determining the task status information of the target database cluster, and thus facilitating more accurate subsequent updates of the database instance status.
[0033] According to another aspect of the present invention, a database instance status updating device is provided, the device comprising:
[0034] An operation request acquisition module, used to acquire a database operation request; the database operation request includes request status information of a target database cluster;
[0035] A status information acquisition module, used to acquire task status information sent by a task executor; the task executor is used to execute the database operation request to obtain task status information of the target database cluster; and
[0036] An instance status monitoring module is used to monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain the database instance status information of the target database cluster;
[0037] An instance status update module is used to update the instance status of the target database cluster according to the request status information, the task status information and the database instance status information.
[0038] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0039] at least one processor; and
[0040] a memory communicatively connected to the at least one processor; wherein,
[0041] 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 can execute the database instance status updating method described in any embodiment of the present invention.
[0042] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the database instance status update method described in any embodiment of the present invention when executed.
[0043] The technical solution of the embodiment of the present invention obtains the request status information of the target database cluster corresponding to the database operation request and the task status information sent by the task executor; and, monitors the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtains the database instance status information of the target database cluster; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information. The above technical solution realizes fine-grained monitoring of the running status of the database instance by obtaining or monitoring the request status information, task status information and database instance status information; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information, thereby improving the accuracy of updating the database instance status, thereby facilitating the rapid location of the cause of the abnormality when the database node is abnormal.
[0044] 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
[0045] 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.
[0046] Figure 1 is a flowchart of a method for updating a database instance status provided according to Embodiment 1 of the present invention;
[0047] Figure 2 is a flowchart of a method for updating a database instance status provided in accordance with Embodiment 2 of the present invention;
[0048] Figure 3 is a flowchart of a method for updating a database instance state according to Embodiment 3 of the present invention;
[0049] Figure 4 is a schematic diagram of the structure of a database instance status updating device provided according to Embodiment 4 of the present invention;
[0050] Figure 5 It is a structural diagram of an electronic device for implementing the database instance state updating method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] 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.
[0052] 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 interchanged 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. 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 that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0053] Embodiment 1
[0054] Figure 1 This is a flowchart of a method for updating the state of a database instance provided in the first embodiment of the present invention. This embodiment is applicable to the case of updating and monitoring the state of a database instance. The method can be executed by a database instance state updating device. The database instance state updating device can be implemented in the form of hardware and / or software. The database instance state updating device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0055] S110, obtaining a database operation request; the database operation request includes request status information of a target database cluster.
[0056] The database operation request may be a request initiated by a user to perform a series of related operations on the database. For example, the database operation request may be a request to create a database or a database instance, a request to delete database parameters, and a request to start or stop a database.
[0057] The target database cluster may be a database cluster that performs a database request operation; it should be noted that a user may operate any database cluster from at least one database cluster and generate a corresponding database operation request at the front end. Therefore, the database operation request may include a cluster identifier of the target database cluster to be operated. The cluster identifier may be used to characterize the uniqueness of the database cluster.
[0058] The request status information may be status information of the target database cluster when performing database operations. For example, if the database operation request is a request to change the database specification, the corresponding request status information may be that the specification is changing; if the database operation request is a request to expand the capacity of a cloud disk, the corresponding request status information may be that the cloud disk is expanding. It should be noted that the request status information is the initial instance status of the target database cluster during the database operation process, and the database instance status will change accordingly during the execution of the database operation request.
[0059] Exemplarily, a request API (Application Programming Interface) pre-deployed in the cloud database management service can receive a database operation request created or initiated by a user, and parse the database operation request to obtain the cluster identifier of the database cluster that executes the operation request, thereby determining the target cluster database based on the cluster identifier and obtaining the request status information of the target database cluster.
[0060] S120, obtaining task status information sent by the task executor; the task executor is used to execute the database operation request and obtain the task status information of the target database cluster.
[0061] The task executor is used to execute the request task corresponding to the database operation request; the task status information may be the database instance status of the target database cluster during the process of the task executor executing the request task corresponding to the database operation request.
[0062] It should be noted that the target database cluster may include at least one database node. When the task executor executes a request task corresponding to a database operation request, it can control the target database cluster to execute the corresponding request task based on the node status feedback from each database node, and record the node status under different request tasks feedback from each database node to generate task status information.
[0063] In an optional embodiment, the task executor executes a database operation request and obtains the task status information of the target database cluster as follows: the task executor executes a database operation request and obtains the node status fed back by each database node of the target database cluster during the execution of the database operation request; based on the status of each node, the task status information of the target database cluster is generated.
[0064] Exemplarily, the task executor controls each database node of the target database cluster to execute the request task corresponding to the database operation request, and the node state of each database node changes during the execution of the request task. The task executor can monitor the node state of each database node, and according to the node state, control each database node to execute different task stages of the request task to obtain the node state at different task stages. Among them, the target database cluster can include a master node and a child node, and correspondingly, the database node can be a master node and a child node.
[0065] Take the case where the database operation request is a database specification change request as an example. After receiving the database change rule request, the task executor controls each database node of the target database cluster to stop the database service, and the node status of each database node is changed to stopping; when the task executor receives feedback from all database nodes of the target database cluster that the node status is stopping, it records stopping as the task status information, and continues to control each database node of the target database cluster to change the current database specification to the target database specification. Among them, the target database specification is obtained by parsing the database change specification request. After each database node has completed the execution of the database change specification, the task executor controls each database node to start, and monitors the node status of each database node. If the node status of all database nodes is starting, it is considered that each database node has successfully executed the database change specification request, and the specification change success status is recorded as the task status information.
[0066] The task executor of this optional embodiment executes a database operation request, obtains the node status fed back by each database node of the target database cluster during the execution of the database operation request, and generates task status information of the target database cluster based on the status of each node, thereby realizing real-time monitoring of the node status of the database nodes of the target database cluster, improving the accuracy of determining the task status information of the target database cluster, thereby facilitating more accurate subsequent updating of the database instance status.
[0067] S130: Monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain database instance status information of the target database cluster.
[0068] The database cluster may be a cluster that needs to monitor the database instance status or update the database instance status. Each database cluster may have only one database node, and the corresponding database cluster is a single-node data cluster. Alternatively, the database cluster may also include at least two database nodes, that is, a master node and a slave node.
[0069] It should be noted that a GuestAgent (management application) service may be installed and deployed in each database cluster. The GuestAgent service may be a daemon running in a virtual machine, used to manage applications, such as managing and executing database-related operations, and regularly obtaining and reporting database status information running in the virtual machine.
[0070] Exemplarily, the database instance status of at least one database cluster may be monitored; or the database instance status may be acquired by using a GuestAgent service deployed in the database cluster to report the instance status. When the instance status of the target database cluster is monitored or acquired, the database instance status information of the target database cluster is acquired.
[0071] It should be noted that the database instance state can be determined by, if the target database cluster is a single-node database cluster, using the node state of the database node as the database instance state of the target database cluster; if the target database cluster is a multi-node database cluster, obtaining the master node state and slave node state of the target database cluster, and determining the database instance state based on the master node state and the slave node state. For example, if the master node state and the slave node state are consistent and both are in normal state, the master node state or the slave node state is used as the database instance state. If the master node state and the slave node state are inconsistent, the database instance state is determined based on the node state corresponding to the master node or the slave node. For example, if the node state of the master node is in an abnormal state and the node state of the slave node is in a normal state, the database instance state may be in a sub-healthy state; if the node state of the master node and the node state of the slave node are both in an abnormal state, the database instance state may be in a faulty state.
[0072] It is understandable that S120 may be executed before S130, may be executed after S130, or may be executed simultaneously with S130. This embodiment does not limit the execution order of S120 and S130.
[0073] S140: Update the instance status of the target database cluster according to the request status information, the task status information, and the database instance status information.
[0074] Exemplarily, the state to be converted corresponding to the target database cluster can be determined according to the request state information; for example, if the database operation request is a request to change the database specification, the request state information can be that the specification is changing, then the next state to be converted corresponding to the target database cluster is specification change success or specification change failure; the next state to be converted corresponding to specification change success or specification change failure is running. Therefore, the instance state of the target database cluster can be updated according to the state to be converted, the task state information and the database instance state information.
[0075] It should be noted that, since the task executor monitors and records the node status fed back by each database node of the target database cluster in real time during the process of executing the database operation request to operate the target database cluster, the task status information is constantly changing. Therefore, the task status information sent to the task executor is information obtained in real time. In addition, the database instance status information for the target database cluster is also information obtained in real time.
[0076] Exemplarily, if the task status information is monitored to be consistent with the state to be converted, the instance state of the target database cluster is updated to the instance state corresponding to the task status information; if the task status information is monitored to be consistent with the state to be converted, no update is performed. After the instance state of the target database cluster is updated to the instance state corresponding to the task status information, the next state to be converted corresponding to the current instance state of the target database cluster is determined, and when it is monitored that the instance state corresponding to the database instance status information of the target database cluster is consistent with the next state to be converted, the instance state of the target database cluster is updated to the instance state corresponding to the database instance status information.
[0077] The technical solution of the embodiment of the present invention obtains the request status information of the target database cluster corresponding to the database operation request and the task status information sent by the task executor; and, monitors the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtains the database instance status information of the target database cluster; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information. The above technical solution realizes fine-grained monitoring of the running status of the database instance by obtaining or monitoring the request status information, task status information and database instance status information; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information, thereby improving the accuracy of updating the database instance status, thereby facilitating the rapid location of the cause of the abnormality when the database node is abnormal.
[0078] Embodiment 2
[0079] Figure 2 This is a flowchart of a database instance status update method provided in Embodiment 2 of the present invention. This embodiment is optimized and improved on the basis of the above technical solutions.
[0080] Further, the step "update the instance state of the target database cluster according to the request state information, task state information and database instance state information" is refined into "determine the target request state conversion relationship associated with the database operation request; determine the first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship; update the instance state of the target database cluster according to the first state to be converted, the task state information and the database instance state information." to improve the method of updating the instance state of the target database cluster. It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the descriptions of other embodiments.
[0081] like Figure 2 As shown, the method comprises the following specific steps:
[0082] S210, obtaining a database operation request; the database operation request includes request status information of a target database cluster.
[0083] S220, obtaining task status information sent by the task executor; the task executor is used to execute the database operation request and obtain the task status information of the target database cluster.
[0084] S230: Monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain database instance status information of the target database cluster.
[0085] S240: Determine a target request state conversion relationship associated with the database operation request.
[0086] The target request state transition relationship may be a state transition relationship between a target database cluster in the process of executing a database operation request and a database instance when executing a next task stage when executing a corresponding task stage.
[0087] The target request state conversion relationship may be preset by relevant technical personnel according to actual needs. For example, different request state conversion relationships may be preset for different database operation requests.
[0088] In an optional embodiment, determining a target request state transition relationship associated with a database operation request includes: determining a target database type of a target database cluster; obtaining a target state transition relationship table corresponding to the target database type from at least one candidate state transition relationship table; the target state transition relationship table includes at least one candidate request state transition relationship; and selecting a target request state transition relationship associated with the database operation request from each candidate request state transition relationship.
[0089] The database type may include at least one, and different database types may correspond to different candidate state transition relationship tables. For example, the database type may include a Sybase (relational database system) database type and a MySQL (Structured Query Language, relational database management system) database type.
[0090] The target database type may be a database type corresponding to each database node under the target database cluster. The candidate state conversion relationship table may be preset by relevant technical personnel, and different database types may correspond to different candidate state conversion relationship tables.
[0091] Among them, the candidate state transition relationship table may include different request state transition relationships. The request state transition relationship may be a state transition relationship corresponding to a database operation request. For example, if the database operation request is a request to change the database specification, the corresponding state transition relationship may be specification changing—specification change successful / specification change failed—starting; if the database operation request is a cloud disk capacity expansion request, the corresponding state transition relationship may be cloud disk capacity expansion—capacity expansion successful / capacity expansion failed—starting; if the database operation request is a master-slave switching request, the corresponding state transition relationship may be master-slave switching—switching successful / switching failed—starting. The state transition relationships corresponding to different database operation requests can be pre-set according to actual needs, and this embodiment will not be repeated here.
[0092] Exemplarily, determine the target database type corresponding to each database node of the target database cluster, select a target state transition relationship table corresponding to the target database type from at least one pre-set candidate state transition relationship table; and select a target request state transition relationship associated with the database operation request from each candidate request state transition relationship in the target state transition relationship table.
[0093] This optional embodiment scheme determines the target database type of the target database cluster, obtains a target state transition relationship table corresponding to the target database type from at least one candidate state transition relationship table, and selects a target request state transition relationship associated with the database operation request from each candidate request state transition relationship in the target state transition relationship table, thereby achieving accurate determination of the target request state transition relationship, thereby facilitating more accurate subsequent positioning of the state to be converted of the target database cluster, thereby improving the accuracy of subsequent updates to the instance state of the target database cluster.
[0094] S250: Determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship.
[0095] Exemplarily, the target request state transition relationship includes the next state to be converted corresponding to the instance state corresponding to the request state information, that is, the first state to be converted. For example, if the database operation request is a request to change database specifications, the request state information is that the database specifications are being changed, and the target request state transition relationship corresponding to the request to change database specifications is database specifications being changed—specification change successful / specification change failed—starting, then it can be determined that the first state to be converted of the target database cluster is specification change successful or specification change failed.
[0096] S260: Update the instance state of the target database cluster according to the first state to be converted, the task state information, and the database instance state information.
[0097] Exemplarily, whether to update the instance state of the target database cluster can be determined based on the state consistency between the first state to be converted and the task state information, and the instance state of the target database cluster can be updated based on the determination result and in combination with the database instance state information.
[0098] In an optional embodiment, the instance state of the target database cluster is updated according to the first state to be converted, the task state information and the database instance state information, including: determining whether the task state information is consistent with the first state to be converted; if so, updating the instance state of the target database cluster according to the database instance state information and the first state to be converted.
[0099] Exemplarily, it is determined whether the task status information is consistent with the first state to be converted. If so, the current instance state of the target database cluster can be updated to the first state to be converted; if not, no update is performed. For example, if the target request state conversion relationship is database specification changing - specification change success / specification change failure - starting, and the instance state corresponding to the request status information is database specification changing, then the first state to be converted is specification change success or specification change failure; if the received task status information is specification change success or specification change failure, the task status information is used to update the current instance state of the target database cluster.
[0100] After the current instance state of the target database cluster is updated using the task state information, the instance state of the target database cluster may be updated according to the database instance state information and the first state to be converted. Specifically, the instance state of the target database cluster may be updated according to the database instance state information and the first state to be converted in combination with the target request state conversion relationship.
[0101] This optional embodiment determines whether the task status information is consistent with the first state to be converted, and when the states are determined to be consistent, updates the instance state of the target database cluster according to the database instance status information and the first state to be converted, thereby achieving fine-grained comparison and analysis of the instance state of the target database cluster and improving the accuracy of updating the instance state of the target database cluster.
[0102] It is understandable that in order to further improve the update accuracy of the instance state of the target database cluster, the instance state of the target database cluster at different times or task stages can be determined in combination with the target request state transition relationship, so as to accurately update the instance state of the target database cluster.
[0103] In an optional embodiment, the instance state of the target database cluster is updated according to the database instance state information and the first state to be converted, including: using the first state to be converted to update the instance state of the target database cluster to obtain the current instance state; determining the second state to be converted of the target database cluster according to the first state to be converted; if the second state to be converted is consistent with the database instance state information, using the second state to be converted to update the current instance state of the target database cluster.
[0104] Exemplarily, the first state to be converted can be used to update the instance state of the target database cluster to obtain the current instance state of the target database cluster. According to the first state to be converted, combined with the target request state conversion relationship, the second state to be converted is determined; if the instance state in the received data instance state information is consistent with the second state to be converted, the second state to be converted is used to update the current instance state of the target database cluster.
[0105] Take the target request state conversion relationship of database specification changing - specification change successful / specification change failed - starting as an example for explanation. The first state to be converted is specification change successful or specification change failed, and accordingly, the current instance state of the target database cluster is updated to specification change successful or specification change failed. According to the target request state conversion relationship, it can be determined that the second relationship to be converted is starting; if the instance state in the received data instance state information is starting, the second state to be converted is used to update the current instance state of the target database cluster, that is, the current instance state of the target database cluster is updated to starting.
[0106] This optional embodiment uses the first state to be converted to update the instance state of the target database cluster to obtain the current instance state, and determines the second state to be converted of the target database cluster based on the first state to be converted. When it is determined that the second state to be converted is consistent with the database instance state information, the second state to be converted is used to update the current instance state of the target database cluster, thereby further improving the accuracy of updating the instance state of the target database cluster.
[0107] The technical solution of this embodiment determines the target request state transition relationship associated with the database operation request; determines the first state to be converted of the target database cluster according to the request state information and the target request state transition relationship; updates the instance state of the target database cluster according to the first state to be converted, the task state information and the database instance state information. The above technical solution realizes the accurate update of the instance state of the target database cluster at different time nodes during the execution of the corresponding task by combining the target request state transition relationship, fully considers the rationality of the instance state involved in the entire life cycle of the database instance, and is flexibly compatible with various types of databases, with good scalability and versatility.
[0108] Embodiment 3
[0109] Figure 3 This is a flow chart of a method for updating the state of a database instance provided in Embodiment 3 of the present invention. This embodiment provides a preferred example based on the above embodiments.
[0110] like Figure 3 As shown, the method comprises the following specific steps:
[0111] S310, obtaining a database operation request; the database operation request includes request status information of a target database cluster.
[0112] S320, obtaining task status information sent by the task executor; the task executor is used to execute the database operation request and obtain the task status information of the target database cluster.
[0113] Optionally, the task executor executes the database operation request, obtains the node status fed back by each database node of the target database cluster during the execution of the database operation request; and generates task status information of the target database cluster according to the status of each node.
[0114] S330: Monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain database instance status information of the target database cluster.
[0115] S340: Determine the target database type of the target database cluster.
[0116] S350: Obtain a target state transition relationship table corresponding to the target database type from at least one candidate state transition relationship table; the target state transition relationship table includes at least one candidate request state transition relationship.
[0117] S360: Select a target request state transition relationship associated with the database operation request from each candidate request state transition relationship.
[0118] S370: Determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship.
[0119] S380: Determine whether the task status information is consistent with the first state to be converted. If so, execute S390A; if not, execute S390B.
[0120] S390A: Use the first state to be converted to update the instance state of the target database cluster to obtain the current instance state.
[0121] S390B. Do not update the instance status of the target database cluster.
[0122] S3100. Determine a second state to be converted of a target database cluster according to a first state to be converted.
[0123] S3110. Determine whether the second state to be converted is consistent with the database instance state information. If so, execute S3120A; if not, execute S3120B.
[0124] S3120A. Use the second state to be converted to update the current instance state of the target database cluster.
[0125] S3120B. Do not update the current instance status of the target database cluster.
[0126] Embodiment 4
[0127] Figure 4 A schematic diagram of the structure of a database instance status updating device provided in Embodiment 4 of the present invention. A database instance status updating device provided in an embodiment of the present invention is applicable to the case where the database instance status is updated and monitored. The database instance status updating device can be implemented in the form of hardware and / or software, such as Figure 4 As shown, the device specifically includes: an operation request acquisition module 401, a state information acquisition module 402, an instance state monitoring module 403 and an instance state updating module 404. Among them,
[0128] The operation request acquisition module 401 is used to acquire a database operation request; the database operation request includes request status information of a target database cluster;
[0129] The status information acquisition module 402 is used to acquire the task status information sent by the task executor; the task executor is used to execute the database operation request to obtain the task status information of the target database cluster; and
[0130] The instance status monitoring module 403 is used to monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain the database instance status information of the target database cluster;
[0131] The instance status updating module 404 is configured to update the instance status of the target database cluster according to the request status information, the task status information and the database instance status information.
[0132] The technical solution of the embodiment of the present invention obtains the request status information of the target database cluster corresponding to the database operation request and the task status information sent by the task executor; and, monitors the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtains the database instance status information of the target database cluster; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information. The above technical solution realizes fine-grained monitoring of the running status of the database instance by obtaining or monitoring the request status information, task status information and database instance status information; updates the instance status of the target database cluster according to the request status information, task status information and database instance status information, thereby improving the accuracy of updating the database instance status, thereby facilitating the rapid location of the cause of the abnormality when the database node is abnormal.
[0133] Optionally, the instance status updating module 404 includes:
[0134] A conversion relationship determining unit, used to determine a target request state conversion relationship associated with the database operation request;
[0135] A first state determination unit, configured to determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship;
[0136] An instance state updating unit is used to update the instance state of the target database cluster according to the first state to be converted, the task state information and the database instance state information.
[0137] Optionally, the conversion relationship determining unit includes:
[0138] A database type determination subunit, used to determine the target database type of the target database cluster;
[0139] A conversion relationship table determination subunit is used to obtain a target state conversion relationship table corresponding to the target database type from at least one candidate state conversion relationship table; the target state conversion relationship table includes at least one candidate request state conversion relationship;
[0140] The conversion relationship determination subunit is used to select a target request state conversion relationship associated with the database operation request from each of the candidate request state conversion relationships.
[0141] Optionally, the instance status updating unit includes:
[0142] A state consistency judgment subunit, used for judging whether the task state information is consistent with the first state to be converted;
[0143] The instance status updating subunit is configured to update the instance status of the target database cluster according to the database instance status information and the first state to be converted if the task status information is consistent with the first state to be converted.
[0144] Optionally, the instance status updating subunit is specifically used to:
[0145] Using the first state to be converted, updating the instance state of the target database cluster to obtain the current instance state;
[0146] Determining a second state to be converted of the target database cluster according to the first state to be converted;
[0147] If the second state to be converted is consistent with the database instance state information, the second state to be converted is adopted to update the current instance state of the target database cluster.
[0148] Optionally, the task executor executes the database operation request to obtain the task status information of the target database cluster in the following manner:
[0149] The task executor executes the database operation request to obtain the node status fed back by each database node of the target database cluster during the execution of the database operation request;
[0150] According to the status of each node, task status information of the target database cluster is generated.
[0151] The database instance status updating device provided in the embodiment of the present invention can execute the database instance status updating method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0152] Embodiment 5
[0153] Figure 5 A schematic diagram of an electronic device 50 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.
[0154] like Figure 5 As shown, the electronic device 50 includes at least one processor 51, and a memory connected to the at least one processor 51 in communication, such as a read-only memory (ROM) 52, a random access memory (RAM) 53, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 51 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 52 or the computer program loaded from the storage unit 58 to the random access memory (RAM) 53. In the RAM 53, various programs and data required for the operation of the electronic device 50 can also be stored. The processor 51, the ROM 52, and the RAM 53 are connected to each other via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.
[0155] A number of components in the electronic device 50 are connected to the I / O interface 55, including: an input unit 56, such as a keyboard, a mouse, etc.; an output unit 57, such as various types of displays, speakers, etc.; a storage unit 58, such as a disk, an optical disk, etc.; and a communication unit 59, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 59 allows the electronic device 50 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0156] The processor 51 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 51 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 51 executes the various methods and processes described above, such as a database instance status update method.
[0157] In some embodiments, the database instance state update method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 50 via the ROM 52 and / or the communication unit 59. When the computer program is loaded into the RAM 53 and executed by the processor 51, one or more steps of the database instance state update method described above may be performed. Alternatively, in other embodiments, the processor 51 may be configured to execute the database instance state update method in any other appropriate manner (e.g., by means of firmware).
[0158] 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.
[0159] 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 and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0160] 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.
[0161] 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).
[0162] 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.
[0163] 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.
[0164] 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.
[0165] 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 method for updating a database instance state, characterized in that: include: Obtaining a database operation request; the database operation request includes request status information of a target database cluster; Get the task status information sent by the task executor; The task executor is used to execute the database operation request and obtain the task status information of the target database cluster; as well as, Perform instance status monitoring on at least one database cluster, and when the instance status of the target database cluster is monitored, obtain database instance status information of the target database cluster; The instance state of the target database cluster is updated according to the request state information, the task state information and the database instance state information.
2. The method according to claim 1, characterized in that The updating the instance state of the target database cluster according to the request state information, the task state information and the database instance state information includes: Determine a target request state transition relationship associated with the database operation request; Determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship; The instance state of the target database cluster is updated according to the first state to be converted, the task state information, and the database instance state information.
3. The method according to claim 2, characterized in that The determining of a target request state conversion relationship associated with the database operation request includes: Determine a target database type of the target database cluster; Acquire a target state conversion relationship table corresponding to the target database type from at least one candidate state conversion relationship table; the target state conversion relationship table includes at least one candidate request state conversion relationship; A target request state transition relationship associated with the database operation request is selected from each of the candidate request state transition relationships.
4. The method according to claim 2, characterized in that: The updating the instance state of the target database cluster according to the first state to be converted, the task state information and the database instance state information includes: Determine whether the task status information is consistent with the first state to be converted; If so, the instance state of the target database cluster is updated according to the database instance state information and the first state to be converted.
5. The method according to claim 4, characterized in that The updating of the instance state of the target database cluster according to the database instance state information and the first state to be converted includes: Using the first state to be converted, updating the instance state of the target database cluster to obtain the current instance state; Determining a second state to be converted of the target database cluster according to the first state to be converted; If the second state to be converted is consistent with the database instance state information, the second state to be converted is adopted to update the current instance state of the target database cluster.
6. The method according to any one of claims 1 to 5, characterized in that: The task executor executes the database operation request and obtains the task status information of the target database cluster in the following manner: The task executor executes the database operation request to obtain the node status fed back by each database node of the target database cluster during the execution of the database operation request; According to the status of each node, task status information of the target database cluster is generated.
7. A database instance status updating device, characterized in that: include: An operation request acquisition module, used to acquire a database operation request; the database operation request includes request status information of a target database cluster; A status information acquisition module is used to obtain the task status information sent by the task executor; The task executor is used to execute the database operation request and obtain the task status information of the target database cluster; as well as, An instance status monitoring module is used to monitor the instance status of at least one database cluster, and when the instance status of the target database cluster is monitored, obtain the database instance status information of the target database cluster; An instance status update module is used to update the instance status of the target database cluster according to the request status information, the task status information and the database instance status information.
8. The device according to claim 7, characterized in that The instance status update module includes: A conversion relationship determining unit, used to determine a target request state conversion relationship associated with the database operation request; A first state determination unit, configured to determine a first state to be converted of the target database cluster according to the request state information and the target request state conversion relationship; An instance state updating unit is used to update the instance state of the target database cluster according to the first state to be converted, the task state information and the database instance state information.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and 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 can execute the database instance status updating method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the database instance status updating method according to any one of claims 1 to 6 when executed.
