Database diagnosis method and device based on large language model, equipment and medium
Through a method based on a large language model, analyzing cloud platform database monitoring indicators and log information, building a target connection to obtain knowledge base and diagnostic results, solving the problem of inefficient traditional manual diagnosis, realizing intelligent database fault diagnosis, and improving system stability and reliability.
Patent Information
- Application Number
- CN202510594025.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-08-08
AI Technical Summary
Traditional cloud platform database fault diagnosis relies on manual troubleshooting, and existing automation tools are difficult to cope with complex and changeable cloud platform environments, making it difficult to ensure diagnostic accuracy and consistency.
Using a method based on a large language model, we use analyzing the monitoring indicators and operation log information of the cloud platform database, building target connections, obtaining knowledge bases and diagnostic results, and integrating solutions to achieve intelligent diagnosis.
It improves the stability and reliability of the database system, realizes efficient automated fault diagnosis, and reduces the subjective impact of manual intervention.
Smart Images

Figure CN120448234A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a database diagnosis method, device, equipment and medium based on a large language model. Background Art
[0002] In today's digital age, cloud platform databases have become the core infrastructure for many enterprises to store, manage, and process massive amounts of data. With the continuous expansion of enterprise businesses and the rapid growth of data volumes, the scale and complexity of cloud platform databases are increasing day by day, making database fault diagnosis and analysis unprecedentedly challenging.
[0003] Traditional cloud platform database fault diagnosis and analysis methods rely heavily on manual troubleshooting and empirical judgment by operations and maintenance personnel. Faced with complex cloud environments, which include numerous servers, storage devices, network components, and complex software systems, operations and maintenance personnel must examine each link individually, which is time-consuming, labor-intensive, and inefficient. Furthermore, manual judgment is susceptible to subjective factors, and the experience and skill levels of different operations and maintenance personnel vary widely, making it difficult to ensure accurate and consistent fault diagnosis. This can delay the optimal time for troubleshooting, resulting in significant financial losses and business risks for the enterprise.
[0004] Most existing automated fault diagnosis tools rely on pre-set rules and thresholds for detection. However, this approach has significant limitations and is difficult to adapt to the complex and ever-changing cloud platform database environment. For one thing, the operational status of cloud platform databases is affected by a variety of dynamic factors. Furthermore, these tools are unable to conduct in-depth analysis and accurate diagnosis of complex fault scenarios, such as coordinated failures among multiple components, because they lack an understanding of the overall operational logic and interdependencies of the database.
[0005] To sum up, how to implement intelligent database diagnosis by analyzing the monitoring indicators and operation log information of cloud platform databases is an urgent problem to be solved. Summary of the Invention
[0006] In view of this, the present invention aims to provide a database diagnosis method, apparatus, device, and medium based on a large language model, which can implement intelligent database diagnosis by analyzing monitoring indicators and operation log information of cloud platform databases. The specific scheme is as follows:
[0007] In a first aspect, the present application provides a database diagnosis method based on a large language model, comprising:
[0008] Determine a target scheduled task, query a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine a database to be diagnosed and a database type corresponding to the database to be diagnosed based on the database instance information;
[0009] Building a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collecting target database information of the database to be diagnosed based on the target connection;
[0010] Obtaining preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions; based on the preset database SQL rules and the preset database usage rules, inputting the target knowledge base and the target database information to be diagnosed into a preset large language model to obtain a target diagnosis result;
[0011] Based on the target diagnosis result, a corresponding first solution is determined from the target knowledge base, the target diagnosis result and the target database information to be diagnosed are input into the preset large language model to obtain a second solution, and the first solution and the second solution are integrated to generate a target solution to complete the database diagnosis.
[0012] Optionally, querying a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list includes:
[0013] Querying a list of database instances in the cloud platform database instance based on the target scheduled task to obtain a corresponding first query result;
[0014] Obtaining database instance information in the database instance list according to the first query result through a preset API interface;
[0015] The database instance information includes any one or more of the following: database type, database instance ID, database server connection IP, and server private key information.
[0016] Optionally, the collecting target database information of the database to be diagnosed based on the target connection includes:
[0017] Determine the database configuration and database operating status of the database to be diagnosed, and obtain the server resource usage, the database log to be diagnosed and the server system log respectively, and perform a preset format conversion operation on the database configuration, the database operating status, the server resource usage, the database log to be diagnosed and the server system log to obtain the target database information to be diagnosed.
[0018] Optionally, determining the database configuration and database operation status of the database to be diagnosed includes:
[0019] Executing a preset SQL query statement on the database to be diagnosed based on the target connection to obtain a corresponding second query result;
[0020] The database configuration and database operation status of the database to be diagnosed are obtained based on the second query result.
[0021] Optionally, respectively obtaining the server resource usage, the database log to be diagnosed, and the server system log includes:
[0022] Acquiring monitoring information of a database server within a preset time period using a preset content management service via an HTTP transmission protocol, and determining server resource usage corresponding to the database to be diagnosed based on the monitoring information of the database server;
[0023] Use the preset log management service through the HTTP transmission protocol to obtain the database logs and server system logs to be diagnosed.
[0024] Optionally, integrating the first solution and the second solution to generate a target solution includes:
[0025] Integrating the first solution and the second solution to generate a target solution that meets a preset format condition;
[0026] The preset format condition is any one or more of a preset text format, a preset table format, and a preset visual chart format.
[0027] Optionally, after integrating the first solution and the second solution to generate a target solution, the method further includes:
[0028] Determining whether the abnormal information of the database to be diagnosed in the target solution meets the preset severity determination conditions;
[0029] If the abnormal information of the database to be diagnosed in the target solution meets the preset severity judgment condition, the abnormal information of the database to be diagnosed is sent to the monitoring and alarm service through the API interface of the monitoring and alarm service of the cloud platform, so that the monitoring and alarm service can issue an alarm according to the preset processing rules.
[0030] In a second aspect, the present application provides a database diagnosis device based on a large language model, comprising:
[0031] A database determination module is used to determine a target scheduled task, query a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine a database to be diagnosed and a database type corresponding to the database to be diagnosed based on the database instance information;
[0032] An information collection module is used to build a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collect target database information of the database to be diagnosed based on the target connection;
[0033] A result acquisition module is used to obtain preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions. Based on the preset database SQL rules and the preset database usage rules, the target knowledge base and the target database information to be diagnosed are input into a preset large language model to obtain a target diagnosis result;
[0034] The database diagnosis completion module is used to determine the corresponding first solution from the target knowledge base based on the target diagnosis result, input the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain a second solution, integrate the first solution and the second solution to generate a target solution to complete the database diagnosis.
[0035] In a third aspect, the present application provides an electronic device, comprising:
[0036] Memory, used to store computer programs;
[0037] A processor is used to execute the computer program to implement the aforementioned database diagnosis method based on a large language model.
[0038] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned database diagnosis method based on a large language model.
[0039] In summary, the present application first determines the target timing task, queries the database instance list in the cloud platform database instance based on the target timing task to obtain the database instance information in the database instance list, and determines the database to be diagnosed and the database type corresponding to the database to be diagnosed based on the database instance information; constructs the target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collects the target database information to be diagnosed of the database to be diagnosed based on the target connection; obtains the preset database SQL rules, the preset database usage rules and the target knowledge base containing database problems and their solutions, and inputs the target knowledge base and the target database information to be diagnosed into the preset large language model based on the preset database SQL rules and the preset database usage rules to obtain the target diagnosis result; determines the corresponding first solution from the target knowledge base based on the target diagnosis result, inputs the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain the second solution, integrates the first solution and the second solution to generate the target solution to complete the database diagnosis. As can be seen from the above, this application first determines the target timed task, and obtains instance information based on the database instance list in the cloud platform database instance, thereby determining the database to be diagnosed and its database type, and then constructing the target connection between the cloud platform database instance and the database to be diagnosed according to the database type, and collecting the target database information to be diagnosed based on the connection, and then obtaining the preset database SQL rules, preset database usage rules and the target knowledge base containing database problems and solutions, and inputting the target knowledge base and the target database information to be diagnosed into the preset large language model according to the first two rules to obtain the target diagnosis result, and determining the first solution from the target knowledge base according to the result, and inputting the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain the second solution, and finally integrating the two solutions to complete the database diagnosis. In this way, by automatically parsing the monitoring indicators and operation log information of the cloud platform database, intelligent diagnosis of the database is achieved, and the stability and reliability of the database system are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0041] Figure 1 This is a flow chart of a database diagnosis method based on a large language model disclosed in this application;
[0042] Figure 2 This is a schematic diagram of the structure of a database diagnosis device based on a large language model disclosed in this application;
[0043] Figure 3 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.
[0045] At present, traditional cloud platform database fault diagnosis and analysis methods mostly rely on manual troubleshooting and experience-based judgment by operation and maintenance personnel. Faced with a complex cloud environment, which contains a large number of servers, storage devices, network components and complex software systems, operation and maintenance personnel need to check each link one by one, which is time-consuming, labor-intensive and inefficient. Moreover, manual judgment is easily affected by subjective factors, and the experience and skill levels of different operation and maintenance personnel vary, making it difficult to ensure the accuracy and consistency of fault diagnosis. Most of the existing automated fault diagnosis tools perform detection based on preset rules and thresholds. However, this approach has obvious limitations and is difficult to cope with the complex and changeable cloud platform database environment. In order to solve the above technical problems, the present application discloses a database diagnosis method, device, equipment and medium based on a large language model, which can realize intelligent diagnosis of the database by parsing the monitoring indicators and operation log information of the cloud platform database.
[0046] See also Figure 1 As shown, the embodiment of the present invention discloses a database diagnosis method based on a large language model, comprising:
[0047] Step S11, determine the target scheduled task, query the database instance list in the cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine the database to be diagnosed and the database type corresponding to the database to be diagnosed based on the database instance information.
[0048] In this embodiment, first, in the configmap configuration file of the cloud platform database backend application, the API key for calling Dify is encrypted and configured, which is used by the backend application to call the Dify workflow. A JobHandler is written in the backend Java application code to register the target scheduled task to the job-center (cloud platform task center) to implement the scheduled triggering of cloud platform database fault diagnosis. The target scheduled task is registered to call the Dify workflow at a specific time point or at a specific time interval. After the target scheduled task is registered, the database instance list in the cloud platform database instance is queried based on the target scheduled task to obtain the corresponding first query result; the database instance information in the database instance list is obtained according to the first query result through a preset API (Application Programming Interface) interface; wherein the database instance information includes any one or more of the database type, database instance ID (Identity document, account), database server connection IP and server private key information. Specifically, a list of all database instances is queried in the cloud platform database instance. Through the API interface provided by Dify, the database instance information in the database instance list, such as the database type (database_type), database instance ID (instance_id), database server connection IP (db_vm_ip) and server private key information (vm_private_key), is passed to trigger the workflow execution. Based on the passed-in database type (database_type), database instance ID (instance_id) and database server connection IP (db_vm_ip), the database type of the database to be diagnosed is identified in the Dify workflow.
[0049] Step S12: construct a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collect target database information of the database to be diagnosed based on the target connection.
[0050] In this embodiment, a corresponding database connection driver is used to establish a target connection with the cloud platform database instance, and the connection is implemented through Python code. Then, based on the target connection, a preset SQL (Structured Query Language) query statement is executed on the database to be diagnosed to obtain a corresponding second query result; based on the second query result, the database configuration and database operation status of the database to be diagnosed are obtained. Specifically, after successfully establishing a target connection with the cloud platform database, a series of preset SQL query statements are executed to collect the database configuration and the database operation status. Among them, the database configuration information covers multiple aspects such as character set, cache size, log settings, etc., and the database operation status information covers the number of queries, number of connections, number of lock waits, etc.
[0051] Furthermore, after determining the database configuration and database operating status of the database to be diagnosed, the server resource usage, the database log to be diagnosed, and the server system log are obtained respectively, and a preset format conversion operation is performed on the database configuration, the database operating status, the server resource usage, the database log to be diagnosed, and the server system log to obtain the target database information to be diagnosed. Specifically, after determining the database configuration and database operating status of the database to be diagnosed, the cloud platform CMS (Content Management System, cloud monitoring service) is called to obtain the server resource usage, and the cloud log platform is called to obtain the database log and server system log. The collected database configuration and operating status information, server resource monitoring information, and log information, namely, the database operation log and server system log, are then sorted and formatted, and the data is converted into a unified structure to obtain the target database information to be diagnosed.
[0052] It should be noted that in order to obtain the server resource usage, the database log to be diagnosed and the server system log respectively, the monitoring information of the database server within the preset time can be obtained by using the preset content management service through the HTTP transmission protocol, and the server resource usage corresponding to the database to be diagnosed can be determined based on the monitoring information of the database server; the database log to be diagnosed and the server system log can be obtained by using the preset log management service through the HTTP transmission protocol. Specifically, the CMS service is called through the HTTP transmission protocol to obtain the monitoring information of the database server within the past preset time, such as CPU usage, memory usage, disk I / O rate and network inflow / outflow. By collecting server information, the computing, storage and network resources used by the database process are observed, so as to facilitate the subsequent analysis of the running status of the database instance process and check whether the database instance is running stably in the server. Then, after the Dify workflow is triggered and executed, the CLS service is called through the HTTP transmission protocol to obtain the database operation log and server system log. Among them, the database log includes the database operation log, slow log and SQL audit log. It's understood that when a database failure occurs, the operation log will record the problem. By reviewing and analyzing the error information, operation sequence, and related contextual information recorded in the log, it is possible to analyze the cause of the failure, such as hardware failure, software error, transaction conflict, etc. In addition, by collecting this information, we can continuously monitor changes in database process status and obtain server system logs.
[0053] Step S13: Obtain preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions. Based on the preset database SQL rules and the preset database usage rules, input the target knowledge base and the target database information to be diagnosed into a preset large language model to obtain a target diagnosis result.
[0054] In this embodiment, a target knowledge base consisting of preset database SQL rules, preset database usage rules, and database problems and their solutions is constructed. When analyzing the target database information to be diagnosed using a preset large language model, the target knowledge base is fed into the preset large language model. Based on the preset database SQL rules and preset database usage rules, the preset large language model performs natural language processing and analysis on the target database information to be diagnosed. The preset large language model, with its powerful language understanding and generation capabilities, identifies potential problems, i.e., the target diagnosis results.
[0055] Step S14: determine a corresponding first solution from the target knowledge base based on the target diagnosis result, input the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain a second solution, integrate the first solution and the second solution to generate a target solution to complete the database diagnosis.
[0056] In this embodiment, based on the identified database issue, a corresponding solution and improvement suggestions are searched in the knowledge base, i.e., the first solution. Suggestions in the target knowledge base may include adjusting database configuration parameters, optimizing query statements, increasing hardware resources, etc. Simultaneously, the identified target diagnosis results and related target database information to be diagnosed are input into a large language model. The pre-set large language model generates targeted improvement suggestions based on its knowledge and reasoning capabilities, i.e., the second solution.
[0057] Next, the first solution and the second solution are integrated to generate a target solution that meets the preset format conditions; wherein the preset format conditions are any one or more of a preset text form, a preset table form, and a preset visual chart form. Specifically, the first solution retrieved from the knowledge base and the second solution generated by the large language model are integrated and screened, and the improvement suggestions that best suit the current database problem are output, namely the target solution. At the same time, the previously collected database instance information, the identified database problems, and the output improvement suggestions are integrated to form a target solution that meets the preset format conditions. The format can be text form, table form, or visual chart form. The target solution should include basic information about the database instance, existing problems, the severity of the problems, and specific improvement suggestions.
[0058] In addition, determine whether the abnormal information of the database to be diagnosed in the target solution meets the preset severity judgment conditions; if the abnormal information of the database to be diagnosed in the target solution meets the preset severity judgment conditions, the abnormal information of the database to be diagnosed is sent to the monitoring alarm service through the API interface of the monitoring alarm service of the cloud platform, so that the monitoring alarm service can issue an alarm according to the preset processing rules. Specifically, the abnormal information of the database to be diagnosed is screened out from the summarized target solution. These abnormal information can be problems with a severity reaching a certain threshold, or key problems pre-defined in the knowledge base. The target database to be diagnosed information and abnormal information are sent to the preset alarm model through the API interface of the preset alarm model. After receiving the abnormal information, the preset alarm model will perform alarm processing according to the preset processing rules, such as sending emails or text messages to notify relevant personnel.
[0059] As can be seen from the above, the embodiment of the present application first determines the target timed task, obtains instance information based on the database instance list in the query cloud platform database instance, determines the database to be diagnosed and its database type based on this, and then constructs the target connection between the cloud platform database instance and the database to be diagnosed according to the database type, collects the target database information to be diagnosed based on the connection, and then obtains the preset database SQL rules, preset database usage rules and the target knowledge base containing database problems and solutions. According to the first two rules, the target knowledge base and the target database information to be diagnosed are input into the preset large language model to obtain the target diagnosis result, and the first solution is determined from the target knowledge base based on the result. The target diagnosis result and the target database information to be diagnosed are input into the preset large language model to obtain the second solution. Finally, the two solutions are integrated to complete the database diagnosis. In this way, by automatically parsing the monitoring indicators and operation log information of the cloud platform database, intelligent diagnosis of the database is achieved, and the stability and reliability of the database system are improved.
[0060] Based on the previous embodiment, this application discloses a database diagnosis method based on a large language model, which can implement intelligent database diagnosis by analyzing the monitoring indicators and operation log information of the cloud platform database. Next, the database diagnosis method based on the large language model will be described in detail.
[0061] First, this application encrypts the API key for calling Dify in the configmap configuration file of the cloud platform database backend application. This key is used by the backend application to call the Dify workflow. A JobHandler is written in the backend Java application code to register the target scheduled task with the cloud platform task center. After registering the target scheduled task, the cloud platform database instance is searched for a list of all database instances. The database instance information in the list is passed through the Dify API. Based on this information, the database type of the database to be diagnosed is identified in the Dify workflow.
[0062] Next, use the corresponding database connection driver to establish a target connection with the cloud platform database instance. After that, execute a series of preset SQL query statements to collect the database configuration and database operation status, call the cloud platform CMS to obtain server resource usage, and call the cloud log platform to obtain database logs and server system logs. Then, organize and format the collected database configuration and operation status information, server resource monitoring information and log information, namely database operation logs and server system logs, and convert the data into a unified structure to obtain the target database information to be diagnosed.
[0063] Next, a target knowledge base consisting of pre-set database SQL rules, pre-set database usage rules, and database issues and their solutions is constructed. When the pre-set large language model is used to analyze the target database information to be diagnosed, the target knowledge base is fed into the pre-set large language model. Based on the pre-set database SQL rules and pre-set database usage rules, the pre-set large language model, with its powerful language understanding and generation capabilities, obtains the target diagnosis results.
[0064] Finally, based on the identified database issue, the corresponding solution and improvement suggestions are searched in the knowledge base, which is the first solution. Simultaneously, the identified target diagnosis results and related target database information are input into the large language model, which generates targeted improvement suggestions based on its knowledge and reasoning capabilities, which is the second solution. The first solution retrieved from the knowledge base and the second solution generated by the large language model are integrated and filtered to output the target solution that best suits the current database issue, completing the database diagnosis.
[0065] See also Figure 2 As shown, the embodiment of the present invention discloses a database diagnosis device based on a large language model, which may include:
[0066] A database determination module 11 is configured to determine a target scheduled task, query a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine a database to be diagnosed and a database type corresponding to the database to be diagnosed based on the database instance information;
[0067] An information collection module 12 is configured to establish a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and to collect target database information of the database to be diagnosed based on the target connection;
[0068] A result acquisition module 13 is configured to acquire preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions, and input the target knowledge base and the target database information to be diagnosed into a preset large language model based on the preset database SQL rules and the preset database usage rules to obtain a target diagnosis result;
[0069] The database diagnosis completion module 14 is used to determine the corresponding first solution from the target knowledge base based on the target diagnosis result, input the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain a second solution, integrate the first solution and the second solution to generate a target solution to complete the database diagnosis.
[0070] As can be seen from the above, this application first determines the target timed task, and obtains instance information based on the database instance list in the cloud platform database instance, thereby determining the database to be diagnosed and its database type, and then constructing the target connection between the cloud platform database instance and the database to be diagnosed according to the database type, and collecting the target database information to be diagnosed based on the connection, and then obtaining the preset database SQL rules, preset database usage rules and the target knowledge base containing database problems and solutions, and inputting the target knowledge base and the target database information to be diagnosed into the preset large language model according to the first two rules to obtain the target diagnosis result, and determining the first solution from the target knowledge base according to the result, and inputting the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain the second solution, and finally integrating the two solutions to complete the database diagnosis. In this way, by automatically parsing the monitoring indicators and operation log information of the cloud platform database, intelligent diagnosis of the database is achieved, and the stability and reliability of the database system are improved.
[0071] In some specific implementations, the database determination module 11 may specifically include:
[0072] A first query result obtaining unit, configured to query a list of database instances in the cloud platform database instance based on the target scheduled task to obtain a corresponding first query result;
[0073] A database instance information acquisition unit is used to obtain database instance information in the database instance list according to the first query result through a preset API interface; wherein the database instance information includes any one or more of the database type, database instance ID, database server connection IP and server private key information.
[0074] In some specific implementations, the information collection module 12 may specifically include:
[0075] The target database to be diagnosed information acquisition unit is used to determine the database configuration and database operation status of the database to be diagnosed, and respectively obtain the server resource usage, the database to be diagnosed log and the server system log, and perform a preset format conversion operation on the database configuration, the database operation status, the server resource usage, the database to be diagnosed log and the server system log to obtain the target database to be diagnosed information.
[0076] In some specific implementations, the target database information acquisition unit may include:
[0077] A second query result obtaining subunit is configured to execute a preset SQL query statement on the database to be diagnosed based on the target connection to obtain a corresponding second query result;
[0078] The database configuration and database operation status acquisition subunit is used to acquire the database configuration and database operation status of the database to be diagnosed based on the second query result.
[0079] In some specific implementations, the target database information acquisition unit may include:
[0080] A server resource usage determination subunit is configured to obtain monitoring information of a database server within a preset time period using a preset content management service via an HTTP transmission protocol, and determine the server resource usage corresponding to the database to be diagnosed based on the monitoring information of the database server;
[0081] The log acquisition subunit is used to obtain the database logs and server system logs to be diagnosed by using the preset log management service through the HTTP transmission protocol.
[0082] In some specific implementations, the database diagnosis completion module 14 may specifically include:
[0083] A target solution generation unit is used to integrate the first solution and the second solution to generate a target solution that meets preset format conditions; wherein the preset format conditions are any one or more of a preset text form, a preset table form, and a preset visual chart form.
[0084] In some specific implementations, the database diagnosis device based on a large language model may further include:
[0085] An abnormal information judgment module, used to judge whether the abnormal information of the database to be diagnosed in the target solution meets the preset severity judgment conditions;
[0086] The exception information sending module is used to send the exception information of the database to be diagnosed in the target solution to the monitoring and alarm service through the API interface of the cloud platform's monitoring and alarm service if the exception information of the database to be diagnosed meets the preset severity judgment condition, so that the monitoring and alarm service can issue an alarm according to the preset processing rules.
[0087] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 3 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.
[0088] Figure 3This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the database diagnosis method based on a large language model disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0089] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0090] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0091] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, NetWare, Unix, Linux, etc. In addition to including computer programs capable of implementing the database diagnosis method based on a large language model and executed by the electronic device 20 as disclosed in any of the aforementioned embodiments, the computer program 222 may further include computer programs capable of implementing other specific tasks.
[0092] Furthermore, this application discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned large language model-based database diagnosis method. The specific steps of this method can be found in the corresponding content disclosed in the aforementioned embodiments and will not be further described here.
[0093] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0094] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0095] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0096] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0097] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A database diagnosis method based on a large language model, characterized in that: include: Determine a target scheduled task, query a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine a database to be diagnosed and a database type corresponding to the database to be diagnosed based on the database instance information; Building a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collecting target database information of the database to be diagnosed based on the target connection; Obtaining preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions; based on the preset database SQL rules and the preset database usage rules, inputting the target knowledge base and the target database information to be diagnosed into a preset large language model to obtain a target diagnosis result; Based on the target diagnosis result, a corresponding first solution is determined from the target knowledge base, the target diagnosis result and the target database information to be diagnosed are input into the preset large language model to obtain a second solution, and the first solution and the second solution are integrated to generate a target solution to complete the database diagnosis.
2. The database diagnosis method based on a large language model according to claim 1, characterized in that: The querying of a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list includes: Querying a list of database instances in the cloud platform database instance based on the target scheduled task to obtain a corresponding first query result; Obtaining database instance information in the database instance list according to the first query result through a preset API interface; The database instance information includes any one or more of the following: database type, database instance ID, database server connection IP, and server private key information.
3. The database diagnosis method based on a large language model according to claim 1, characterized in that: The collecting target database information of the database to be diagnosed based on the target connection includes: Determine the database configuration and database operating status of the database to be diagnosed, and obtain the server resource usage, the database log to be diagnosed and the server system log respectively, and perform a preset format conversion operation on the database configuration, the database operating status, the server resource usage, the database log to be diagnosed and the server system log to obtain the target database information to be diagnosed.
4. The database diagnosis method based on a large language model according to claim 3, characterized in that: Determining the database configuration and database operation status of the database to be diagnosed includes: Executing a preset SQL query statement on the database to be diagnosed based on the target connection to obtain a corresponding second query result; The database configuration and database operation status of the database to be diagnosed are obtained based on the second query result.
5. The database diagnosis method based on a large language model according to claim 3, characterized in that: The method of respectively obtaining the server resource usage, the database log to be diagnosed, and the server system log includes: Acquiring monitoring information of a database server within a preset time period using a preset content management service via an HTTP transmission protocol, and determining server resource usage corresponding to the database to be diagnosed based on the monitoring information of the database server; Use the preset log management service through the HTTP transmission protocol to obtain the database log and server system log to be diagnosed.
6. The database diagnosis method based on a large language model according to any one of claims 1 to 5, characterized in that: The integrating the first solution and the second solution to generate a target solution includes: Integrating the first solution and the second solution to generate a target solution that meets a preset format condition; The preset format condition is any one or more of a preset text format, a preset table format, and a preset visual chart format.
7. The database diagnosis method based on a large language model according to claim 6, characterized in that: After integrating the first solution and the second solution to generate a target solution, the method further includes: Determining whether the abnormal information of the database to be diagnosed in the target solution meets the preset severity determination conditions; If the abnormal information of the database to be diagnosed in the target solution meets the preset severity judgment condition, the abnormal information of the database to be diagnosed is sent to the monitoring and alarm service through the API interface of the monitoring and alarm service of the cloud platform, so that the monitoring and alarm service can issue an alarm according to the preset processing rules.
8. A database diagnosis device based on a large language model, characterized in that: include: A database determination module is used to determine a target scheduled task, query a database instance list in a cloud platform database instance based on the target scheduled task to obtain database instance information in the database instance list, and determine a database to be diagnosed and a database type corresponding to the database to be diagnosed based on the database instance information; An information collection module is used to build a target connection between the cloud platform database instance and the database to be diagnosed according to the database type corresponding to the database to be diagnosed, and collect target database information of the database to be diagnosed based on the target connection; A result acquisition module is used to obtain preset database SQL rules, preset database usage rules, and a target knowledge base containing database problems and their solutions. Based on the preset database SQL rules and the preset database usage rules, the target knowledge base and the target database information to be diagnosed are input into a preset large language model to obtain a target diagnosis result; The database diagnosis completion module is used to determine the corresponding first solution from the target knowledge base based on the target diagnosis result, input the target diagnosis result and the target database information to be diagnosed into the preset large language model to obtain a second solution, integrate the first solution and the second solution to generate a target solution to complete the database diagnosis.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the database diagnosis method based on a large language model according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that Used to store a computer program; wherein, when the computer program is executed by a processor, the database diagnosis method based on a large language model according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Database exception repairing method, device and equipment based on intelligent agent and medium
CN120929297A