CN110955647A - Database assistance method, database assistance device, computer equipment and storage medium - Google Patents

Database assistance method, database assistance device, computer equipment and storage medium Download PDF

Info

Publication number
CN110955647A
CN110955647A CN201911224574.6A CN201911224574A CN110955647A CN 110955647 A CN110955647 A CN 110955647A CN 201911224574 A CN201911224574 A CN 201911224574A CN 110955647 A CN110955647 A CN 110955647A
Authority
CN
China
Prior art keywords
database
information
master
master database
state
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
CN201911224574.6A
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.)
Tianyi Digital Life Technology Co Ltd
Original Assignee
21cn Corp Ltd
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 21cn Corp Ltd filed Critical 21cn Corp Ltd
Priority to CN201911224574.6A priority Critical patent/CN110955647A/en
Publication of CN110955647A publication Critical patent/CN110955647A/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/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • 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/25Integrating or interfacing systems involving database management systems

Landscapes

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

Abstract

The application relates to a database assistance method, a database assistance device, a computer device and a storage medium. Relates to the field of computers. The method comprises the following steps: firstly, when a main database fails, acquiring state information and fault information of the main database, wherein the state information is used for indicating at least one of a storage state and an access state of the main database, and the fault information is used for indicating fault data of the main database; then, outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm; then according to the database replacement strategy, determining a target alternative database from an alternative database cluster, wherein the alternative database cluster comprises a plurality of alternative databases with different performance grades; and finally, replacing the main database with the target alternative database for service. By adopting the method, the time for analyzing the fault can be shortened.

Description

