CN114138914A - MySQL database management method and device, electronic equipment and storage medium - Google Patents

MySQL database management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114138914A
CN114138914A CN202111502284.0A CN202111502284A CN114138914A CN 114138914 A CN114138914 A CN 114138914A CN 202111502284 A CN202111502284 A CN 202111502284A CN 114138914 A CN114138914 A CN 114138914A
Authority
CN
China
Prior art keywords
mysql database
state
sql
management method
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111502284.0A
Other languages
Chinese (zh)
Inventor
陈栋
高建华
周莉
杨光宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202111502284.0A priority Critical patent/CN114138914A/en
Publication of CN114138914A publication Critical patent/CN114138914A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a MySQL database management method, apparatus, electronic device, storage medium, and program product, which may be used in the financial field and other fields, wherein the MySQL database management method includes: when the state of a server where the MySQL database is located meets a preset condition, acquiring the SQL sentences and the execution states of the SQL sentences in the MySQL database, constructing an operation state topological graph of the MySQL database based on the SQL sentences and the execution states of the SQL sentences, and determining and processing all SQL sentences in abnormal states in the MySQL database by using the operation state topological graph of the MySQL database. The MySQL database management method provided by the disclosure can help database operation and maintenance personnel to know the running state of the database in time, is convenient for the operation and maintenance personnel to quickly locate and solve the problem, avoids the condition that the system is unavailable or the database system is slow to execute due to low execution efficiency of SQL sentences of the database, and can effectively guarantee the stable operation of the system.

Description

