Database management method, device, electronic device and storage medium
Through multiple detections and external inputs, and determining available database information based on data writing failure information, the problem of low database management reliability is solved and the stability and reliability of database management is improved.
Patent Information
- Application Number
- CN202110294323.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2041-03-18
AI Technical Summary
The reliability of database management in the prior art is low, which leads to the use of a database that has failed to store data when there is a delay in database status update, which in turn leads to data storage failure and low reliability of database management.
By detecting and/or external inputting multiple databases multiple times, the first fault database information is determined, and the second fault database information is determined based on the acquired data written to the failed database information, and the available database information or fault database information is determined in combination with the two, thereby performing database management.
The first fault database information is effectively compensated for the delay in the update of the fault status caused by multiple detections through the target interval time, which improves the reliability of database management and avoids the use of a database that has already failed for management.
Smart Images

Figure CN115114278B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of databases, and in particular to a database management method, device, electronic equipment and storage medium. Background Art
[0002] Database management is the technology related to establishing, storing, updating and reading information in a database. When managing a database, it is often necessary to combine the current status of the database. In related technologies, the database administrator generally detects the database status through a detection mechanism. The database status information is updated only when the database fails, the failure is recovered, or the database meets the maintenance requirements. When the database administrator detects the database, the database status information is updated only after multiple consecutive detections to confirm the failure. Therefore, there is a certain lag in the update of the database status. In actual business scenarios, for example, when data needs to be stored, the database status update may cause a delay in using a failed database to store transaction data, resulting in data storage failure, which in turn leads to low reliability of database management. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a database management method, device, electronic device and storage medium to solve the defect of low reliability of database management in the prior art.
[0004] According to a first aspect, an embodiment of the present invention provides a database management method, comprising the following steps: performing detection and / or external input on multiple databases multiple times according to a target interval time to determine first fault database information; determining second fault database information based on the acquired database information of failed data write; determining available database information or fault database information based on the first fault database information and the second fault database information; and performing database management on the multiple databases based on the available database information or the fault database information.
[0005] Optionally, performing database management on the multiple databases according to the available database information or the faulty database information includes: when executing a data storage task, determining a database for executing the data storage task according to the available database information or the faulty database information.
[0006] Optionally, determining available database information or fault database information based on the first fault database information and the second fault database information includes: when the total number of databases after deduplication in the first fault database information and the second fault database information exceeds the upper limit of the number of allowed fault databases, deleting database information in the second fault database information that does not overlap with the first fault database information or writing database information into the first fault database until the total number of databases meets the upper limit of the number of allowed fault databases.
[0007] Optionally, determining the available database information or fault database information based on the first fault database information and the second fault database information includes: when the total number of databases in the first fault database information and the second fault database information does not exceed the upper limit of the number of allowed fault databases, determining the database information in the first fault database information and the second fault database information as fault database information.
[0008] Optionally, the method further includes: determining an upper limit on the number of databases that are allowed to have faults; the determining the upper limit on the number of databases that are allowed to have faults includes: determining the upper limit on the number of databases that are allowed to have faults based on a single database service load and actual service volume.
[0009] Optionally, determining the upper limit of the number of allowed faulty databases according to the service carrying capacity of a single database and the actual service volume includes:
[0010] The upper limit Y of the number of allowable failure databases is calculated according to the following formula:
[0011]
[0012] Where A is the total number of databases, B is the actual business volume, C is the business carrying capacity of a single database, and Ceil represents the first integer rounded up.
[0013] Optionally, it also includes: regularly detecting the database in the first fault database information and / or the database in the second fault database information, and when the detection result shows that the database is normal, removing the database from the corresponding first fault database information and / or the second fault database information.
[0014] Optionally, the second fault database information is determined based on the acquired database information of data writing failure, including: when it is acquired that the database fails to write, judging whether the data writing failure ratio of the database reaches a preset value; when the data writing failure ratio of the database reaches a preset value, using the database information corresponding to the database as the second fault database information.
[0015] Optionally, deleting database information in the second fault database information that does not overlap with the first fault database information includes: obtaining the data write failure ratio of databases that do not overlap with the first fault database information in multiple second fault database information; and deleting the database information in the second fault database information in order of the data write failure ratio of the databases from low to high.
[0016] Optionally, the database information written into the first fault database includes: when the amount of database information written into the first fault database does not reach the upper limit of the number of allowed fault databases, obtaining the data write failure ratio of the databases in multiple second fault database information; and writing the database information in order of the data write failure ratio of the databases from high to low.
[0017] According to a second aspect, an embodiment of the present invention provides a database management device, including: a first fault database information determination module, used to detect multiple databases multiple times and / or external input according to a target interval time to determine first fault database information; a second fault database information determination module, used to determine second fault database information based on the acquired database information of failed data writing; a database information determination module, used to determine available database information or fault database information based on the first fault database information and the second fault database information; a database management module, used to perform database management on the multiple databases based on the available database information or the fault database information.
[0018] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the database management method described in the first aspect or any embodiment of the first aspect are implemented.
[0019] According to a fourth aspect, an embodiment of the present invention provides a storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the database management method described in the first aspect or any implementation manner of the first aspect.
[0020] The technical solution of the present invention has the following advantages:
[0021] The database management method / device provided by the embodiment of the present invention jointly determines the faulty database information or the available database information according to the first faulty database information and the second faulty database information during the process of determining the faulty database. Since the second faulty database information is obtained by acquiring the database information of the failed data writing in real time, it can make up for the problem that the first faulty database information is delayed in updating the faulty status due to the fact that it is determined only by detecting the existing multiple databases multiple times at the target interval time. When actually managing the database, it not only considers the faulty database obtained by detecting the existing multiple databases multiple times at the target interval time and the faulty database input externally, but also considers the database that may fail obtained in real time, thereby avoiding the use of the database that has failed for database management and improving the reliability of database management. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 is a flowchart of a specific example of the database management method in an embodiment of the present invention;
[0024] Figure 2 A specific example diagram of the database management method in an embodiment of the present invention;
[0025] Figure 3 A specific example diagram of the database management method in an embodiment of the present invention;
[0026] Figure 4 A specific example diagram of the database management method in an embodiment of the present invention;
[0027] Figure 5 is a specific example principle block diagram of a database management device in an embodiment of the present invention;
[0028] Figure 6 It is a principle block diagram of a specific example of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0031] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0032] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0033] This embodiment provides a database management method, such as Figure 1 As shown, the following steps are included:
[0034] S101, performing detection and / or external input on multiple databases multiple times according to a target interval time to determine first fault database information;
[0035] Exemplarily, the first fault database information includes unique identification information of the fault database obtained by detecting multiple databases multiple times and / or external input according to the target interval time, and the unique identification information can be a unique identifier of the database or a custom name of the database. This embodiment does not limit the specific content of the first fault database information, and those skilled in the art can determine it as needed.
[0036] The first fault database information can be obtained by testing multiple databases multiple times according to the target interval time. For example, multiple databases are tested at a target interval of 5 minutes. When any database is detected to have a fault for three consecutive times, the unique identification information of the database is recorded to obtain the first fault database information. The multiple databases to be tested can be set according to actual usage. All databases in the system can be tested, or some databases can be selected for testing based on usage requirements.
[0037] The first fault database information can also be obtained based on the input of a database administrator. For example, if a database administrator needs to repair a database, then the database cannot be used for storage during the actual data storage process. At this time, the database administrator can input the unique identification information of the database as the first fault database information. This embodiment does not limit the target interval time, and those skilled in the art can determine it as needed.
[0038] S102, determining second fault database information according to the acquired database information where data writing fails;
[0039] Exemplarily, the second fault database information includes the unique identification information of the database where data writing failed, and the unique identification information may be a unique identifier of the database or a custom name of the database. This embodiment does not limit the specific content of the second fault database information, and those skilled in the art may determine it as needed.
[0040] The second fault database information can be determined by real-time monitoring of the data writing process. When the data writing fails, the unique identification information of the database where the writing fails is obtained, and the unique identification information is recorded to obtain the second fault database information. In actual situations, there are many reasons for data writing failure in addition to database failure, such as network delay, network fluctuation and other network failures. In the process of obtaining the second fault database information, it is not considered whether the reason for the data writing failure is a database failure. As long as the data writing fails, the corresponding database unique identification information is recorded.
[0041] S103, determining available database information or fault database information according to the first fault database information and the second fault database information;
[0042] Exemplarily, based on the first fault database information and the second fault database information, a method for determining the available database information may be to compare all managed database information with the first fault database information and the second fault database information. When any database information in the comparison result does not exist in the first fault database information and the second fault database information, the database information is recorded to obtain the available database information.
[0043] According to the first fault database information and the second fault database information, the method of determining the fault database information can be to directly use the first fault database information and the second fault database information as the fault database information, and directly read the first fault database information and the second fault database information when using; or the first fault database information and the second fault database information can be recorded in a third-party list or database to obtain the fault database information, and the fault database information in the third-party list or database is read when using. This embodiment does not limit the method of determining the available database information or the fault database according to the first fault database information and the second fault database information, and those skilled in the art can determine it as needed.
[0044] S104: performing database management on multiple databases according to the available database information or the faulty database information.
[0045] Exemplarily, the database management method includes adding, deleting, modifying, and checking a database. Based on the determination of available database information, the method of performing database management on multiple databases may be that when performing database management, if a deletion operation is to be performed through data in a certain database, first check whether the database information is in the available database information, if so, perform the deletion operation, and if not, do not perform the deletion operation. Based on the determination of faulty database information, the method of performing database management on multiple databases may be that when performing database management, if a deletion operation is to be performed through data in a certain database, first check whether the database information is in the faulty database information, if not, perform the deletion operation, and if so, do not perform the deletion operation.
[0046] The database management method provided in the present embodiment jointly determines the faulty database information or the available database information according to the first faulty database information and the second faulty database information during the process of determining the faulty database. Since the second faulty database information is obtained by real-time acquisition of the database information where data writing fails, it can make up for the problem of delay in updating the faulty status caused by the first faulty database information being determined only by detecting and determining the existing multiple databases multiple times at a target interval. When actually managing the database, both the faulty database obtained by detecting the existing multiple databases multiple times at a target interval and the faulty database input externally are considered, as well as the database that may fail obtained in real time, thereby avoiding the use of a database that has already failed for database management and improving the reliability of database management.
[0047] Taking online transactions through the above method as an example, the reserve fund processing center is an important part of online transactions. Figure 2As shown, it includes an application server cluster and a database group, which mainly performs accounting processing on real-time transactions. When conducting online transactions, the transaction request is sent to the application server. After the server processes it, the transaction data is saved to the corresponding database according to the database routing module. In combination with the database management method of the above embodiment, the specific usage scenario is as follows Figure 3 As shown, the database routing module determines the available database information or the faulty database information according to the first faulty database information and the second faulty database information, and guides the transaction routing to ensure that the transaction can be completed normally.
[0048] As an optional implementation of this embodiment, database management is performed on multiple databases according to the determination of available database information or fault database information, including:
[0049] When executing a data storage task, a database for executing the data storage task is determined according to available database information or faulty database information.
[0050] For example, according to the available database information, the method of determining the database for performing the data storage task may be to select a corresponding database in the available database information for data storage operation. According to the fault database information, the method of determining the database for performing the data storage task may be to select a database that is not in the fault database information for data storage operation.
[0051] The database management method provided in this embodiment determines the database that performs the data storage task according to the available database information or the faulty database information when performing the data storage operation, thereby avoiding the use of a faulty database for data storage and improving the stability of database storage.
[0052] In order to demonstrate the effect of the method of this embodiment when the reserve fund processing center conducts transactions, Figure 4 As shown, the horizontal axis in the figure is the IP of the application server, and the vertical axis is the number of failed transactions during the failure of each server. In this embodiment, the number of failed transactions during the failure of each server of the reserve fund processing center is compared. The server in the embodiment of the method is not used (corresponding to the left box), and the average number of failed transactions per server is about 350, while the server in the method in the embodiment of the present invention (corresponding to the right box) has an average of about 20 failed transactions per server; it can be seen that the present invention reduces the number of failed transactions during the failure by 94%, and the effect is significant.
[0053] As an optional implementation manner of this embodiment, determining available database information or fault database information according to the first fault database information and the second fault database information includes:
[0054] When the total number of databases after deduplication in the first fault database information and the second fault database information exceeds the upper limit of the number of allowed fault databases, delete the database information in the second fault database information that does not overlap with the first fault database information or write the database information in the first fault database until the total number of databases meets the upper limit of the number of allowed fault databases.
[0055] Exemplarily, the method for determining whether the total number of databases in the first fault database information and the second fault database information exceeds the predetermined upper limit number may be firstly to deduplicate the first fault database information and the second fault database information, specifically to obtain the database unique identification information in the first fault database information and the database unique identification information in the second fault database information, to make a union of the database unique identification information in the first fault database information and the database unique identification information in the second fault database information, and to use the number of database unique identification information in the union result as the total number of databases in the first fault database information and the second fault database information. For example, the database unique identification information recorded in the first fault database information is A, B, C; the database unique identification information recorded in the second fault database information is A, B, D, then the database identification is taken as A, B, C, D after the union, and the total number of databases is 4. Secondly, the total number of databases is compared with the upper limit of the number of allowed fault databases. The upper limit of the number of allowed fault databases can be set according to demand, for example, 8 databases.
[0056] In the case where the first fault database information and the second fault database information are directly used as the fault database information, when the total number of databases in the first fault database information and the second fault database information exceeds the upper limit of the number of allowed fault databases, in order to meet the upper limit of the number of allowed fault databases, it is necessary to delete the databases that exceed the upper limit of the number of allowed fault databases from the first fault database information and the second fault database information.
[0057] Since the first fault database information is obtained by detecting multiple databases multiple times according to the target interval time or by external input, the database corresponding to the first fault database information has a high accuracy rate of belonging to a fault database, while the second fault database information is obtained by obtaining database information of data writing failure in real time. The reasons for data writing failure include but are not limited to database failure, and may also be caused by network failures such as network delay and network jitter. The database corresponding to the second fault database information may be misjudged as a database failure, and its accuracy rate is low.
[0058] Therefore, it is preferred to delete the database information from the second fault database information with lower accuracy. The method of deleting the database information can be random deletion. It should be noted that when deleting the database information, the database information that overlaps with the first fault database information cannot be deleted. For example, the database unique identification information contained in the first fault database information is A and B; the database unique identification information contained in the second fault database information is A, B, C, D, and E; the predetermined upper limit is 3, then any two database unique identification information of C, D, and E need to be deleted from the second fault database information. This embodiment does not limit the method of deleting database information, and those skilled in the art can determine it as needed.
[0059] When the first fault database information and the second fault database information are recorded in a third-party list or database to obtain the fault database information, in order to ensure the accuracy of the written fault database information, the database information of the first fault database is written in the third-party list or database first, and when the writing of all the first fault database information has not reached the upper limit of the number of fault databases allowed, the second fault database information can be randomly written until the total number of databases written meets the upper limit of the number of fault databases allowed. For example, the database unique identification information contained in the first fault database information is A, B; the database unique identification information contained in the second fault database information is A, C, D, E; the predetermined upper limit is 3, then the database unique identification information that needs to be written first is A, B, and the remaining database unique identification information can be randomly selected from C, D, and E for writing.
[0060] As an optional implementation manner of this embodiment, determining available database information or fault database information according to the first fault database information and the second fault database information includes:
[0061] When the total number of databases in the first fault database information and the second fault database information does not exceed the upper limit of the number of allowed fault databases, the database information in the first fault database information and the second fault database information is determined as the fault database information.
[0062] As an optional implementation of this embodiment, the method further includes: determining an upper limit on the number of allowable fault databases;
[0063] Determine the upper limit on the number of database failures that can be tolerated, including:
[0064] The upper limit of the number of allowed faulty databases is determined based on the service load of a single database and the actual service volume.
[0065] Exemplarily, the upper limit Y of the number of allowed fault databases is calculated according to the following formula:
[0066]
[0067] Among them, A is the total number of databases, B is the actual business volume, C is the business carrying capacity of a single database, and floor represents the integer rounded down.
[0068] The database management method provided in this embodiment determines the upper limit of the number of allowed faulty databases through the business carrying capacity of a single database and the actual business volume. Compared with a fixed upper limit of the number of allowed faulty databases, it is more in line with actual usage scenarios, and the setting of the upper limit of the number of allowed faulty databases is more flexible, thereby improving the flexibility of database management.
[0069] As an optional implementation of this embodiment, determining the upper limit of the number of allowed faulty databases according to the service carrying capacity of a single database and the actual service volume includes:
[0070] The upper limit Y of the number of allowed faulty databases is calculated using the following formula:
[0071]
[0072] A is the total number of databases, B is the actual business volume, C is the business carrying capacity of a single database, and Ceil represents the first integer rounded up, that is, the nearest integer rounded up, for example So
[0073] The database management method provided in this embodiment adopts a round-up method when calculating the ratio of the actual business volume to the business carrying capacity of a single database, which is equivalent to leaving a surplus number of databases for processing business, ensuring that the business can be completed normally.
[0074] As an optional implementation of this embodiment, it also includes: regularly detecting the database in the first fault database information and / or the database in the second fault database information, and when the detection result is that the database is normal, the database is removed from the corresponding first fault database information and / or second fault database information. The method of regular detection can be to periodically trigger a pre-deployed detection mechanism to detect the status of the database through a pre-written program. The normal database means that the detection result of the detection mechanism is that the database is alive and in good condition.
[0075] The database management method provided in this embodiment is conducive to updating the first fault database information and the second fault database information through regular detection, and is further conducive to improving the reliability of database management.
[0076] As an optional implementation of this embodiment, determining the second fault database information according to the acquired database information of the data writing failure includes:
[0077] When it is obtained that the database fails to write, it is determined whether the data writing failure ratio of the database reaches a preset value; when the data writing failure ratio of the database reaches the preset value, the database information corresponding to the database is used as the second fault database information.
[0078] Exemplarily, the preset value may be 10%. This embodiment does not limit the size of the preset value, and those skilled in the art may determine it as needed. The data write failure ratio of the database may be obtained by pre-stating the data storage results of each database each time. The database management method provided in this embodiment, when the database fails to write, only when the data write failure ratio of the database reaches a preset value, will the database information be used as the second fault database information, to prevent the database from being judged as a database failure due to a single write failure, thereby improving the accuracy of the second fault database information.
[0079] As an optional implementation of this embodiment, deleting database information in the second fault database information that does not overlap with the first fault database information includes:
[0080] Obtain the data write failure ratio of databases that do not overlap with the first fault database information in the plurality of second fault database information; and delete the database information in the second fault database information in descending order of the data write failure ratio of the databases.
[0081] Exemplarily, the data write failure ratio of the database can be obtained by pre-stating each data storage result of each database. The method of deleting the database information in the second fault database information according to the data write failure ratio of the database can be to sort the data write failure ratios of each database, and preferentially delete the database information with a lower failure ratio, so as to further ensure the accuracy of the determined fault database.
[0082] As an optional implementation of this embodiment, the database information written into the first fault database includes:
[0083] When the amount of database information written into the first fault database does not reach the upper limit of the number of allowed fault databases, the data write failure ratio of multiple databases in the second fault database information is obtained; and the database information is written in descending order of the data write failure ratio of the databases.
[0084] Exemplarily, the method for obtaining the data write failure ratio of the database in the plurality of second fault database information may be to obtain the historical write situation of the database corresponding to the second fault database information, and obtain the data write failure ratio of the database by counting the historical write situation. The method for writing the database information may be to sort the data write failure ratios of the databases in descending order of the data write failure ratios of the databases, and preferentially write the database information with a higher failure ratio into the third-party list or database, thereby further ensuring the accuracy of the determined fault database.
[0085] This embodiment provides a database management device, such as Figure 5 As shown, including:
[0086] The first fault database information determination module 201 is used to detect multiple databases multiple times and / or external input according to the target interval time to determine the first fault database information; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0087] The second fault database information determination module 202 is used to determine the second fault database information according to the acquired database information of the data writing failure; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0088] The database information determination module 203 is used to determine the available database information or the fault database information according to the first fault database information and the second fault database information; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0089] The database management module 204 is used to manage the multiple databases according to the available database information or the fault database information. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0090] As an optional implementation of this embodiment, the database management module 204 includes:
[0091] The data storage module is used to determine the database for executing the data storage task according to the available database information or the fault database information when executing the data storage task. The specific contents refer to the corresponding part of the above embodiment, which will not be repeated here.
[0092] As an optional implementation of this embodiment, the database information determination module 203 includes:
[0093] The deleting / writing module is used to delete the database information in the second fault database information that does not overlap with the first fault database information or write the database information in the first fault database information when the total number of databases after deduplication in the first fault database information and the second fault database information exceeds the upper limit of the number of fault databases allowed, until the total number of databases meets the upper limit of the number of fault databases allowed. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0094] As an optional implementation of this embodiment, the database information determination module 203 includes:
[0095] The database information determination submodule is used to determine the database information in the first fault database information and the second fault database information as the fault database information when the total number of databases in the first fault database information and the second fault database information does not exceed the upper limit of the number of allowed fault databases. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0096] As an optional implementation of this embodiment, the database management device further includes:
[0097] An upper limit determination module, used to determine the upper limit of the number of allowable fault databases;
[0098] The determining of the upper limit of the number of allowable fault databases includes:
[0099] The upper limit of the number of allowed faulty databases is determined according to the service carrying capacity of a single database and the actual service volume. For details, please refer to the corresponding part of the above embodiment, which will not be described here.
[0100] As an optional implementation of this embodiment, the upper limit determination module includes:
[0101] The calculation module is used to calculate the upper limit Y of the number of allowable fault databases according to the following formula:
[0102]
[0103] Wherein, A is the total number of databases, B is the actual business volume, C is the business carrying capacity of a single database, and Ceil represents the first integer rounded up. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0104] As an optional implementation of this embodiment, the following further includes:
[0105] The update module is used to periodically detect the database in the first fault database information and / or the database in the second fault database information, and when the detection result shows that the database is normal, the database is removed from the corresponding first fault database information and / or the second fault database information. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0106] As an optional implementation of this embodiment, the database information determination module 203 includes:
[0107] The judgment module is used to judge whether the proportion of data writing failure in the database reaches a preset value when it is obtained that the database fails to write; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0108] The second fault database information determination submodule is used to use the database information corresponding to the database as the second fault database information when the proportion of data write failures in the database reaches a preset value. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0109] As an optional implementation of this embodiment, the delete / write module includes:
[0110] The first ratio determination module is used to obtain the data write failure ratio of the databases that do not overlap with the first fault database information in the plurality of second fault database information; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0111] The deletion module is used to delete the database information in the second fault database information according to the order of the database data writing failure ratio from low to high. For details, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0112] As an optional implementation of this embodiment, the delete / write module includes:
[0113] The second ratio determination module is used to obtain the data write failure ratio of the databases in the multiple second fault database information when the number of database information written in the first fault database does not reach the upper limit of the number of allowed fault databases; the specific content refers to the corresponding part of the above embodiment, which will not be repeated here.
[0114] The writing module is used to write the database information in the order of the failure ratio of the data writing to the database from high to low. For the specific content, please refer to the corresponding part of the above embodiment, which will not be repeated here.
[0115] The present application also provides an electronic device, such as Figure 6As shown, a processor 410 and a memory 420, wherein the processor 410 and the memory 420 may be connected via a bus or other means.
[0116] The processor 410 may be a central processing unit (CPU). The processor 410 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0117] The memory 420, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the database management method or data storage method in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory.
[0118] The memory 420 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 420 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0119] The one or more modules are stored in the memory 420, and when executed by the processor 410, the database management method in the embodiment shown in the figure is performed.
[0120] For details of the above electronic equipment, please refer to Figure 1 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.
[0121] This embodiment also provides a computer storage medium, which stores computer executable instructions, and the computer executable instructions can execute the database management method in any of the above method embodiments. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (FlashMemory), a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.
[0122] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A database management method, characterized in that: The steps include: Performing multiple tests and / or external input on multiple databases multiple times according to a target interval to determine first fault database information; Determine the second fault database information according to the acquired database information where the data writing fails; Determining available database information or fault database information according to the first fault database information and the second fault database information; Performing database management on the multiple databases according to the available database information or the fault database information; The determining, according to the first fault database information and the second fault database information, available database information or fault database information comprises: When the total number of databases in the first fault database information and the second fault database information does not exceed the upper limit of the number of allowed fault databases, the database information in the first fault database information and the second fault database information is determined as the fault database information; The method further comprises: determining an upper limit on the number of allowable fault databases; The determining of the upper limit of the number of allowable fault databases includes: The upper limit of the number of databases that can be allowed to fail is determined according to the service carrying capacity of a single database and the actual service volume.
2. The method according to claim 1, characterized in that: The performing database management on the multiple databases according to the available database information or the fault database information includes: When executing a data storage task, a database for executing the data storage task is determined according to the available database information or the faulty database information.
3. The method according to claim 1, characterized in that The determining, according to the first fault database information and the second fault database information, available database information or fault database information comprises: When the total number of databases after deduplication in the first fault database information and the second fault database information exceeds the upper limit of the number of allowed fault databases, delete the database information in the second fault database information that does not overlap with the first fault database information or write the database information into the first fault database until the total number of databases meets the upper limit of the number of allowed fault databases.
4. The method according to claim 1, characterized in that: The determining the upper limit of the number of allowed faulty databases according to the service carrying capacity of a single database and the actual service volume includes: The upper limit Y of the number of allowable failure databases is calculated according to the following formula: Where A is the total number of databases, B is the actual business volume, C is the business carrying capacity of a single database, and Ceil represents the first integer rounded up.
5. The method according to claim 1, characterized in that Also includes: The database in the first fault database information and / or the database in the second fault database information is detected regularly, and when the detection result shows that the database is normal, the database is removed from the corresponding first fault database information and / or the second fault database information.
6. The method according to claim 1, characterized in that The step of determining the second fault database information according to the acquired database information of the data writing failure includes: When it is obtained that the database fails to write, it is determined whether the failure rate of data writing in the database reaches a preset value; When the data writing failure ratio of the database reaches a preset value, the database information corresponding to the database is used as the second fault database information.
7. The method according to claim 3, characterized in that The deleting the database information in the second fault database information that does not overlap with the first fault database information includes: Obtaining a data write failure ratio of a database that does not overlap with the first fault database information among a plurality of second fault database information; The database information in the second fault database information is deleted in the order of the database data write failure ratio from low to high.
8. The method according to claim 3, characterized in that The database information written into the first fault database includes: When the amount of database information written into the first fault database does not reach the upper limit requirement of the number of allowed fault databases, the data writing failure ratio of the databases in the plurality of second fault database information is obtained; Write database information in descending order of the percentage of failed data writes to the database.
9. A database management device, characterized in that: include: A first fault database information determination module, configured to perform detection and / or external input on multiple databases multiple times according to a target interval time to determine first fault database information; A second fault database information determination module, used to determine second fault database information according to the acquired database information into which data writing fails; A database information determination module, configured to determine available database information or fault database information according to the first fault database information and the second fault database information; A database management module, used for performing database management on the multiple databases according to the available database information or the fault database information; The determining, according to the first fault database information and the second fault database information, available database information or fault database information comprises: When the total number of databases in the first fault database information and the second fault database information does not exceed the upper limit of the number of allowed fault databases, the database information in the first fault database information and the second fault database information is determined as the fault database information; The device further comprises: determining an upper limit on the number of allowable fault databases; The determining of the upper limit of the number of allowable fault databases includes: The upper limit of the number of databases that can be allowed to fail is determined according to the service carrying capacity of a single database and the actual service volume.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the database management method described in any one of claims 1 to 8 are implemented.
11. A storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by the processor, the steps of the database management method described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Database processing method, database processing device and database processing system
CN105573996A
Method and device of improving database availability
CN107870830A