Database assistance method, database assistance device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a database assistance method and apparatus, a computer device, and a storage medium.
Background
In the field of computer technology, the use of databases is very common. In general, the master database cannot be used normally due to long-time query, high concurrent request, network instability, and the like. In order to make the master database stably provide services for the application, a related technology of high-availability architecture of the database is developed.
In the related database high-availability architecture technology, when a main database fails, the failure condition can be manually analyzed, and then an alternative database is configured for the main database, so that the alternative database replaces the main database to continuously provide service for the application.
However, in the related high-availability architecture technology, when the fault is analyzed manually, the problem that it takes too long to analyze the fault manually is often caused by too much fault data.
Disclosure of Invention
In view of the above, it is necessary to provide a database assistance method, an apparatus, a computer device, and a storage medium capable of reducing time consumption for failure analysis.
In a first aspect, a database assistance method is provided, the method comprising:
when a master database fails, acquiring state information and fault information of the master database, wherein the state information is used for indicating at least one of a storage state and an access state of the master database, and the fault information is used for indicating fault data of the master database;
outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
determining a target alternative database from an alternative database cluster according to the database replacement strategy, wherein the alternative database cluster comprises a plurality of alternative databases with different performance levels;
and replacing the main database with the target alternative database for service.
In one embodiment, before the state information and the failure information of the master database are obtained when the master database fails, the method further includes:
acquiring service information of the master database, wherein the service information comprises service state, replication state, performance state and network flow information of the master database, the service state of the master database is used for indicating whether the master database is normally serviced, the replication state of the master database is used for indicating whether the replication function of the master database is normal, the performance state of the master database is used for indicating the occupancy rate of a disk where the master database is located, and the network flow information of the master database is used for indicating the data volume transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
In one embodiment, the obtaining service information of the master database includes:
and acquiring the service information of the main database at regular time according to a preset time interval.
In one embodiment, the storage status of the master database includes the amount of data in the master database that characterizes the number of tables in the master database and the data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In one embodiment, the secondary algorithm is constructed based on a proximity algorithm and a Bayesian algorithm.
In one embodiment, after the serving with the target alternative database instead of the main database, the method further includes:
and generating a report and alarm information according to the state information of the main database, the fault information of the main database and the database replacement strategy.
In one embodiment, after the serving with the target alternative database instead of the main database, the method further includes:
and storing the database replacement strategy so that when the main database fails, the corresponding alternative database is selected to be replaced according to the database replacement strategy.
In a second aspect, there is provided a database assisting apparatus, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring state information and fault information of a main database when the main database fails, the state information is used for indicating at least one of a storage state and an access state of the main database, and the fault information is used for indicating fault data of the main database;
the output module is used for outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
a determining module, configured to determine a target alternative database from an alternative database cluster according to the database replacement policy, where the alternative database cluster includes a plurality of alternative databases with different performance levels;
and the replacing module is used for replacing the main database with the target alternative database for service.
In one embodiment, the apparatus further includes a second obtaining module, where the second obtaining module is configured to obtain service information of the master database, where the service information includes a service status, a replication status, a performance status, and network traffic information of the master database, the service status of the master database is used to indicate whether the master database is normally serviced, the replication status of the master database is used to indicate whether replication function of the master database is normal, the performance status of the master database is used to indicate an occupancy rate of a disk where the master database is located, and the network traffic information of the master database is used to indicate an amount of data transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
In one embodiment, the second obtaining module is specifically configured to obtain the service information of the master database at regular time according to a preset time interval.
In one embodiment, the storage status of the master database includes the amount of data in the master database that characterizes the number of tables in the master database and the data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In one embodiment, the secondary algorithm is constructed based on a proximity algorithm and a Bayesian algorithm.
In one embodiment, the apparatus further comprises a generation module, configured to generate a report and alarm information according to the state information of the master database, the fault information of the master database, and the database replacement policy.
In one embodiment, the apparatus further includes a storage module, where the storage module is configured to store the database replacement policy, so that when the primary database fails, a corresponding alternative database is selected according to the database replacement policy for replacement.
In a third aspect, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any of the first aspects when executing the computer program.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the first aspects described above.
According to the database assistance method, the database assistance device, the computer equipment and the storage medium, firstly, when a main database fails, state information and fault information of the main database are obtained, wherein the state information is used for indicating at least one of a storage state and an access state of the main database, and the fault information is used for indicating fault data of the main database; then, outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm; then according to the database replacement strategy, determining a target alternative database from an alternative database cluster, wherein the alternative database cluster comprises a plurality of alternative databases with different performance grades; and finally, replacing the main database with the target alternative database for service. According to the database auxiliary method, when the main database fails, the corresponding alternative database can be selected to replace the main database for service without manually analyzing the failure, so that the time for analyzing the failure is shortened to a certain extent.
Drawings
FIG. 1 is a diagram illustrating an exemplary database assistance method;
FIG. 2 is a schematic flow chart diagram illustrating a database assistance method in one embodiment;
FIG. 3 is a flow diagram illustrating a process for determining whether a primary database fails according to one embodiment;
FIG. 4 is a block diagram showing the structure of a database support apparatus according to another embodiment;
FIG. 5 is a block diagram of an alternative database accessory in accordance with one embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The database assistance method provided by the application can be applied to the application environment shown in fig. 1. Where the terminal 101 communicates with a server 102 via a network connection, a master database may be present on the server 102. The server 102 may obtain the state information and the fault information of the main database, then the server 102 may process the state information and the fault information by using an auxiliary algorithm to obtain a database replacement policy, then select an alternative database of a corresponding performance level to replace the main database for service according to the replacement policy, finally the server 102 may generate a report and alarm information according to the state information, the fault information and the database replacement policy of the main database, and then the server 102 may transmit the report and the alarm information to the terminal 101.
It should be noted that the implementation environment related to the database assistance method provided by the present application may only include the terminal 101, and under the condition that the implementation environment only includes the terminal 101, the terminal 101 may obtain state information and fault information of the main database, then process the obtained state information of the main database by using an assistance algorithm to obtain a database replacement policy, then select a corresponding alternative database from the alternative databases according to the database replacement policy for replacement, and finally the terminal 101 may generate and display a report and alarm information.
It should be further noted that the implementation environment related to the database assistance method provided by the present application may only include the server 102, and in the case that the implementation environment only includes the server 102, the server 102 may obtain the state information and the fault information of the main database, then process the obtained state information of the main database by using the assistance algorithm to obtain the database replacement policy, and then select a corresponding alternative database from the alternative databases for replacement according to the database replacement policy.
The terminal 101 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 102 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In the embodiment of the present application, as shown in fig. 2, a database assistance method is provided, which is described by taking an example that the method is applied to the server in fig. 1, and includes the following steps:
in step 201, when a master database fails, a server acquires state information and failure information of the master database.
The status information is used for indicating at least one of a storage status and an access status of the master database, and the fault information is used for indicating fault data of the master database.
In general, a master database often fails due to excessive data storage or frequent access, and also fails due to syntax errors or programming holes in the master database. Therefore, when the main database fails, the current storage state, access state and failure information of the main database can be obtained with emphasis.
In this step, when it is judged that the master database has failed. It is explained that the current master database cannot provide service normally temporarily, and at this time, the fault of the master database needs to be analyzed. Therefore, when the main database fails, the current storage state, access state and failure information of the main database can be obtained with emphasis.
By analyzing the state information and the fault information of the master database, the specific fault reason of the current master database can be obtained more accurately.
In step 202, the server outputs a database replacement policy according to the state information and the fault information of the primary database by using an auxiliary algorithm.
In this step, an auxiliary algorithm is set, and optionally, the auxiliary algorithm is constructed according to a proximity algorithm and a bayesian algorithm. The auxiliary algorithm can predict the fault reason of the main database according to the state information and the fault information. For example, the main database performance surge may be caused by abnormal, the concurrent request number surge may be caused by abnormal, or the concurrent request users may be caused by abnormal. The secondary algorithm may then present a corresponding database replacement policy based on the reason the primary database is not normal.
In practical application, an administrator can uniformly manage a plurality of main databases, and when two or more main databases have faults, the administrator can determine which main database has the fault to be processed preferentially according to the service importance level configured in advance.
Step 203, the server determines a target alternative database from the alternative database cluster according to the database replacement policy.
The alternative database cluster includes a plurality of alternative databases of different performance levels.
In this step, the occupancy rate of the central processing unit (English: CPU) or the occupancy rate of the disk can be used to represent different performance levels. For example, the alternative database may be divided into different performance levels according to the above rules, with occupancy greater than ninety percent as level 0, occupancy between eighty percent to ninety percent as level 1, occupancy between seventy percent to eighty percent as level 2, and occupancy between sixty percent to seventy percent as level 3.
In this step, the alternative database cluster may be used as a kind of asset information, and it may also be understood that what the alternative databases currently available for selection are used as a kind of asset information. Optionally, the latest asset information may be obtained through a timing task, and when a target candidate database needs to be determined in the candidate database, more accurate candidate data cluster information may be provided.
And step 204, the server replaces the main database with the target alternative database for service.
In this step, after the database replacement policy is given by the auxiliary algorithm, the target alternative database needs to be selected for replacement service according to the database replacement policy. Optionally, the database replacement policy may indicate a performance level of an alternative database suitable for replacing the current primary database, and may also indicate a length of time taken to replace the alternative database. For example, for some master databases with high business levels, the replacement needs to be successful in a short time, and then the database replacement policy can instruct the master database to perform the operation of replacing the alternative database in a short time according to the business levels.
Further, the server may obtain a topological connection relationship between databases in the entire architecture, and after the target alternative database replaces the primary database for service, if the failure of the primary database has been repaired, the server may switch to the original primary database according to the topological connection relationship between the databases before replacement.
In the database assistance method, first, when a primary database fails, state information and failure information of the primary database are acquired, wherein the state information is used for indicating at least one of a storage state and an access state of the primary database, and the failure information is used for indicating failure data of the primary database; then, outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm; then according to the database replacement strategy, determining a target alternative database from an alternative database cluster, wherein the alternative database cluster comprises a plurality of alternative databases with different performance grades; and finally, replacing the main database with the target alternative database for service. According to the database auxiliary method, when the main database fails, the corresponding alternative database can be selected to replace the main database for service without manually analyzing the failure, so that the time for analyzing the failure is shortened to a certain extent.
In an embodiment of the present application, please refer to fig. 3, which provides a method for determining whether a master database fails, the method including:
in step 301, the server obtains service information of the master database.
The service information comprises a service state, a replication state, a performance state and network flow information of the master database, wherein the service state of the master database is used for indicating whether the master database is normally serviced, the replication state of the master database is used for indicating whether the replication function of the master database is normal, the performance state of the master database is used for indicating the occupancy rate of a disk where the master database is located, and the network flow information of the master database is used for indicating the data volume transmitted by the master database per second;
in this step, a time interval may be preset, and then the service information of the master database is obtained at regular time according to the preset time interval, so that the master database is monitored, and resource waste caused by frequently obtaining the service information is avoided. The acquired service information of the main database can be stored for the view of the administrator.
Step 302, the server determines whether the master database has a fault according to the service information of the master database.
Based on the service information obtained in the above steps, in this step, whether the master database has a fault or not may be determined according to the obtained service information. Generally, when at least one of the conditions that the service state of the master database is abnormal, the copy function of the master database is abnormal, the occupancy rate of the disk where the master database is located reaches thirty percent, or the amount of data transmitted by the master database per second is zero occurs, it may be determined that the master database is faulty at this time.
When the master database is judged to have a fault, the current state information and fault information of the master database can be further acquired. Optionally, the state information and the fault information when the primary database fails may be saved, and when the auxiliary algorithm cannot be used normally, the administrator may retrieve the state information and the fault information when the primary database fails, then manually determine the cause of the fault, and select a corresponding alternative database to replace the current primary database.
Optionally, in order to avoid the waste of storage resources caused by the excessive stored state information and fault information, the stored state information and fault information may be cleaned at regular time, for example, the stored state information and fault information may be cleaned once a month.
In the embodiment of the application, because the content of the acquired service information is reasonably set, whether the current main database has a fault or not can be accurately judged. Further, only state information and fault information when the main database fails are obtained. Therefore, the state information and the fault information of the main database can be acquired in the method and the system, and the fault reason of the current main database can be reflected more accurately.
In an embodiment of the present application, the storage status of the master database includes data amount of tables in the master database, and the data amount of tables in the master database is used for characterizing the number of tables in the master database and data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In the embodiment of the application, the detailed data of the storage state, the detailed data of the access state and the detailed data of the fault information of the main database when the fault occurs are obtained. Furthermore, different weights can be configured for each data, and then the data are input into an auxiliary algorithm, so that a more accurate database replacement strategy can be obtained through calculation.
In an embodiment of the present application, a method for generating a report and warning information is provided, where the method includes: and the server generates reports and alarm information according to the state information of the main database, the fault information of the main database and the database replacement strategy.
In the embodiment of the present application, optionally, the warning information may be sent when the main database fails, and may also be sent after the main database is replaced by the target alternative database. Specifically, the alarm information may be in the form of WeChat, short message, or voice, and the alarm information may be classified into different levels according to the duration of the fault, the severity of the fault, the importance of the service level, and the specific cause of the fault. When the administrator receives the alarm information, it can indicate that the alarm information has been successfully received by clicking the confirm button. When the master database has successfully completed the replacement of the target alternative database, the server will stop sending the alert information.
After the primary database completes the replacement of the target alternative database, the primary database is indicated to have completed the fault handling. After the main database has completed the fault handling, a report may be generated according to the specific situation of the fault handling, specifically, the report may include the state information of the main database, the fault information of the main database, the database replacement policy, and other information, and may also display the time information, the service level, and other information.
In the embodiment of the application, by generating the report and the alarm information, an administrator can timely and accurately master the operation condition of the main database.
In an embodiment of the present application, a database replacement method is provided, where the method includes:
the server stores the database replacement strategy so that when the main database fails, the corresponding alternative database is selected to be replaced according to the database replacement strategy.
In the embodiment of the application, the auxiliary algorithm can generate different database replacement strategies according to different fault conditions of the main database. Optionally, the state information and the fault information of each time the primary database fails and the corresponding database replacement policy given by the secondary algorithm may be stored. And when the same fault occurs again in the main database, directly selecting the corresponding alternative database according to the pre-stored database replacement strategy to perform replacement service.
In the embodiment of the application, the database replacement strategies in different faults are recorded, so that when the main database encounters the same fault again, the corresponding alternative database can be quickly selected for service according to the previously stored database replacement strategies, and the fault processing efficiency is improved to a certain extent.
It should be understood that, although the steps in the flowcharts of fig. 2 to 3 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
In an embodiment of the present application, as shown in fig. 4, there is provided a database assistance apparatus including: a first obtaining module 401, an output module 402, a determining module 403 and a replacing module 404, wherein:
a first obtaining module 401, configured to obtain, when a master database fails, status information and failure information of the master database, where the status information is used to indicate at least one of a storage status and an access status of the master database, and the failure information is used to indicate failure data of the master database;
an output module 402, configured to output a database replacement policy according to the state information and the fault information of the primary database by using an auxiliary algorithm;
a determining module 403, configured to determine, according to the database replacement policy, a target candidate database from a candidate database cluster, where the candidate database cluster includes multiple candidate databases with different performance levels;
a replacement module 404 for servicing with the target alternative database in place of the primary database.
In the embodiment of the present application, please refer to fig. 5, another database assisting apparatus 500 is provided, where the database assisting apparatus 500 includes, in addition to the modules included in the database assisting apparatus 400, optionally, the database assisting apparatus 500 further includes a second obtaining module 405, a generating module 406, and a storing module 407, where:
the second obtaining module 405 is configured to obtain service information of the master database, where the service information includes a service state, a replication state, a performance state, and network traffic information of the master database, the service state of the master database is used to indicate whether the master database is normally serviced, the replication state of the master database is used to indicate whether the replication function of the master database is normal, the performance state of the master database is used to indicate an occupancy rate of a disk where the master database is located, and the network traffic information of the master database is used to indicate an amount of data transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
In this embodiment of the application, the second obtaining module 405 is specifically configured to obtain the service information of the master database at regular time according to a preset time interval.
In an embodiment of the present application, the storage status of the master database includes data amount of tables in the master database, and the data amount of tables in the master database is used for characterizing the number of tables in the master database and data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In the embodiment of the application, the auxiliary algorithm is constructed according to a proximity algorithm and a Bayesian algorithm.
In this embodiment of the present application, the apparatus further includes a generating module 406, where the generating module 406 is configured to generate a report and warning information according to the state information of the master database, the fault information of the master database, and the database replacement policy.
In this embodiment of the present application, the apparatus further includes a storage module 407, where the storage module 407 is configured to store the database replacement policy, so that when the primary database fails, a corresponding alternative database is selected according to the database replacement policy for replacement.
For specific limitations of the database assistance device, reference may be made to the above limitations of the database assistance method, which are not described herein again. The modules in the database auxiliary device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In the embodiment of the present application, a computer device is provided, and the computer device may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing database assistance data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a database assistance method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment of the present application, there is provided a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
when a master database fails, acquiring state information and fault information of the master database, wherein the state information is used for indicating at least one of a storage state and an access state of the master database, and the fault information is used for indicating fault data of the master database;
outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
determining a target alternative database from an alternative database cluster according to the database replacement strategy, wherein the alternative database cluster comprises a plurality of alternative databases with different performance levels;
and replacing the main database with the target alternative database for service.
In the embodiment of the present application, the processor, when executing the computer program, further implements the following steps:
acquiring service information of the master database, wherein the service information comprises service state, replication state, performance state and network flow information of the master database, the service state of the master database is used for indicating whether the master database is normally serviced, the replication state of the master database is used for indicating whether the replication function of the master database is normal, the performance state of the master database is used for indicating the occupancy rate of a disk where the master database is located, and the network flow information of the master database is used for indicating the data volume transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
In the embodiment of the present application, the processor, when executing the computer program, further implements the following steps:
and acquiring the service information of the main database at regular time according to a preset time interval.
In an embodiment of the present application, the storage status of the master database includes data amount of tables in the master database, and the data amount of tables in the master database is used for characterizing the number of tables in the master database and data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In the embodiment of the application, the auxiliary algorithm is constructed according to a proximity algorithm and a Bayesian algorithm.
In the embodiment of the present application, the processor, when executing the computer program, further implements the following steps:
and generating a report and alarm information according to the state information of the main database, the fault information of the main database and the database replacement strategy.
In the embodiment of the present application, the processor, when executing the computer program, further implements the following steps:
and storing the database replacement strategy so that when the main database fails, the corresponding alternative database is selected to be replaced according to the database replacement strategy.
In an embodiment of the application, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of:
when a master database fails, acquiring state information and fault information of the master database, wherein the state information is used for indicating at least one of a storage state and an access state of the master database, and the fault information is used for indicating fault data of the master database;
outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
determining a target alternative database from an alternative database cluster according to the database replacement strategy, wherein the alternative database cluster comprises a plurality of alternative databases with different performance levels;
and replacing the main database with the target alternative database for service.
In an embodiment of the application, the computer program when executed by the processor further performs the steps of:
acquiring service information of the master database, wherein the service information comprises service state, replication state, performance state and network flow information of the master database, the service state of the master database is used for indicating whether the master database is normally serviced, the replication state of the master database is used for indicating whether the replication function of the master database is normal, the performance state of the master database is used for indicating the occupancy rate of a disk where the master database is located, and the network flow information of the master database is used for indicating the data volume transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
In an embodiment of the application, the computer program when executed by the processor further performs the steps of:
and acquiring the service information of the main database at regular time according to a preset time interval.
In an embodiment of the present application, the storage status of the master database includes data amount of tables in the master database, and the data amount of tables in the master database is used for characterizing the number of tables in the master database and data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
In the embodiment of the application, the auxiliary algorithm is constructed according to a proximity algorithm and a Bayesian algorithm.
In an embodiment of the application, the computer program when executed by the processor further performs the steps of:
and generating a report and alarm information according to the state information of the main database, the fault information of the main database and the database replacement strategy.
In an embodiment of the application, the computer program when executed by the processor further performs the steps of:
and storing the database replacement strategy so that when the main database fails, the corresponding alternative database is selected to be replaced according to the database replacement strategy.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A database assistance method, the method comprising:
when a master database fails, acquiring state information and fault information of the master database, wherein the state information is used for indicating at least one of a storage state and an access state of the master database, and the fault information is used for indicating fault data of the master database;
outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
determining a target alternative database from an alternative database cluster according to the database replacement strategy, wherein the alternative database cluster comprises a plurality of alternative databases with different performance grades;
and replacing the main database with the target alternative database for service.
2. The method of claim 1, wherein before the obtaining of the status information and the failure information of the master database when the master database fails, the method further comprises:
acquiring service information of the master database, wherein the service information comprises service state, replication state, performance state and network flow information of the master database, the service state of the master database is used for indicating whether the master database is normally serviced, the replication state of the master database is used for indicating whether the replication function of the master database is normal, the performance state of the master database is used for indicating the occupancy rate of a disk where the master database is located, and the network flow information of the master database is used for indicating the data volume transmitted by the master database per second;
and judging whether the main database has a fault according to the service information of the main database.
3. The method of claim 2, wherein the obtaining service information of the master database comprises:
and acquiring service information of the main database at regular time according to a preset time interval.
4. The method of claim 1, wherein the storage status of the master database includes an amount of data in the master database for characterizing the number of tables in the master database and a data capacity of the tables;
the access state of the master database comprises the number of connection requests of the master database and the number of times of accessing the master database per second, wherein the number of connection requests is used for representing the number of requests received by the master database per second for establishing transmission control protocol connections;
the fault information comprises the number of times of attack of the main database per second, the number of vulnerabilities of the main database and the number of blockages of the main database.
5. The method of claim 1, wherein the secondary algorithm is constructed according to a proximity algorithm and a bayesian algorithm.
6. The method according to any one of claims 1 to 5, wherein after said serving with said target alternative database instead of said master database, said method further comprises:
and generating a report and alarm information according to the state information of the main database, the fault information of the main database and the database replacement strategy.
7. The method according to any one of claims 1 to 5, wherein after said serving with said target alternative database instead of said master database, said method further comprises:
and storing the database replacement strategy so that when the main database fails, the corresponding alternative database is selected to be replaced according to the database replacement strategy.
8. A database assistance apparatus, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring state information and fault information of a master database when the master database fails, the state information is used for indicating at least one of a storage state and an access state of the master database, and the fault information is used for indicating fault data of the master database;
the output module is used for outputting a database replacement strategy according to the state information and the fault information of the main database by using an auxiliary algorithm;
a determining module, configured to determine a target alternative database from an alternative database cluster according to the database replacement policy, where the alternative database cluster includes a plurality of alternative databases with different performance levels;
and the replacing module is used for replacing the main database with the target alternative database for service.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201911224574.6A 2019-12-04 2019-12-04 Database assistance method, database assistance device, computer equipment and storage medium Pending CN110955647A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911224574.6A CN110955647A (en) 2019-12-04 2019-12-04 Database assistance method, database assistance device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911224574.6A CN110955647A (en) 2019-12-04 2019-12-04 Database assistance method, database assistance device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110955647A true CN110955647A (en) 2020-04-03