MySQL database management method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of relational database technologies, and in particular, to a MySQL database management method and apparatus, an electronic device, a storage medium, and a program product.
Background
When the production application system is temporarily unavailable or unavailable for a long time, a large part of reasons are related to the performance of the database, and due to the fact that a large number of users concurrently access the system and the uncertainty of accessing the system, performance problems occur to the database at a certain moment, so that the response of the whole application system is slow or the application system is unavailable. When the performance problem of the database occurs, the monitoring system usually gives an alarm first, and the operation and maintenance personnel process the database after receiving the alarm, and at this time, a large number of SQL statements may be found to be running, the database administrator needs to position each SQL statement, and then the problem SQL statement is searched and killed, and the problem processing method has delay. Or when the database administrator queries the database state, the database performance is already replied, and the database administrator is required to query the corresponding log of the MySQL database to locate the problem, so that the problem is processed by adopting the method and has hysteresis. In summary, in the prior art, the alarm information for the system in an abnormal condition is too wide for operation and maintenance personnel to search for and solve the problem, and the accuracy is lacking.
BRIEF SUMMARY OF THE PRESENT DISCLOSURE
In view of the foregoing, the present disclosure provides a MySQL database management method, apparatus, electronic device, storage medium, and program product.
According to a first aspect of the present disclosure, there is provided a MySQL database management method, comprising:
when the state of the server where the MySQL database is located meets a preset condition, acquiring an SQL statement in the MySQL database and the execution state of the SQL statement;
constructing an operation state topological graph of the MySQL database based on the SQL statement and the execution state of the SQL statement;
and determining and processing all SQL sentences in abnormal states in the MySQL database by using the running state topological graph of the MySQL database.
In an embodiment of the disclosure, before obtaining the execution state of the SQL statement in the MySQL database when the state of the server in which the MySQL database is located meets a preset condition, the method further includes:
periodically acquiring the memory utilization rate and the CPU utilization rate of the server and the MySQL database process;
and judging whether the memory utilization rate and the CPU utilization rate of the server and the process of the MySQL database meet preset conditions or not.
In an embodiment of the present disclosure, the preset conditions are:
and at least one of the memory utilization rate of the server, the CPU utilization rate and the progress of the MySQL database has a variation value exceeding a corresponding preset threshold value.
In an embodiment of the present disclosure, the execution state of the SQL statement includes an execution thread number of each SQL statement.
In an embodiment of the present disclosure, before determining and processing all SQL statements in an abnormal state in the MySQL database by using the topology map of the running state of the MySQL database, the method further includes:
acquiring the number of currently executed bus procedures in the MySQL database through the running state topological graph of the MySQL database;
when the number of the bus threads exceeds a preset first threshold value, judging that the MySQL database is in an abnormal state;
and when the MySQL database is in an abnormal state, determining and processing all SQL sentences in the MySQL database in the abnormal state.
In an embodiment of the present disclosure, the determining and processing all SQL statements in an abnormal state in the MySQL database specifically includes:
when the state of the currently executed SQL statement is a lock state, judging that the currently executed SQL statement is in an abnormal state;
when the executed time of the currently executed SQL statement exceeds a preset second threshold value, judging that the currently executed SQL statement is in an abnormal state;
and terminating the execution of all SQL statements in the abnormal state.
A second aspect of the present disclosure provides a MySQL database management apparatus, comprising:
the acquisition module is used for acquiring the SQL sentences in the MySQL database and the execution state of the SQL sentences when the state of the server where the MySQL database is located meets the preset condition;
the construction module is used for constructing a running state topological graph of the MySQL database based on the SQL statement and the execution state of the SQL statement;
and the processing module is used for determining and processing all SQL sentences in abnormal states in the MySQL database by utilizing the running state topological graph of the MySQL database.
A third aspect of the present disclosure provides an electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the MySQL database management method.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the MySQL database management method described above.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the MySQL database management method described above.
The MySQL database management method provided by the disclosure comprises the following steps: when the state of a server where the MySQL database is located meets a preset condition, acquiring the SQL sentences and the execution states of the SQL sentences in the MySQL database, constructing an operation state topological graph of the MySQL database based on the SQL sentences and the execution states of the SQL sentences, and determining and processing all SQL sentences in abnormal states in the MySQL database by using the operation state topological graph of the MySQL database. The method can help the database operation and maintenance personnel to know the operation state of the database in time, is convenient for the operation and maintenance personnel to quickly locate and solve the problem, avoids the condition that the system is unavailable or the database system is slowly executed due to low execution efficiency of SQL sentences of the database, and can effectively guarantee the stable operation of the system.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a diagram schematically illustrating an application scenario of a MySQL database management method according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart diagram illustrating a MySQL database management method according to an embodiment of the disclosure;
FIG. 3 is a schematic flow chart diagram illustrating a MySQL database management method according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart diagram illustrating a MySQL database management method according to an embodiment of the present disclosure;
FIG. 5 is a schematic flow chart diagram illustrating a method for determining and processing all abnormal SQL statements in the MySQL database according to an embodiment of the present disclosure;
fig. 6 schematically shows a block diagram of a MySQL database management apparatus according to an embodiment of the present disclosure;
fig. 7 schematically shows a block diagram of a structure of still another MySQL database management apparatus provided by an embodiment of the present disclosure;
fig. 8 schematically shows a block diagram of a structure of still another MySQL database management apparatus provided by an embodiment of the present disclosure;
fig. 9 schematically shows a block diagram of a processing module of a MySQL database management apparatus according to an embodiment of the present disclosure; and
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a MySQL database management method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). It will be further understood by those within the art that virtually any disjunctive word and/or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase "a or B" should be understood to include the possibility of "a" or "B", or "a and B".
Some block diagrams and/or flow diagrams are shown in the figures. It will be understood that some blocks of the block diagrams and/or flowchart illustrations, or combinations thereof, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the instructions, which execute via the processor, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks. The techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). In addition, the techniques of this disclosure may take the form of a computer program product on a computer-readable medium having instructions stored thereon for use by or in connection with an instruction execution system. In the context of this disclosure, a computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the instructions. For example, the computer readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. Specific examples of the computer readable medium include: magnetic storage devices, such as magnetic tape or Hard Disk Drives (HDDs); optical storage devices, such as compact disks (CD-ROMs); a memory, such as a Random Access Memory (RAM) or a flash memory; and/or wired/wireless communication links.
The disclosure provides a MySQL database management method, a MySQL database management device, electronic equipment, a storage medium and a program product. The following description is made by way of example with reference to the accompanying drawings. It should be noted that the sequence numbers of the respective operations in the following methods are merely used as representations of the operations for description, and should not be construed as representing the execution order of the respective operations. The method need not be performed in the exact order shown, unless explicitly stated.
The present disclosure provides a MySQL database management method, which includes: when the state of a server where the MySQL database is located meets a preset condition, acquiring the SQL sentences and the execution states of the SQL sentences in the MySQL database, constructing an operation state topological graph of the MySQL database based on the SQL sentences and the execution states of the SQL sentences, and determining and processing all SQL sentences in abnormal states in the MySQL database by using the operation state topological graph of the MySQL database. The method can help the database operation and maintenance personnel to know the operation state of the database in time, is convenient for the operation and maintenance personnel to quickly locate and solve the problem, avoids the condition that the system is unavailable or the database system is slowly executed due to low execution efficiency of SQL sentences of the database, and can effectively guarantee the stable operation of the system.
It should be noted that the MySQL database management method and apparatus provided by the present disclosure may be used in the financial field, and may also be used in any field other than the financial field.
Fig. 1 schematically shows an application scenario diagram of a MySQL database management method according to an embodiment of the present disclosure. As shown in fig. 1, the application scenario diagram according to this embodiment may comprise terminal devices 101, 102, 103, a network 104 and a server/server cluster 105. The network 104 serves to provide a medium of communication links between the terminal devices 101, 102, 103 and the server/server cluster 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 101, 102, 103 to interact with the server/server cluster 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various client applications installed thereon, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may interact with the server/server cluster 105 through various client applications to send various requests to the server/server cluster 105 or to receive results returned by the server/server cluster 105.
The terminal devices 101, 102, 103 may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server/server cluster 105 may be a server that provides various services, such as a background management server (for example only) that provides support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that a MySQL database management method provided by the embodiments of the present disclosure may be generally executed by the server/server cluster 105. Accordingly, a MySQL database management apparatus provided by the embodiments of the present disclosure may be generally disposed in the server/server cluster 105. The MySQL database management method provided by the embodiments of the present disclosure may also be executed by a server or server cluster that is different from the server/server cluster 105 and that is capable of communicating with the terminal devices 101, 102, 103 and/or the server/server cluster 105. Correspondingly, the MySQL database management apparatus provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server/server cluster 105 and capable of communicating with the terminal devices 101, 102, and 103 and/or the server/server cluster 105.
It should be understood that the number of end devices, networks, and server/server clusters in fig. 1 is illustrative only. There may be any number of end devices, networks, and server/server clusters, as desired.
A MySQL database management method according to an embodiment of the present disclosure will be described in detail below with reference to fig. 2 to 5 based on the scenario described in fig. 1. So that those skilled in the art can more clearly understand the technical solution of the present disclosure. It should be understood that the following description is only exemplary to assist those skilled in the art in understanding the aspects of the present disclosure, and is not intended to limit the scope of the present disclosure.
Fig. 2 schematically shows a flowchart of a MySQL database management method according to an embodiment of the present disclosure. As shown in fig. 2, in an embodiment of the present disclosure, the method includes operations S210 to S230.
In operation S210, when the state of the server in which the MySQL database is located meets a preset condition, the SQL statement in the MySQL database and the execution state of the SQL statement are obtained.
In this embodiment, when the state of the server where the MySQL database is located satisfies the preset condition, a show full processslist statement may be executed in the MySQL database, and the execution state of the SQL statement in the MySQL database may be obtained through the statement, where the execution state of the SQL statement includes an execution thread number of each SQL statement, and the method further includes: user, host address, connected host library, command, execution time, status, etc.
It should be understood that the method for acquiring the execution state of the SQL statement in the MySQL database in the embodiment is only an example to help those skilled in the art understand the technical solution of the present disclosure, and is not intended to limit the scope of the present disclosure. The method for acquiring the execution state of the SQL statement in the MySQL database may be selected according to actual needs, and is not limited herein.
In operation S220, an operation state topology diagram of the MySQL database is constructed based on the SQL statement and the execution state of the SQL statement.
In operation S230, all the SQL statements in the abnormal state in the MySQL database are determined and processed by using the topology map of the running state of the MySQL database.
In this embodiment, the state of the server where the MySQL database is located is monitored in real time, when the state of the server where the MySQL database is located meets a preset condition, the execution states of the SQL statements and the SQL statements in the MySQL database are obtained, and then a topological graph reflecting the operation states of the MySQL database is constructed based on the execution states of the SQL statements and the SQL statements in the MySQL database.
Fig. 3 schematically shows a flowchart of another MySQL database management method provided by an embodiment of the present disclosure. As shown in fig. 3, in an embodiment of the present disclosure, before the operation S210, the method further includes operations S310 to S320.
In operation S310, memory usage, CPU usage, and the MySQL database process of the server are periodically obtained.
In operation S320, it is determined whether the memory usage rate of the server, the CPU usage rate, and the process of the MySQL database satisfy preset conditions.
In this embodiment, the preset conditions are as follows: and at least one of the memory utilization rate of the server, the CPU utilization rate and the progress of the MySQL database has a variation value exceeding a corresponding preset threshold value.
In this embodiment, the state of the server where the MySQL database is located is monitored in real time, the memory usage rate, the CPU usage rate, and the MySQL database process of the server are periodically obtained, for example, the memory usage rate, the CPU usage rate, and the MySQL database process of the server where the MySQL database is located are obtained every 5 seconds, and it is determined whether at least one of the memory usage rate, the CPU usage rate, and the process of the MySQL database exceeds a corresponding preset threshold. The server where the MySQL database is located is monitored in real time, and the state of the MySQL database can be obtained in time, so that the topological graph is updated in time, the running state of the MySQL database displayed by the topological graph is the latest, database operation and maintenance personnel can find and process the abnormity of the database in time, and the stable running of the database is guaranteed.
It should be understood that the example of the period of acquiring the state of the server where the MySQL database is located in the present embodiment is merely an example to help those skilled in the art to understand the technical solution of the present disclosure, and is not intended to limit the scope of the present disclosure. The period for acquiring the state of the server where the MySQL database is located may be selected according to actual needs, and is not limited herein.
Fig. 4 schematically shows a flowchart of another MySQL database management method provided by an embodiment of the present disclosure. As shown in fig. 4, in an embodiment of the present disclosure, before the operation S230, the method further includes operations S410 to S430.
In operation S410, the current number of executed bus processes in the MySQL database is obtained through the topology map of the running state of the MySQL database.
In operation S420, when the number of the bus threads exceeds a preset first threshold, it is determined that the MySQL database is in an abnormal state.
In operation S430, when the MySQL database is in an abnormal state, all SQL statements in the MySQL database in the abnormal state are determined and processed.
In this embodiment, the current number of executed bus threads in the MySQL database may be obtained by analyzing the topology map of the running state of the MySQL database. Because the thread number in the database is set according to the baseline, when the thread number executed in the database at the same time exceeds the threshold value, the database may be executed slowly and be down, and therefore, when the currently executed bus thread number in the MySQL database exceeds the preset first threshold value, the MySQL database is in an abnormal state. When the MySQL database is in an abnormal state, the SQL statements in the MySQL database need to be analyzed and processed. The number of currently executed bus processes of the MySQL database is quickly acquired based on the constructed MySQL database running state topological graph, the state of the MySQL database can be timely determined, and corresponding measures can be timely made according to the state of the MySQL database, so that stable running of the MySQL database is guaranteed.
Fig. 5 schematically shows a flowchart of a method for determining and processing all SQL statements in an abnormal state in the MySQL database according to an embodiment of the present disclosure. As shown in fig. 5, in an embodiment of the present disclosure, the method includes operations S510 to S530.
In operation S510, when there is a currently executed SQL statement whose state is the lock state, it is determined that the currently executed SQL statement is in an abnormal state.
In operation S520, when the executed time of the currently executed SQL statement exceeds a preset second threshold, it is determined that the currently executed SQL statement is in an abnormal state.
In operation S530, execution of all SQL statements in the abnormal state is terminated.
In this embodiment, when the MySQL database is in an abnormal state, which SQL statements cause the MySQL database needs to be determined, so that the currently executed SQL statements in the MySQL database need to be analyzed, for example, the state of the SQL statements is determined, if the state of one currently executed SQL statement is a lock state, the SQL statement is executed slowly, which may affect the performance of the MySQL database, and therefore, it is determined that the SQL statement is in an abnormal state, and the SQL statement needs to be processed. Or, if the executed time of a currently executed SQL statement exceeds a preset second threshold, it is determined that the SQL statement is executed slowly, and the SQL statement is in an abnormal state and needs to be processed. When the MySQL database is in an abnormal state, the SQL sentences in the abnormal state are quickly positioned through analyzing the currently executed SQL sentences in the MySQL database, and the operation of all the SQL sentences in the abnormal state is stopped, so that the abnormality of the MySQL database can be timely solved, and the stable operation of the system is effectively guaranteed.
It should be understood that the processing method for the SQL statement in the abnormal state in this embodiment is only an example to help those skilled in the art understand the technical solution of the present disclosure, and is not intended to limit the protection scope of the present disclosure. The processing method of the SQL statement in the abnormal state may be selected according to actual needs, and is not limited herein.
Based on the MySQL database management method, the disclosure also provides a MySQL database management device. The apparatus will be described in detail below with reference to fig. 6-9.
Fig. 6 schematically shows a block diagram of a MySQL database management apparatus according to an embodiment of the present disclosure.
As shown in fig. 6, in an embodiment of the present disclosure, the MySQL database management apparatus 600 includes: an acquisition module 610, a construction module 620, and a processing module 630.
The obtaining module 610 is configured to obtain the SQL statements in the MySQL database and the execution states of the SQL statements when the state of the server where the MySQL database is located meets a preset condition. In an embodiment, the obtaining module 610 may be configured to perform the operation S210 described above, which is not described herein again.
And a constructing module 620, configured to construct an operation state topological graph of the MySQL database based on the SQL statement and the execution state of the SQL statement. In an embodiment, the constructing module 620 may be configured to perform the operation S220 described above, which is not described herein again.
And the processing module 630 is configured to determine and process all SQL statements in an abnormal state in the MySQL database by using the topology map of the running state of the MySQL database. In an embodiment, the processing module 630 may be configured to perform the operation S230 described above, which is not described herein again.
Fig. 7 schematically shows a block diagram of a structure of another MySQL database management apparatus provided by an embodiment of the present disclosure.
As shown in fig. 7, in an embodiment of the present disclosure, the apparatus 600 further includes: a second obtaining module 710 and a determining module 720.
The second obtaining module 710 is configured to periodically obtain a memory usage rate, a CPU usage rate, and the MySQL database process of the server. In an embodiment, the second obtaining module 710 may be configured to perform the operation S310 described above, which is not described herein again.
The determining module 720 is configured to determine whether the memory usage rate and the CPU usage rate of the server and the process of the MySQL database satisfy preset conditions. In an embodiment, the determining module 720 may be configured to perform the operation S320 described above, which is not described herein again.
Fig. 8 schematically shows a block diagram of a structure of another MySQL database management apparatus provided by an embodiment of the present disclosure.
As shown in fig. 8, in an embodiment of the present disclosure, the apparatus 600 further includes: a third obtaining module 810, a second judging module 820 and a third judging module 830.
And a third obtaining module 810, configured to obtain, through the running state topological graph of the MySQL database, a currently executed bus procedure number in the MySQL database. In an embodiment, the third obtaining module 810 may be configured to perform the operation S410 described above, which is not described herein again.
The second determining module 820 is configured to determine that the MySQL database is in an abnormal state when the number of the bus threads exceeds a preset first threshold. In an embodiment, the second determining module 820 may be configured to perform the operation S420 described above, which is not described herein again.
The third determining module 830 is configured to determine and process all the SQL statements in the abnormal state in the MySQL database when the MySQL database is in the abnormal state. In an embodiment, the third determining module 830 may be configured to perform the operation S430 described above, and is not described herein again.
Fig. 9 schematically shows a block diagram of a processing module of a MySQL database management device according to an embodiment of the present disclosure.
As shown in fig. 9, in an embodiment of the present disclosure, the processing module 630 includes: a fourth determination module 910, a fifth determination module 920, and a termination module 930.
The fourth determining module 910 is configured to determine that the currently executed SQL statement is in an abnormal state when the state of the currently executed SQL statement is the lock state. In an embodiment, the fourth determining module 910 may be configured to perform the operation S510 described above, which is not described herein again.
A fifth determining module 920, configured to determine that the currently executed SQL statement is in an abnormal state when the executed time of the currently executed SQL statement exceeds a preset second threshold. In an embodiment, the fifth determining module 920 may be configured to perform the operation S520 described above, which is not described herein again.
And a termination module 930, configured to terminate execution of all SQL statements in the abnormal state. In an embodiment, the terminating module 930 may be configured to perform the operation S530 described above, which is not described herein again.
It should be noted that the implementation, solved technical problems, implemented functions, and achieved technical effects of each module/unit/subunit and the like in the apparatus part embodiment are respectively the same as or similar to the implementation, solved technical problems, implemented functions, and achieved technical effects of each corresponding step in the method part embodiment, and are not described herein again.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any of the obtaining module 610, the constructing module 620, and the processing module 630 may be combined and implemented in one module, or any one of them may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the obtaining module 610, the constructing module 620, and the processing module 630 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or may be implemented in any one of three implementations of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the obtaining module 610, the constructing module 620 and the processing module 630 may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a MySQL database management method according to an embodiment of the disclosure.
As shown in fig. 10, an electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. Processor 1001 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1001 may also include onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the present disclosure.
In the RAM 1003, various programs and data necessary for the operation of the electronic apparatus 1000 are stored. The processor 1001, ROM 1002, and RAM 1003 are connected to each other by a bus 1004. The processor 1001 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 1002 and/or the RAM 1003. Note that the programs may also be stored in one or more memories other than the ROM 1002 and the RAM 1003. The processor 1001 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 1000 may also include an input/output (I/O) interface 1005, the input/output (I/O) interface 1005 also being connected to bus 1004, according to an embodiment of the present disclosure. Electronic device 1000 may also include one or more of the following components connected to I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
The present disclosure also provides a computer readable storage medium having stored thereon a computer program comprising a MySQL database management method as described above. The computer-readable storage medium may be embodied in the apparatuses/devices described in the above embodiments; or may be present separately and not assembled into the device/apparatus. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, a computer readable medium may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 1002 and/or the RAM 1003 described above and/or one or more memories other than the ROM 1002 and the RAM 1003.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the MySQL database management method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 1001. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted in the form of a signal on a network medium, distributed, downloaded and installed via the communication part 1009, and/or installed from the removable medium 1011. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. The computer program performs the above-described functions defined in the system of the embodiment of the present disclosure when executed by the processor 1001. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. While the disclosure has been shown and described with reference to certain exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the disclosure as defined by the appended claims and their equivalents. Accordingly, the scope of the present disclosure should not be limited to the above-described embodiments, but should be defined not only by the appended claims, but also by equivalents thereof.

