Database monitoring method, device, computer equipment and storage medium
Through data reconciliation between the monitor and the target database, abnormal data is identified and marked, data loss caused by distributed database failure is solved, and rapid troubleshooting and system stability are achieved.
Patent Information
- Application Number
- CN201910978787.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-15
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Distributed databases can easily lead to data loss in the event of failure, affecting the normal operation of the system.
The monitor receives data requests, calls the business tables in the original database, sends query requests to the target database, receives and compares the query results, determines abnormal data, and generates a notification message to annotate and send to the monitor to ensure data integrity.
Quickly locate and troubleshoot faults to avoid data loss affecting system operation and ensure data accuracy and system stability.
Smart Images

Figure CN110865918B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of system data monitoring, and in particular to a database monitoring method, device, computer equipment and storage medium. Background Art
[0002] At present, most of the data storage of the system relies on the traditional in-memory database (Redis). All the data of the in-memory database is stored in the memory, and then the data is saved to the disk asynchronously at irregular intervals. For example, the income calculation system used in the financial industry uses the in-memory database to achieve accurate business calculations.
[0003] However, with the continuous growth of business volume in the revenue measurement system, the traditional in-memory database can no longer meet the business needs of the revenue measurement system. Therefore, a memory-centric distributed database was introduced, which can process transactional, analytical and streaming loads at memory-level speed in PB-level data. However, when the distributed database crashes or fails, data loss often occurs, which will cause the system to fail to operate normally. Summary of the invention
[0004] The purpose of the present application is to solve at least one of the above-mentioned technical defects, especially the technical defect in the prior art that data loss in a distributed database may affect the normal operation of the system.
[0005] The present application provides a database monitoring method, comprising the following steps:
[0006] Receive a data request from the monitoring party, and call the corresponding business table in the original database according to the data request;
[0007] Sending a query request to a target database according to the business data in the business table, and receiving a query result returned by the target database; wherein the query result is storage information corresponding to the business data in the target database;
[0008] Comparing the stored information with the business data to determine abnormal data in the target database;
[0009] A label is added to the abnormal data, and a notification message of the abnormal data is generated and sent to the monitoring party.
[0010] In one embodiment, before the step of receiving the data request from the monitoring party, the step further includes:
[0011] The operating status of the revenue estimation system is monitored by a monitoring party. When the revenue estimation system needs to retrieve business data from a target database, the retrieval operation is captured, and a data request is generated according to the retrieval operation.
[0012] In one embodiment, before the step of sending a query request to a target database according to the business data in the business table and receiving the query result returned by the target database, the method further includes:
[0013] A preset threshold is set in the application server, and the amount of business data in the business table is determined according to the preset threshold.
[0014] In one embodiment, the target database is an in-memory database;
[0015] The step of sending a query request to a target database according to the business data in the business table and receiving a query result returned by the target database comprises:
[0016] When the amount of the business data is less than the preset threshold, the business data is converted into Java objects in sequence to obtain a Java object array;
[0017] Traversing the Java object array, and obtaining the index value corresponding to each Java object in the Java object array according to the traversal result;
[0018] The index value is used as a condition to send a query request to the memory database, and the query result returned by the memory database is received.
[0019] In one embodiment, the step of sending a query request to a target database according to the business data in the business table and receiving the query result returned by the target database further includes:
[0020] When the amount of the business data is greater than the preset threshold, the business data is rejected and random data is obtained by randomly extracting the business data from the original database;
[0021] The random data is converted into a Java object array in sequence.
[0022] In one embodiment, the step of comparing the stored information with the business data includes:
[0023] Acquire the storage information, wherein the storage information includes a hash value of a Java object corresponding to the index value returned by the memory database;
[0024] Compare the hash value with the Java object corresponding to the index value.
[0025] In one embodiment, the step of adding a label to the abnormal data and generating a notification message of the abnormal data and sending it to the monitoring party includes:
[0026] Annotating the abnormal data according to the comparison result, and storing the annotated abnormal data in an intermediate database, wherein the intermediate database is MongoDB;
[0027] A notification message corresponding to the abnormal data is generated through the intermediate database, and the notification message is sent to a monitoring party.
[0028] The present application also provides a database monitoring device, which includes:
[0029] A data calling module is used to receive a data request from a monitoring party and call a corresponding business table in the original database according to the data request;
[0030] A data query module, used to send a query request to a target database according to the business data in the business table, and receive a query result returned by the target database; wherein the query result is storage information corresponding to the business data in the target database;
[0031] A data comparison module, used to compare the stored information with the business data to determine abnormal data in the target database;
[0032] The exception handling module is used to add annotations to the abnormal data and generate a notification message of the abnormal data and send it to the monitoring party.
[0033] The present application also provides a computer device, characterized in that it includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps in the database monitoring method described in any one of the above embodiments.
[0034] The present application also provides a computer storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the database monitoring method described in any of the above embodiments.
[0035] The monitoring method, device, computer equipment and storage medium of the above-mentioned database first receive a data request from the monitoring party, and call the corresponding business table in the original database according to the data request; send a query request to the target database according to the business data in the business table, and receive the query result returned by the target database; wherein the query result is the storage information corresponding to the business data in the target database; compare the storage information with the business data to determine the abnormal data in the target database; add a label to the abnormal data, and generate a notification message of the abnormal data and send it to the monitoring party.
[0036] In this solution, the monitoring party is used to monitor the corresponding platform and receive data requests from the platform sent by the monitoring party. According to the data request, the business data in the original database is called to query the data in the target database, so as to determine whether the data in the target database is abnormal through data reconciliation between the original database and the target database. When the data in the target database is abnormal, the abnormal data is marked and a notification message is generated and returned to the monitoring party. This process quickly locates and troubleshoots faults through service monitoring to avoid the loss of data in the target database affecting the normal operation of related platforms.
[0037] Additional aspects and advantages of the present application will be given in part in the following description, which will become apparent from the following description, or will be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0039] Figure 1 It is an application environment diagram of the database monitoring method of the embodiment of the present application;
[0040] Figure 2 is a flow chart of a method for monitoring a database of an embodiment;
[0041] Figure 3 A flowchart of a method for sending a query request to a target database according to business data according to an embodiment;
[0042] Figure 4 A schematic diagram of the structure of a monitoring device for a database of an embodiment;
[0043] Figure 5 The diagram is a schematic diagram of the internal structure of a computer device according to an embodiment. DETAILED DESCRIPTION
[0044] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present application.
[0045] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0046] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present application belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0047] refer to Figure 1 As shown, Figure 1 is an application environment diagram of an embodiment of the present application; in this embodiment, the technical solution of the present application can be implemented by an application server 130, such as Figure 1 In the embodiment, the monitoring party 120 monitors the running status of the application system 110 in real time, and sends a data request to the application system 110, and the application server 130 implements related functions according to the data request; in the embodiment of the present application, after the application server 130 receives the data request sent by the monitoring party 120, it calls the business data in the original database 140 according to the data request, and obtains the target data in the target database 150 according to the business data, so as to realize the functions of data reconciliation, rapid positioning and troubleshooting; the application server 130 here refers to a device that can realize various background functions.
[0048] In one embodiment, Figure 2 As shown, Figure 2 The following is a flow chart of a method for monitoring a database according to an embodiment. In this embodiment, a method for monitoring a database is proposed, which may specifically include the following steps:
[0049] S110: receiving a data request from the monitoring party 120, and calling a corresponding business table in the original database 140 according to the data request.
[0050] Since the application system 110 has replaced a new database, and the application system 110 itself has extremely high requirements for the real-time availability and response efficiency of the database service, in this application, the database of the application system 110 is monitored and maintained by the monitoring party 120 to ensure data correctness and avoid data loss.
[0051] The application server 130 receives the data request sent by the monitoring party 120, which refers to the data request captured by the monitoring party 120 based on the operating status of the application system 110. The application server 130 obtains the business table corresponding to the business data in the application system 110 stored in the original database 140 based on the data request.
[0052] It should be noted that the monitoring party 120 here refers to a monitoring system that monitors the running status, operating status, etc. of the application system 110, and the monitoring system may be a third-party system; the original database 140 here refers to a database that stores business data in the application system 110, and the original database 140 may be an Oracle database.
[0053] In the above process, through the program control in the code, the application server 130 can be connected to the Oracle database, and obtain relevant information of the Oracle database and extract the data volume through the code. Furthermore, when the application server 130 is connected to the database server corresponding to the Oracle database, the data volume of the business table can also be obtained through the statistical function in the Oracle database. The data volume represents the number of entries in a certain business table.
[0054] S120: Sending a query request to the target database 150 according to the business data in the business table, and receiving a query result returned by the target database 150; wherein the query result is storage information in the target database 150 corresponding to the business data.
[0055] In this step, after calling the corresponding business table in the original database 140 according to the data request in the above step S110, a query request can be sent to the target server according to the business data in the business table, and the application server 130 receives the query result corresponding to the query request returned by the target server.
[0056] In the above process, when the corresponding business table in the original database 140 is called, the business table stores the business data in the application system 110, so the application server 130 can send a query request to the target server based on the business data, requesting to query the storage information corresponding to the business data in the target server.
[0057] It should be noted that the target server here refers to a distributed server, which can meet the business requirements of the application system 110; the storage information here refers to the business data in the application system 110 stored in the distributed server.
[0058] S130: Compare the stored information with the business data to determine abnormal data in the target database 150.
[0059] In this step, a query request is sent to the target database 150 according to the business data in the business table in the above step S120, and after receiving the query result returned by the target database 150, the storage information of the target server in the query result is compared with the business data called in the original database 140, so as to determine the abnormal data in the target server according to the comparison result.
[0060] In the above process, after the business data corresponding to the data request of the application system 110 is obtained through the original database 140, the business data is transferred to the target database 150 as a query condition, so as to query the storage information corresponding to the business data in the target database 150, and compare the storage information with the business data to further check whether there is data loss, data storage error, etc. in the storage information in the target database 150.
[0061] In this solution, a distributed server is used as the target server to store the business data in the application system 110. Since the database in the distributed server is an in-memory database, data may be lost when the program crashes or fails. If the data is unstable, it will affect the operation of the application system 110.
[0062] Therefore, it is necessary to obtain the business data of the application system 110 through the original database 140 and then compare it with the storage information stored in the target server, so as to confirm whether the data in the target server is abnormal as soon as possible. The abnormal phenomenon includes data loss, data storage error, etc.
[0063] S140: adding a label to the abnormal data, generating a notification message of the abnormal data and sending it to the monitoring party 120 .
[0064] In this step, after the abnormal data in the target database 150 is determined through the above step S130, the abnormal data is immediately marked one by one, and a notification message corresponding to the abnormal data is generated based on the abnormal data and sent to the monitoring party 120, so that the monitoring party 120 can confirm the data abnormality in the target database 150.
[0065] In the above process, the purpose of marking the abnormal data one by one is to quickly locate and troubleshoot the cause of the fault. The purpose of generating a notification message corresponding to the abnormal data is to effectively solve the problem of data instability or loss through the notification message. In addition, the notification message can be sent to the development, business, operation and maintenance of the application system 110 in the form of email. The operation and maintenance can immediately execute the data synchronization process, and the development can check the problem so as to solve the problem as soon as possible.
[0066] The monitoring method of the above-mentioned database first receives a data request from the monitoring party 120, and calls the corresponding business table in the original database 140 according to the data request; sends a query request to the target database 150 according to the business data in the business table, and receives the query result returned by the target database 150; wherein the query result is the storage information corresponding to the business data in the target database 150; compares the storage information with the business data to determine the abnormal data in the target database 150; adds annotations to the abnormal data, and generates a notification message of the abnormal data and sends it to the monitoring party 120.
[0067] In this solution, the monitoring party 120 is used to monitor the corresponding platform and receive the data request of the platform sent by the monitoring party 120. According to the data request, the business data in the original database 140 is called to query the data in the target database 150, so as to determine whether the data in the target database 150 is abnormal through the data reconciliation between the original database 140 and the target database 150. When the data in the target database 150 is abnormal, the abnormal data is marked and a notification message is generated and returned to the monitoring party 120. This process quickly locates and troubleshoots through service monitoring to avoid the loss of data in the target database 150 affecting the normal operation of the relevant platform.
[0068] In one embodiment, before the step of sending a query request to the target database 150 according to the business data in the business table in step S120 and receiving the query result returned by the target database 150, it may also include: setting a preset threshold in the application server 130 and determining the amount of business data in the business table according to the preset threshold.
[0069] In this embodiment, it can be seen from the above step S120 that after the application server 130 is connected to the database server corresponding to the Oracle database, the data volume of the business table can also be obtained through the statistical function in the Oracle database. The data volume represents the number of entries in a business table.
[0070] According to the data volume of the business table, the application server 130 can control the monitoring party 120 to adopt different monitoring methods for the target database 150. Therefore, a preset threshold is set in the application server 130, and the data volume of the business table in the called original database 140 can be determined by the preset threshold.
[0071] For example, when the amount of data in the business table of the original database 140 is relatively small, full table monitoring can be used, that is, each record in the original database 140 is converted into a Java object type and compared with the object in the target database 150 at the same index; for the case where the amount of data is relatively large, random sampling can be performed and comparison can be performed under the same index.
[0072] In the above embodiment, a preset threshold is set in the application server 130, and the amount of business data in the business table is determined according to the preset threshold, so that the application server 130 can monitor the target server using different monitoring methods 120, which is more conducive to improving the efficiency of data monitoring.
[0073] In one embodiment, Figure 3 As shown, Figure 3 The flowchart of a method for sending a query request to a target database 150 according to business data in an embodiment is shown. The target database 150 is a memory database. The step of sending a query request to the target database 150 according to the business data in the business table and receiving the query result returned by the target database 150 in step S120 may include:
[0074] S121: When the amount of the business data is less than the preset threshold, convert the business data into Java objects in sequence and obtain a Java object array;
[0075] S122: traversing the Java object array, and obtaining index values corresponding to the Java objects in each Java object array according to the traversal result;
[0076] S123: Sending a query request to the memory database using the index value as a condition, and receiving the query result returned by the memory database.
[0077] In this embodiment, the target database 150 is a memory database, which may be an Ignite database, and the original database 140 may be an Oracle database.
[0078] When the data that needs to be compared is queried from the Oracle database, that is, the business data in the business table called according to the data request, the data volume of the business data is determined according to the preset threshold. When the data volume of the business data is less than the preset threshold, it is converted into a Java object array; then the Java object array is traversed, and the index in the Java object is passed as a condition to the Ignite database, and the Ignite database is queried based on this condition.
[0079] Compare the query results returned by the Ignite database with the Java object. If they are the same, it means that the data is correct. If they are different, it means that there is a problem with the data in the Ignite database.
[0080] In the above embodiment, a query request is sent to the target database 150 based on the business data in the business table of the original database 140, and the query result returned by the target database 150 is received, so as to ensure the accuracy of the data stored in the target server and ensure that the application system 110 can operate normally.
[0081] In one embodiment, Figure 3 As shown, Figure 3 The flowchart of a method for sending a query request to the target database 150 according to business data in an embodiment is shown in step S120. The step of sending a query request to the target database 150 according to the business data in the business table and receiving the query result returned by the target database 150 may also include:
[0082] S124: When the amount of the service data is greater than the preset threshold, the service data is rejected and random data is obtained by randomly extracting the service data from the original database 140;
[0083] S125: Convert the random data into Java object arrays in sequence.
[0084] In this embodiment, the target database 150 is a memory database, which may be an Ignite database, and the original database 140 may be an Oracle database.
[0085] See also Figure 3 When the data that needs to be compared is queried from the Oracle database, that is, the business data in the business table called according to the data request, the data volume of the business data is determined according to the preset threshold. When the data volume of the business data is greater than the preset threshold, the business data is rejected, and random data is obtained by randomly extracting the business data through the original database 140. After converting the random data into a Java object array in turn, the contents of step S122 and step S123 in the above embodiment are executed.
[0086] In the above embodiment, a batch of data is randomly obtained through the hash of the Oracle database, that is, random data is obtained, and then converted into a Java object array, and then the Java object array is compared with the data in the Ignite database to ensure the accuracy of the data stored in the target server and to ensure that the application system 110 can run normally.
[0087] In one embodiment, the step of comparing the stored information with the business data in step S130 may include:
[0088] S131: Acquire the storage information, wherein the storage information includes a hash value of a Java object corresponding to the index value returned by the memory database;
[0089] S132: Compare the hash value with the Java object corresponding to the index value.
[0090] In this embodiment, the query result returned by the target database 150 is obtained through step S120 , and the query result includes storage information of the application system 110 stored in the target database 150 corresponding to the business data in the original database 140 .
[0091] After the storage information is acquired, the hash value of the Java object corresponding to the index value in the storage information may be compared with the Java object to determine the abnormal data in the target database 150 .
[0092] In the above embodiment, the hash value of the Java object obtained from the Ignite database is compared with the Java object. If they are the same, it means that the data stored in the target database 150 is the same as the business data in the original database 140. If they are different, it means that there is a problem with the data stored in the target database 150. In this way, it can be determined whether there is any abnormality in the data of the target database 150.
[0093] In one embodiment, before the step of receiving the data request from the monitoring party 120 in step S110, the following steps may also be included:
[0094] The operating status of the revenue estimation system is monitored by the monitoring party 120. When the revenue estimation system needs to retrieve business data from the target database 150, the retrieval operation is captured and a data request is generated according to the retrieval operation.
[0095] In this embodiment, the application server 130 implements availability monitoring, service monitoring, data reconciliation and other measures through the monitoring party 120, so as to quickly locate and troubleshoot the fault and restore the service to the application system 110.
[0096] Among them, service monitoring refers to the monitoring of the health status of the CPU, memory, etc. of the application server 130; availability monitoring refers to the monitoring of the configuration, operating status, data volume, storage space, etc. of each cluster node of the original database 140 and the target database 150; data reconciliation refers to the data reconciliation between the target data and the original database 140.
[0097] The income calculation system in this embodiment refers to one of the application systems 110, and its main functions include: realizing clear income and efficient development for field staff, assisting in the popularization of law and organizing development interviews for internal staff, thereby stimulating the development willingness of field staff, developing an intelligent income calculation system, and achieving expected goals through precise calculation and scenario application.
[0098] The operation of the revenue calculation system depends on the business tables in the database. Without these business tables and the business data in the business tables, the revenue calculation cannot be carried out. Therefore, when the revenue calculation system needs to retrieve the business data in the target database 150, the application server 130 captures the retrieval operation through the monitoring party 120, and generates a data request based on the retrieval operation and sends it to the application server 130, so that the data reconciliation mechanism can assist in troubleshooting data problems and reload the data in time once discovered.
[0099] In one embodiment, the step of adding a label to the abnormal data and generating a notification message of the abnormal data and sending it to the monitoring party 120 in step S140 may include:
[0100] S141: adding annotations to the abnormal data according to the comparison results, and storing the annotated abnormal data in an intermediate database, wherein the intermediate database is MongoDB;
[0101] S142: Generate a notification message corresponding to the abnormal data through the intermediate database, and send the notification message to the monitoring party 120.
[0102] In this embodiment, after the abnormal data in the target database 150 is determined, a label is added to the abnormal data, and the labeled abnormal data is stored in the intermediate database.
[0103] The way to add annotations to the legacy data here is to segment and number the abnormal data, and track it according to the number; the intermediate database here refers to the transit database that stores the abnormal data, which can be MongoDB. The data structure supported by MongoDB is very loose, which is a bson format similar to json, so it can store more complex data types.
[0104] After the annotated abnormal data is stored in the intermediate database, a notification message corresponding to the abnormal data is generated through the intermediate database and sent to the monitoring party 120. The notification message can be sent to the development, business, operation and maintenance of the application system 110 in the form of an email. The operation and maintenance can immediately perform the data synchronization process, and the development can check the problem so as to solve the problem as soon as possible.
[0105] In one embodiment, Figure 4 As shown, Figure 4 Schematic diagram of the structure of a database monitoring device according to an embodiment. In this embodiment, a database monitoring device is provided, which includes: a data calling module 210, a data query module 220, a data comparison module 230 and an exception handling module 240, wherein:
[0106] The data calling module 210 is used to receive a data request from the monitoring party 120 and call a corresponding business table in the original database 140 according to the data request.
[0107] Since the application system 110 has replaced a new database, and the application system 110 itself has extremely high requirements for the real-time availability and response efficiency of the database service, in this application, the database of the application system 110 is monitored and maintained by the monitoring party 120 to ensure data correctness and avoid data loss.
[0108] The application server 130 receives the data request sent by the monitoring party 120, which refers to the data request captured by the monitoring party 120 based on the operating status of the application system 110. The application server 130 obtains the business table corresponding to the business data in the application system 110 stored in the original database 140 based on the data request.
[0109] It should be noted that the monitoring party 120 here refers to a monitoring system that monitors the running status, operating status, etc. of the application system 110, and the monitoring system may be a third-party system; the original database 140 here refers to a database that stores business data in the application system 110, and the original database 140 may be an Oracle database.
[0110] In the above process, through the program control in the code, the application server 130 can be connected to the Oracle database, and obtain relevant information of the Oracle database and extract the data volume through the code. Furthermore, when the application server 130 is connected to the database server corresponding to the Oracle database, the data volume of the business table can also be obtained through the statistical function in the Oracle database. The data volume represents the number of entries in a certain business table.
[0111] Data query module 220: used to send a query request to the target database 150 according to the business data in the business table, and receive the query result returned by the target database 150; wherein the query result is the storage information corresponding to the business data in the target database 150.
[0112] In this module, after calling the corresponding business table in the original database 140 according to the data request in the above-mentioned data calling module 210, a query request can be sent to the target server according to the business data in the business table, and the application server 130 receives the query result corresponding to the query request returned by the target server.
[0113] In the above process, when the corresponding business table in the original database 140 is called, the business table stores the business data in the application system 110, so the application server 130 can send a query request to the target server based on the business data, requesting to query the storage information corresponding to the business data in the target server.
[0114] It should be noted that the target server here refers to a distributed server, which can meet the business requirements of the application system 110; the storage information here refers to the business data in the application system 110 stored in the distributed server.
[0115] The data comparison module 230 is used to compare the stored information with the business data to determine abnormal data in the target database 150 .
[0116] In this module, a query request is sent to the target database 150 according to the business data in the business table through the above-mentioned data query module 220, and after receiving the query result returned by the target database 150, the storage information of the target server in the query result is compared with the business data called in the original database 140, so as to determine the abnormal data in the target server according to the comparison result.
[0117] In the above process, after the business data corresponding to the data request of the application system 110 is obtained through the original database 140, the business data is transferred to the target database 150 as a query condition, so as to query the storage information corresponding to the business data in the target database 150, and compare the storage information with the business data to further check whether there is data loss, data storage error, etc. in the storage information in the target database 150.
[0118] In this solution, a distributed server is used as the target server to store the business data in the application system 110. Since the database in the distributed server is an in-memory database, data may be lost when the program crashes or fails. If the data is unstable, it will affect the operation of the application system 110.
[0119] Therefore, it is necessary to obtain the business data of the application system 110 through the original database 140 and then compare it with the storage information stored in the target server, so as to confirm whether the data in the target server is abnormal as soon as possible. The abnormal phenomenon includes data loss, data storage error, etc.
[0120] The exception handling module 240 is used to add a label to the abnormal data, and generate a notification message of the abnormal data and send it to the monitoring party 120 .
[0121] In this module, after the abnormal data in the target database 150 is determined by the above-mentioned data comparison module 230, the abnormal data is immediately marked one by one, and a notification message corresponding to the abnormal data is generated based on the abnormal data and sent to the monitoring party 120, so that the monitoring party 120 can confirm the data abnormality in the target database 150.
[0122] In the above process, the purpose of marking the abnormal data one by one is to quickly locate and troubleshoot the cause of the fault. The purpose of generating a notification message corresponding to the abnormal data is to effectively solve the problem of data instability or loss through the notification message. In addition, the notification message can be sent to the development, business, operation and maintenance of the application system 110 in the form of email. The operation and maintenance can immediately execute the data synchronization process, and the development can check the problem so as to solve the problem as soon as possible.
[0123] The monitoring device of the above-mentioned database first receives a data request from the monitoring party 120, and calls the corresponding business table in the original database 140 according to the data request; sends a query request to the target database 150 according to the business data in the business table, and receives the query result returned by the target database 150; wherein the query result is the storage information corresponding to the business data in the target database 150; compares the storage information with the business data to determine the abnormal data in the target database 150; adds annotations to the abnormal data, and generates a notification message of the abnormal data and sends it to the monitoring party 120.
[0124] In this solution, the monitoring party 120 is used to monitor the corresponding platform and receive the data request of the platform sent by the monitoring party 120. According to the data request, the business data in the original database 140 is called to query the data in the target database 150, so as to determine whether the data in the target database 150 is abnormal through the data reconciliation between the original database 140 and the target database 150. When the data in the target database 150 is abnormal, the abnormal data is marked and a notification message is generated and returned to the monitoring party 120. This process quickly locates and troubleshoots through service monitoring to avoid the loss of data in the target database 150 affecting the normal operation of the relevant platform.
[0125] For the specific definition of the database monitoring device, please refer to the definition of the database monitoring method above, which will not be repeated here. Each module in the above-mentioned database monitoring device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the terminal device in the form of hardware, or can be stored in the memory in the terminal device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0126] In one embodiment, a computer device is provided. The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the database monitoring method of any of the above embodiments are implemented.
[0127] like Figure 5 As shown, Figure 5 Schematic diagram of the internal structure of a computer device of an embodiment. The computer device 310 includes a processor 314, a non-volatile storage medium 315, a memory 311 and a network interface 312 connected through a system bus 313. Among them, the non-volatile storage medium 315 of the computer device 310 stores an operating system 317 and a computer program 316. When the computer program 316 is executed by the processor 314, the processor 314 can implement a database monitoring method. The processor 314 of the computer device 310 is used to provide computing and control capabilities to support the operation of the entire computer device 310. The memory 311 of the computer device 310 stores a computer program 316. When the computer program 316 is executed by the processor 314, the processor 314 can execute a database monitoring method. The network interface 312 of the computer device 310 is used to connect and communicate with a mobile terminal.
[0128] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In one embodiment, a computer storage medium is provided. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the database monitoring method of any of the above embodiments.
[0130] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0131] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A database monitoring method, characterized in that: The steps include: Receive a data request from the monitoring party, and call the corresponding business table in the original database according to the data request and obtain the data volume of the business table; When the data volume of the business table is less than a preset threshold, the business data in the business table are converted into Java objects in sequence to obtain a Java object array; When the amount of data in the business table is greater than the preset threshold, randomly extracting business data in the business table through the original database according to the preset threshold to obtain random data, and converting the random data into a Java object array in sequence; Traversing the Java object array, and obtaining the index value corresponding to each Java object in the Java object array according to the traversal result, sending a query request to a target database using the index value as a condition, and receiving the query result returned by the target database; wherein the query result is the storage information corresponding to the index value in the target database; and the target database is a memory database; Comparing the stored information corresponding to the index value with the business data to determine abnormal data in the target database; A label is added to the abnormal data, and a notification message of the abnormal data is generated and sent to the monitoring party.
2. The database monitoring method according to claim 1, characterized in that: Before the step of receiving the data request from the monitoring party, the method further includes: The operating status of the revenue estimation system is monitored by a monitoring party. When the revenue estimation system needs to retrieve business data from a target database, the retrieval operation is captured, and a data request is generated according to the retrieval operation.
3. The database monitoring method according to claim 1, characterized in that: The step of comparing the storage information corresponding to the index value with the business data includes: Acquire storage information corresponding to the index value, wherein the storage information corresponding to the index value includes a hash value of a Java object corresponding to the index value returned by the target database; Compare the hash value with the Java object corresponding to the index value.
4. The database monitoring method according to claim 3, characterized in that: The step of adding a mark to the abnormal data and generating a notification message of the abnormal data and sending it to the monitoring party includes: Annotate the abnormal data according to the comparison result, and store the annotated abnormal data in an intermediate database, wherein the intermediate database is MongoDB; A notification message corresponding to the abnormal data is generated through the intermediate database, and the notification message is sent to a monitoring party.
5. A database monitoring device, characterized in that: include: A data calling module is used to receive a data request from a monitoring party, and to call a corresponding business table in an original database according to the data request and obtain the data volume of the business table; A data query module, used for, when the amount of data in the business table is less than a preset threshold, converting the business data in the business table into Java objects in sequence and obtaining a Java object array; when the amount of data in the business table is greater than the preset threshold, randomly extracting the business data in the business table through the original database according to the preset threshold to obtain random data, and converting the random data into a Java object array in sequence; traversing the Java object array, and obtaining the index value corresponding to each Java object in the Java object array according to the traversal result, sending a query request to a target database using the index value as a condition, and receiving the query result returned by the target database; wherein the query result is the storage information corresponding to the index value in the target database; the target database is a memory database; A data comparison module, used to compare the storage information corresponding to the index value with the business data to determine abnormal data in the target database; The exception handling module is used to add annotations to the abnormal data and generate a notification message of the abnormal data and send it to the monitoring party.
6. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the database monitoring method according to any one of claims 1 to 4.
7. A computer storage medium, characterized in that: The computer storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the database monitoring method according to any one of claims 1 to 4.