Family

ID=69979784

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911224574.6A Pending CN110955647A (en) 2019-12-04 2019-12-04 Database assistance method, database assistance device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110955647A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220779A (en) * 2021-04-27 2021-08-06 阿波罗智联(北京)科技有限公司 Data processing method, device, storage medium and program product

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040193658A1 (en) * 2003-03-31 2004-09-30 Nobuo Kawamura Disaster recovery processing method and apparatus and storage unit for the same
CN104156360A (en) * 2013-05-13 2014-11-19 阿里巴巴集团控股有限公司 Service data processing method and system
CN108924772A (en) * 2018-08-02 2018-11-30 平安科技(深圳)有限公司 Note transmission method, device, computer equipment and storage medium
CN108984569A (en) * 2017-06-05 2018-12-11 中兴通讯股份有限公司 Database switching method, system and computer readable storage medium
CN110162428A (en) * 2019-05-17 2019-08-23 中国铁道科学研究院集团有限公司 Method of data synchronization and device, electronic equipment and computer readable storage medium
CN110178121A (en) * 2017-09-06 2019-08-27 富璟科技(深圳)有限公司 A kind of detection method and its terminal of database

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040193658A1 (en) * 2003-03-31 2004-09-30 Nobuo Kawamura Disaster recovery processing method and apparatus and storage unit for the same
CN104156360A (en) * 2013-05-13 2014-11-19 阿里巴巴集团控股有限公司 Service data processing method and system
CN108984569A (en) * 2017-06-05 2018-12-11 中兴通讯股份有限公司 Database switching method, system and computer readable storage medium
CN110178121A (en) * 2017-09-06 2019-08-27 富璟科技(深圳)有限公司 A kind of detection method and its terminal of database
CN108924772A (en) * 2018-08-02 2018-11-30 平安科技(深圳)有限公司 Note transmission method, device, computer equipment and storage medium
CN110162428A (en) * 2019-05-17 2019-08-23 中国铁道科学研究院集团有限公司 Method of data synchronization and device, electronic equipment and computer readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220779A (en) * 2021-04-27 2021-08-06 阿波罗智联(北京)科技有限公司 Data processing method, device, storage medium and program product

Similar Documents

Publication Publication Date Title
CN109522287B (en) Monitoring method, system, equipment and medium for distributed file storage cluster
CN110162382B (en) Container-based gray level publishing method, device, computer equipment and storage medium
CN109064345B (en) Message processing method, system and computer readable storage medium
CN111294845B (en) Node switching method, device, computer equipment and storage medium
CN108710673B (en) Method, system, computer device and storage medium for realizing high availability of database
CN111193609B (en) Application abnormity feedback method and device and application abnormity monitoring system
CN110851159B (en) Business rule updating method and device, computer equipment and storage medium
CN110618890B (en) Fault processing method and device, electronic equipment and computer readable storage medium
CN112612618B (en) Interface current limiting method and device, computer equipment and storage medium
US10642585B1 (en) Enhancing API service schemes
CN113220540A (en) Service management method, device, computer equipment and storage medium
CN110737548B (en) Data request method and server
CN111198921A (en) Database switching method and device, computer equipment and storage medium
CN115509858A (en) Business system monitoring method and device, storage medium and computer equipment
CN108924772B (en) Short message sending method and device, computer equipment and storage medium
CN113098715B (en) Information processing method, device, system, medium and computing equipment
CN108255703B (en) SQL script fault repairing method and terminal thereof
CN110955647A (en) Database assistance method, database assistance device, computer equipment and storage medium
CN111382976B (en) Early warning data processing method and device, computer equipment and storage medium
CN115269252A (en) Application program fault processing method, device, equipment and storage medium
CN110489208B (en) Virtual machine configuration parameter checking method, system, computer equipment and storage medium
CN114153696A (en) Cloud native application health detection method and device, computer equipment and storage medium
CN113342284A (en) Time sequence data storage method and device, computer equipment and storage medium
CN110879757B (en) Restarting method and device for abnormal operation of client and computer equipment
CN115017027A (en) Interface automation continuous integration test method, device, equipment and storage medium

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
TA01 Transfer of patent application right

Effective date of registration: 20220113

Address after: Room 1423, No. 1256 and 1258, Wanrong Road, Jing'an District, Shanghai 200040

Applicant after: Tianyi Digital Life Technology Co.,Ltd.

Address before: 1 / F and 2 / F, East Garden, Huatian International Plaza, 211 Longkou Middle Road, Tianhe District, Guangzhou, Guangdong 510630

Applicant before: Century Dragon Information Network Co.,Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20200403

RJ01 Rejection of invention patent application after publication