Claims (10)

1. A MySQL database management method is characterized by comprising the following steps:
when the state of a server where the MySQL database is located meets a preset condition, acquiring an SQL statement in the MySQL database and the execution state of the SQL statement;
constructing a running state topological graph of the MySQL database based on the SQL statement and the execution state of the SQL statement;
and determining and processing all SQL sentences in abnormal states in the MySQL database by using the running state topological graph of the MySQL database.
2. The MySQL database management method according to claim 1, wherein before acquiring the execution state of the SQL statements in the MySQL database when the state of the server in which the MySQL database is located meets a preset condition, the method further comprises:
periodically acquiring the memory utilization rate, the CPU utilization rate and the MySQL database process of the server;
and judging whether the memory utilization rate and the CPU utilization rate of the server and the process of the MySQL database meet preset conditions or not.
3. The MySQL database management method according to claim 2, wherein the preset conditions are:
and at least one of the memory utilization rate of the server, the CPU utilization rate and the progress of the MySQL database has a variation value exceeding a corresponding preset threshold value.
4. The MySQL database management method according to claim 1, wherein the execution state of the SQL statements includes an execution thread number of each of the SQL statements.
5. The MySQL database management method according to claim 4, wherein before determining and processing all SQL statements in abnormal state in the MySQL database by using the running state topological graph of the MySQL database, the method further comprises:
acquiring the number of currently executed bus procedures in the MySQL database through the running state topological graph of the MySQL database;
when the bus program number exceeds a preset first threshold value, judging that the MySQL database is in an abnormal state;
and when the MySQL database is in an abnormal state, determining and processing all SQL sentences in the MySQL database in the abnormal state.
6. The MySQL database management method according to claim 5, wherein the determining and processing all abnormal SQL statements in the MySQL database specifically comprises:
when the state of the currently executed SQL statement is a lock state, judging that the currently executed SQL statement is in an abnormal state;
when the executed time of one currently executed SQL statement exceeds a preset second threshold value, judging that the currently executed SQL statement is in an abnormal state;
and terminating the execution of all SQL statements in the abnormal state.
7. A MySQL database management apparatus, comprising:
the acquisition module is used for acquiring the SQL sentences in the MySQL database and the execution state of the SQL sentences when the state of the server where the MySQL database is located meets the preset condition;
the construction module is used for constructing a running state topological graph of the MySQL database based on the SQL statement and the execution state of the SQL statement;
and the processing module is used for determining and processing all SQL sentences in abnormal states in the MySQL database by utilizing the running state topological graph of the MySQL database.
8. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the MySQL database management method according to any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform a MySQL database management method according to any of claims 1-6.
10. A computer program product comprising a computer program which, when executed by a processor, implements a MySQL database management method according to any of claims 1 to 6.
CN202111502284.0A 2021-12-09 2021-12-09 MySQL database management method and device, electronic equipment and storage medium Pending CN114138914A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111502284.0A CN114138914A (en) 2021-12-09 2021-12-09 MySQL database management method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111502284.0A CN114138914A (en) 2021-12-09 2021-12-09 MySQL database management method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114138914A true CN114138914A (en) 2022-03-04

Family

ID=80385504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111502284.0A Pending CN114138914A (en) 2021-12-09 2021-12-09 MySQL database management method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114138914A (en)

Similar Documents

Publication Publication Date Title
CN113900834B (en) Data processing method, device, equipment and storage medium based on Internet of things technology
CN111125107A (en) Data processing method, device, electronic equipment and medium
CN112181948B (en) Processing method and device of database operation statement, electronic equipment and medium
CN114238058A (en) Monitoring method, apparatus, device, medium, and program product
CN107291835B (en) Search term recommendation method and device
US9973410B2 (en) Notifying original state listeners of events in a domain model
CN113495825A (en) Line alarm processing method and device, electronic equipment and readable storage medium
CN113420935A (en) Fault location method, apparatus, device and medium
CN113076224A (en) Data backup method, data backup system, electronic device and readable storage medium
CN115550141A (en) Event processing method and device, electronic equipment and readable storage medium
CN114116782A (en) Distributed database resource control method and device, electronic equipment and storage medium
CN113064834B (en) Abnormality detection method, abnormality detection device, electronic apparatus, and medium
CN114138914A (en) MySQL database management method and device, electronic equipment and storage medium
CN114281586A (en) Fault determination method and device, electronic equipment and computer readable storage medium
CN114201508A (en) Data processing method, data processing apparatus, electronic device, and storage medium
CN114268558B (en) Method, device, equipment and medium for generating monitoring graph
CN114640585B (en) Resource updating method and device, electronic equipment and storage medium
CN117193990B (en) Scheduling management method, device, equipment and storage medium of http interface
CN113794719A (en) Network abnormal traffic analysis method and device based on Elasticissearch technology and electronic equipment
CN117112081A (en) Scheduling management method, device, equipment and medium of Python script
CN116795671A (en) Code checking method and device
CN113419922A (en) Method and device for processing batch job running data of host
CN115687284A (en) Information processing method, device, equipment and storage medium
CN116975200A (en) Method, device, equipment and medium for controlling working state of server
CN115757417A (en) Operation and maintenance method, device, equipment, storage medium and program product of HBase table

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination