Database over-limit connection control method and device, computer equipment and storage medium
By creating a management end in the Redis database to perform emergency operation and maintenance operations, the problem of operation and maintenance management difficulty and service interruption risks when the database connection is exceeded is solved, and efficient operation and maintenance management is achieved when the connection is exceeded.
Patent Information
- Application Number
- CN202411722191.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-18
AI Technical Summary
When the number of client connections reaches the maximum, the Redis database cannot add new requested connections, resulting in increased difficulty in operation and maintenance management and increased risk of service interruption.
By receiving user connection requests, the number of database client connections is obtained. When the preset threshold is exceeded, the database configuration information is obtained. Based on the configuration information and user identification, whether the management connection creation conditions are met. If so, a management end is created to perform emergency operation and maintenance operations.
When the database connection exceeds the limit, management connections can still be built to perform emergency operation and maintenance operations, improve operation and maintenance management capabilities, reduce unnecessary service interruption risks, and do not affect the normal operation of the database.
Smart Images

Figure CN119646074A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cache middleware control technology, and in particular to a method, device, computer equipment, storage medium and computer program product for controlling database over-limit connections. Background Art
[0002] Redis (Remote Dictionary Server), also known as remote dictionary service, is an open source, high-performance in-memory key-value storage database written in ANSI C language. It has attracted widespread attention for its rich data structure support, high speed, persistence, master-slave replication and high availability.
[0003] When using Redis, the maximum number of client connections is set through the maxclients configuration item for considerations such as resource protection, performance, operation and maintenance management, security, and compliance. However, when the number of client connections to the database reaches the maximum number of client connections, the inability to add new request connections can easily lead to abnormal misjudgments of database service detection, and the operation and maintenance personnel cannot perform emergency measures on the database, which increases the difficulty and complexity of operation and maintenance work. Therefore, how to improve the operation and maintenance management capabilities of the database and reduce the risk of unnecessary service interruptions while meeting the normal use of the database is an urgent problem to be solved in the Redis database. Summary of the invention
[0004] Based on this, it is necessary to provide a database over-limit connection control method, device, computer equipment, computer-readable storage medium and computer program product to address the above technical problems, which can improve the database operation and maintenance management capabilities while meeting the normal use of the database and reduce the risk of unnecessary service interruptions.
[0005] In a first aspect, the present application provides a method for controlling excessive database connections, the method comprising:
[0006] Receive a connection request from a user to a database, and obtain the number of client connections to the database;
[0007] When the number of client connections exceeds a preset number threshold, obtaining configuration information of the database;
[0008] Based on the configuration information and the user identifier carried in the connection request, determining whether a management connection creation condition is met between the user and the database;
[0009] If the management connection creation condition is met between the user and the database, a management terminal corresponding to the user is created in the database, and the management terminal is used to control the database to perform emergency operation and maintenance operations.
[0010] In some embodiments, determining whether a management connection creation condition is satisfied between the user and the database based on the configuration information and the user identifier carried in the connection request includes:
[0011] Extracting database management connection configuration information and management user identification from the configuration information;
[0012] In a case where the user identifier carried in the connection request matches the management user identifier, determining that the connection request is a management request;
[0013] determining, according to the management connection configuration information, whether the database satisfies a request receiving condition of the management request;
[0014] If the database satisfies the request receiving condition, it is determined that a management connection creation condition is satisfied between the user and the database.
[0015] In some of these embodiments, the management connection configuration information includes an over-limit management enabling state of the database and a management connection quantity threshold;
[0016] The determining, according to the management connection configuration information, whether the database satisfies a request receiving condition of the management request comprises:
[0017] When the over-limit management enabling state of the database is enabled, obtaining the number of management connections of the database;
[0018] If the number of management connections is less than the management connection number threshold, it is determined that the database meets the request receiving condition of the management request.
[0019] In some embodiments, the method further comprises:
[0020] Obtaining the number of connection requests received by the database within a preset time period;
[0021] Determine a target cleaning duration that matches the number of connection requests according to the number of connection requests and a preset correspondence between the number of requests and the cleaning duration;
[0022] Based on the target cleaning duration, the idle connection cleaning duration preconfigured in the database is updated to obtain an updated idle connection cleaning duration;
[0023] The database is controlled to asynchronously clean up idle connections according to the updated idle connection cleaning duration.
[0024] In some embodiments, the method further comprises:
[0025] Receiving a request instruction sent by the management terminal, and determining an instruction type of the request instruction;
[0026] If the instruction type fails to match the emergency operation and maintenance instruction type, closing the connection between the management terminal and the database;
[0027] A connection closing prompt message is generated and displayed according to the instruction type, and the connection closing prompt message is used to prompt the user that the management connection does not support the instruction type.
[0028] In some embodiments, the method further comprises:
[0029] In response to a management connection parameter configuration operation for a configuration file of a database, adding an over-limit management enabling state and a management connection quantity threshold of the database to the configuration file;
[0030] In response to a configuration operation of a management user identification parameter for the configuration file, adding a management user identification of the management user to the configuration file;
[0031] In response to the instruction range configuration operation for the management end, at least one emergency operation and maintenance instruction type is configured in the instruction range of the management end.
[0032] In a second aspect, the present application further provides a database over-limit connection control device, the device comprising:
[0033] A request receiving module, used to receive a connection request sent by a user to a database, and obtain the number of client connections to the database;
[0034] A configuration information acquisition module, used to acquire the configuration information of the database when the number of client connections exceeds a preset number threshold;
[0035] A condition judgment module, used to determine whether a management connection creation condition is met between the user and the database based on the configuration information and the user identifier carried in the connection request;
[0036] A management connection module is used to create a management terminal corresponding to the user in the database if the management connection creation condition is met between the user and the database, and the management terminal is used to control the database to perform emergency operation and maintenance operations.
[0037] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0039] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0040] In the above-mentioned database over-limit connection control method, device, computer equipment, storage medium and computer program product, the database server receives the connection request sent by the user to the database, obtains the number of client connections of the database, and does not directly reject the user's connection request when the number of client connections exceeds the preset number threshold, but obtains the configuration information of the database, and determines whether the user and the database meet the management connection creation conditions based on the configuration information and the user identifier carried in the connection request. If the user and the database meet the management connection creation conditions, the management end corresponding to the user is created in the database, and the management end is used to control the database to perform emergency operation and maintenance operations. By creating a management end for the user who meets the management connection creation conditions with the database, the management end can still establish a management connection with the database when the database connection exceeds the limit, and perform emergency operation and maintenance operations such as detection, configuration modification, and session management, thereby improving the operation and maintenance management capabilities of the database in abnormal scenarios, avoiding the database master-slave switching triggered by detection failure, and effectively reducing the risk of unnecessary service interruption. Moreover, since the management end is only used to control the database to perform emergency operation and maintenance operations, the connection of the management end will not affect the normal operation of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is an application environment diagram of the database over-limit connection control method in some embodiments;
[0042] Figure 2 A schematic diagram of a flow chart of a method for controlling database over-limit connections in some embodiments;
[0043] Figure 3 A schematic diagram of a process for determining whether a management connection creation condition is met between a user and a database based on configuration information and a user identifier carried in a connection request in some embodiments;
[0044] Figure 4 A schematic diagram of a flow chart of a method for controlling database over-limit connections in other embodiments;
[0045] Figure 5 A schematic diagram of a flow chart of a method for controlling database over-limit connections in other embodiments;
[0046] Figure 6A schematic diagram of a flow chart of a method for controlling database over-limit connections in other embodiments;
[0047] Figure 7 A schematic diagram of a flow chart of a method for controlling database over-limit connections in other embodiments;
[0048] Figure 8 It is a structural block diagram of a database over-limit connection control device in some embodiments;
[0049] Fig. 9 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] The database over-limit connection control method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the database server 102 communicates with the user terminal 104 and the database 106 through the network. The data storage system can store the data that the database server 102 needs to process. The data storage system can be integrated on the database server 102, or it can be placed on the cloud or other network servers. The database server 102 receives a connection request sent by the user to the database 106 based on the user terminal 104, obtains the number of client connections of the database 106 from the database 106, and obtains the configuration information of the database 106 when the number of client connections exceeds the preset number threshold. Based on the configuration information and the user identifier carried by the connection request, it is determined whether the user and the database 106 meet the management connection creation conditions. If the user and the database 106 meet the management connection creation conditions, the management end corresponding to the user is created in the database 106, and the management end is used to control the database 106 to perform emergency operation and maintenance operations. Among them, the database server 102 and the database 106 can be integrated on a server, and the server can be implemented with an independent server or a server cluster composed of multiple servers. The user terminal 104 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.
[0052] In some embodiments, Figure 2 As shown, a method for controlling over-limit connections in a database is provided. Figure 1The database server 102 in the example is used as an example to illustrate, including the following steps:
[0053] S202, receiving a connection request sent by a user to a database, and obtaining the number of client connections to the database.
[0054] The connection request is the request information of the user requesting to establish a corresponding client on the database. Creating a client on the database means establishing a program or tool instance that can communicate and interact with the database on the basis of the operation of the database service, so as to serve as a bridge between the user and the database. It can be understood that the connection request can be triggered by the user based on the user terminal to the database.
[0055] The client connection data refers to the number of clients that have connected to the database at the current moment.
[0056] Specifically, the database server receives a connection request for the database triggered by a user terminal, and obtains the number of client connections to the database.
[0057] In some of the embodiments, a database management module is pre-installed in the database server for real-time management of database information. For example, the database management module can count the number of client connections to the database in real time, and the database server can directly obtain the number of client connections counted by the database management module.
[0058] S204: When the number of client connections exceeds a preset number threshold, obtain configuration information of the database.
[0059] Among them, the preset number threshold is a preset limit on the number of database client connections, which can be set in advance by the operation and maintenance personnel according to the actual performance of the database. The preset data threshold is used to determine whether the database is in a connection overlimit state. For example, when the number of client connections to the database exceeds the preset number threshold, it means that the database is in a connection overlimit state at this time. When the number of client connections to the database does not exceed the preset number threshold, it means that the database is not in a connection overlimit state at this time.
[0060] The configuration information of the database is information data used to characterize the performance and behavior of the database. The configuration information may include but is not limited to network settings, security, persistence strategy, memory management, client connection, performance optimization and other configuration contents.
[0061] Specifically, when the database server obtains the number of client connections to the database, it can compare the number of client connections with the preset number threshold. If the number of client connections exceeds the preset number threshold, it means that the number of clients connected to the database has exceeded the preset database client connection limit. In the existing database control, the database will directly reject the user's connection request and return an error message to the user terminal to ensure the normal and stable operation of the database. In the database over-limit connection control method of the present application, in order to improve the operation and maintenance management capabilities of the database in the over-limit state and reduce the risk of unnecessary service interruption, the database server will obtain the configuration information of the database to provide an information basis for subsequent management connection judgments.
[0062] S206: Determine whether the management connection creation condition is met between the user and the database based on the configuration information and the user identifier carried in the connection request.
[0063] The management connection creation condition is a preset judgment condition for determining whether a management terminal corresponding to a user can be created on the database, and for controlling the database to perform emergency operation and maintenance operations. The management connection creation condition may include user conditions and / or database conditions.
[0064] Specifically, after obtaining the configuration information of the database, the database server can determine whether the management connection creation condition is met between the user and the database based on the configuration information and the user identifier carried in the connection request.
[0065] S208: If the conditions for establishing a management connection are met between the user and the database, a management terminal corresponding to the user is created in the database. The management terminal is used to control the database to perform emergency operation and maintenance operations.
[0066] Among them, in the existing database control, when the number of client connections to the database reaches the preset threshold, any new connection requests, including ping checks initiated by operation and maintenance personnel, will be rejected by the system, resulting in ping check failure, and then incorrectly judging that there is an abnormality in the database service, triggering unnecessary master-slave switching process. This master-slave switching based on misjudgment not only disrupts the normal business process and causes unexpected interruption of existing business connections, but may also cause unnecessary frequent role switching between the master and standby nodes, affecting system stability.
[0067] In addition to the possibility of causing ping check failures, when the number of client connections to the database reaches the upper limit, operation and maintenance personnel cannot use conventional means, such as using database command line tools to connect to the database service. This will also seriously hinder the implementation of emergency measures. For example, it is impossible to clean up expired sessions in time to release connection resources to alleviate the pressure on the number of connections, which also increases the difficulty and complexity of operation and maintenance work.
[0068] In order to solve the above problem, when the database is in the state of client connection exceeding the limit, a management terminal can still be created to control the database to perform emergency operation and maintenance operations. Among them, emergency operation and maintenance operations refer to the operation steps of emergency operation and maintenance processing of the database, and emergency operation and maintenance operations may include but are not limited to detection, configuration modification, session management, etc. The management terminal can control the database to perform emergency operation and maintenance operations by sending corresponding command signals to the database controller.
[0069] Specifically, if the database server determines that the conditions for creating a management connection between the user and the database are met, it means that a management terminal corresponding to the user can be created on the database to control the database to perform emergency operation and maintenance operations. The database server will create a management terminal corresponding to the user on the database to establish a connection between the database and the management terminal. It should be noted that since the management terminal is a client created when the database is in an over-limit state, in order to ensure the normal operation of the database and reduce the resource occupancy rate of the management terminal connection to the database, the newly connected management terminal is only used to control the database to perform emergency operation and maintenance operations.
[0070] In the above-mentioned database over-limit connection control method, the database server receives the connection request sent by the user to the database, obtains the number of client connections of the database, and does not directly reject the user's connection request when the number of client connections exceeds the preset number threshold, but obtains the configuration information of the database, and determines whether the user and the database meet the management connection creation conditions based on the configuration information and the user identifier carried in the connection request. If the user and the database meet the management connection creation conditions, the management end corresponding to the user is created in the database, and the management end is used to control the database to perform emergency operation and maintenance operations. By creating a management end for users who meet the management connection creation conditions with the database, the management end can still establish a management connection with the database when the database connection exceeds the limit, and perform emergency operation and maintenance operations such as detection, configuration modification, and session management, thereby improving the operation and maintenance management capabilities of the database in abnormal scenarios, avoiding the database master-slave switching triggered by detection failure, and effectively reducing the risk of unnecessary service interruption. Moreover, since the management end is only used to control the database to perform emergency operation and maintenance operations, the connection of the management end will not affect the normal operation of the database.
[0071] In some of the embodiments, if the management connection creation condition is not satisfied between the user and the database, the database server may directly reject the connection request and return an error message to the user terminal.
[0072] In some embodiments, Figure 3 As shown, S206, based on the configuration information and the user identifier carried in the connection request, determining whether the user and the database meet the management connection creation conditions, including:
[0073] S302: extracting database management connection configuration information and management user identification from the configuration information.
[0074] The management connection configuration information is information data used to specify the configuration conditions that the database needs to meet when building the management connection, and the management user identifier is unique identification information used to mark the management user. It can be understood that both the management connection configuration information and the management user identifier can be pre-configured in the configuration information of the database by the operation and maintenance personnel according to the actual situation of the database.
[0075] Specifically, after obtaining the configuration information of the database, the database server may perform an information extraction operation on the configuration information to extract the management connection configuration information and the management user identifier of the database from the configuration information.
[0076] S304: When the user identifier carried in the connection request matches the management user identifier, determine that the connection request is a management request.
[0077] The user ID is unique identification information for marking the user who initiates the connection request.
[0078] Specifically, the database server can obtain the user identifier carried in the connection request from the connection request, and match the user identifier with the management user identifier. When the user identifier carried in the connection request matches the management user identifier, it means that the user who currently initiates the connection request is the management user, and the user identity authentication is successful. The database server can determine the connection request initiated by the user as a management request.
[0079] S306: Determine whether the database meets a request receiving condition of the management request according to the management connection configuration information.
[0080] The request receiving condition is a preset judgment condition for judging whether the database can accept the management request, that is, judging whether the current operation of the database meets the preset judgment condition of the configuration specified by the management connection configuration information. If the database meets the request receiving condition of the management request, it can be said that from the database level, the management end corresponding to the management user can be created in the database. If the database does not meet the request receiving condition of the management request, it means that from the database level, the database cannot create the management end corresponding to the management user.
[0081] Specifically, the database server may determine whether the database meets the request receiving condition of the management request according to the management connection configuration information and the current operation status of the database.
[0082] S308: If the database meets the request receiving condition, determine whether the management connection creation condition is met between the user and the database.
[0083] Specifically, if the database server determines that the database meets the conditions for receiving the request, it means that from the database level, a management end corresponding to the management user can be created in the database. Since the user has been determined as a management user before, the database server can determine that the conditions for creating a management connection between the user and the database are met, and a management end corresponding to the user can be created on the database to control the database to perform emergency operation and maintenance operations.
[0084] In the above embodiment, the management connection configuration information and the management user identifier are used to determine whether the user and the database both meet the conditions for creating a management end. Only when the user and the database both meet the conditions for creating a management end, will the management end corresponding to the user be constructed in the database, effectively improving the accuracy of the creation of the management end, so that the database can still run stably after the management end is created.
[0085] In some embodiments, if the user identifier does not match the management user identifier, it means that the user initiating the connection request is not a management user and does not have management authority to manage the database. The database server will determine that the management connection creation conditions are not met between the user and the database.
[0086] In some embodiments, if the database does not meet the request receiving condition, it means that the current operation state of the database does not allow adding a new management connection, and the database server will determine that the management connection creation condition is not met between the user and the database.
[0087] In some embodiments, the management connection configuration information includes the over-limit management enabling state of the database and the management connection quantity threshold. S306, determining whether the database meets the request receiving condition of the management request according to the management connection configuration information, includes: when the over-limit management enabling state of the database is enabled, obtaining the management connection quantity of the database. If the management connection quantity is less than the management connection quantity threshold, it is determined that the database meets the request receiving condition of the management request.
[0088] Among them, the over-limit management enabled state is a state parameter used to characterize the enabled state of the over-limit management mode in the database. When the over-limit management enabled state is enabled, it means that the operation and maintenance personnel have pre-configured the over-limit management authority for the database. When the database is in a connection over-limit situation, emergency operation and maintenance operations can be implemented by building a management connection, that is, creating a management terminal in the database. When the over-limit management enabled state is not enabled, it means that the operation and maintenance personnel have not enabled the over-limit management authority for the database. Even if the database is already in a connection over-limit state, the database server still cannot create a corresponding management terminal in the database for the management user to implement emergency operation and maintenance operations.
[0089] The number of management connections refers to the number of management connections that have been created by the database at the current moment, that is, the number of management terminals that have been created in the database. The management connection number threshold is a preset threshold parameter used to determine whether to continue to build management connections. The management connection number threshold can be pre-set by the operation and maintenance personnel based on the actual performance of the database.
[0090] Specifically, the database server can extract the over-limit management enablement status of the database from the management connection configuration information. When the over-limit management enablement status is enabled, it means that the database has pre-enabled the over-limit management permission. The database server can obtain the number of management connections of the database, and at the same time obtain the pre-set management connection number threshold from the management connection configuration information, and compare the number of management connections with the management connection number threshold. If the number of management connections is less than the management connection number threshold, it means that the database can still add new management connections at this time. The database server can determine that the database meets the request receiving conditions for the management request.
[0091] In some of the embodiments, if the number of management connections is greater than or equal to the management connection number threshold, it means that the number of management connections in the database has reached the limit. In order not to affect the normal operation of the database, the database will reject the management request. The database server can determine that the database does not meet the request receiving conditions for the management request.
[0092] In the above embodiment, whether the database meets the request reception conditions is judged by the over-limit management activation status of the database and the management connection quantity threshold, which can effectively improve the accuracy of judging whether the database can add new management connections and reduce the possibility of abnormal database operation due to disorderly increase of management connections.
[0093] In some embodiments, Figure 4 As shown, the database overlimit connection control method also includes the following steps:
[0094] S402: Obtain the number of connection requests received by the database within a preset period of time.
[0095] The preset time period is a time period parameter set to facilitate counting of the number of connection requests generated within the same time period. The preset time period can be set by the operation and maintenance personnel according to actual needs, for example, it can be 1 minute, 5 minutes, etc.
[0096] Specifically, when the database server determines that the database is in a connection limit excess state, the database server may obtain the number of connection requests received by the database within a preset time period.
[0097] S404: Determine a target cleaning duration that matches the number of connection requests according to the number of connection requests and a preset correspondence between the number of requests and the cleaning duration.
[0098] Among them, the preset correspondence between the number of requests and the cleaning time can be determined in advance by the operation and maintenance personnel based on experimental data or experience data. The operation and maintenance personnel can determine the optimal request cleaning time corresponding to each request number, and bind each request number with its corresponding optimal request cleaning time to obtain the preset correspondence between the number of requests and the cleaning time.
[0099] Specifically, when the database server obtains the number of connection requests received by the database within a preset time period, it can search for a preset correspondence between the number of connection requests and the cleaning duration based on the number of connection requests, and determine a target request duration that matches the number of connection requests from the preset correspondence.
[0100] S406: Update the idle connection cleaning time preconfigured in the database based on the target cleaning time to obtain an updated idle connection cleaning time.
[0101] Among them, the idle connection cleanup duration is the duration parameter for cleaning up idle requests in the database at the current moment. The idle connection cleanup duration can be preset by the operation and maintenance personnel, or it can be set by the database server according to the actual number of database request connections. It is understandable that there is a preset duration range for the idle connection cleanup duration, such as 10~60s. The idle connection cleanup duration of the database cannot exceed the preset duration range, reducing the possibility of normal business connection termination due to too fast cleanup, or the possibility of idle connections not being cleaned up in time due to too slow cleanup.
[0102] Specifically, after determining the target cleanup duration that matches the number of connection requests, the database server can update the idle connection cleanup duration pre-configured in the database based on the target cleanup duration to obtain an updated idle connection cleanup duration. It can be understood that the updated idle connection cleanup duration is the target cleanup duration. For example, if the idle connection cleanup duration pre-configured in the database is 50s and the target cleanup duration determined by the database server is 20s, the idle connection cleanup duration can be updated to 20s.
[0103] S408: Control the database to asynchronously clean up idle connections according to the updated idle connection cleaning duration.
[0104] Specifically, after the database server updates the idle connection cleaning time, it can control the database to asynchronously clean up the idle connections according to the updated idle connection cleaning time.
[0105] In the above embodiment, the idle connection cleanup duration of the database is dynamically adjusted by the number of connection requests received by the database within a preset time period, so that the updated idle connection cleanup duration can match the actual request situation of the database, effectively improving the accuracy and cleaning efficiency of the database idle connection cleanup.
[0106] In some embodiments, Figure 5 As shown, the database overlimit connection control method also includes the following steps:
[0107] S502, receiving a request instruction sent by the management end, and determining the instruction type of the request instruction.
[0108] The instruction type of the request instruction is a type parameter for classifying the request instruction according to the execution content indicated by the instruction. For example, the instruction type may include a status detection instruction, a configuration modification instruction, a session management instruction, a business service instruction, etc.
[0109] Specifically, when the database is running, the database server may receive a request instruction sent by the management end. The request instruction carries an instruction type. The database server may parse the request instruction to determine the instruction type of the request instruction.
[0110] S504: When the instruction type fails to match the emergency operation and maintenance instruction type, close the connection between the management terminal and the database.
[0111] Among them, the emergency operation and maintenance instruction type refers to the type of instruction used to execute the emergency operation and maintenance operation of the database, which can be configured in advance by the operation and maintenance personnel in the configuration file of the database according to the actual operation and maintenance situation. It can be understood that the number of emergency operation and maintenance instruction types can be single or multiple, for example, the emergency operation and maintenance instruction types can include status detection instructions, configuration modification instructions, session management instructions, etc.
[0112] Specifically, the database server can match the instruction type of the request instruction with the preset emergency operation and maintenance instruction type. If the instruction type fails to match the emergency operation and maintenance instruction type, it means that the instruction sent by the management end is a non-emergency operation and maintenance instruction. For example, the instruction sent by the management end is a business service instruction. At this time, in order not to affect the normal operation of the database, the database server will close the connection between the management end and the database.
[0113] S506: Generate and display connection closing prompt information according to the instruction type. The connection closing prompt information is used to prompt the user that the management connection does not support the instruction type.
[0114] Specifically, when closing the connection between the management end and the database, the database server can generate connection closing prompt information according to the instruction, and send the connection closing prompt information to the user terminal for display. The connection closing prompt information is used to prompt the user that the management connection does not support the instruction type.
[0115] In the above embodiment, when the database server determines that the instruction type sent by the management end is a non-emergency operation and maintenance instruction type, it can promptly close the connection between the management end and the database to ensure the normal operation of the database and improve the operational stability of the database.
[0116] In some of the embodiments, when the database server determines that the instruction type successfully matches the emergency operation and maintenance instruction type, the database server may perform an emergency operation and maintenance operation on the database in response to the request instruction sent by the management terminal.
[0117] In some embodiments, Figure 6 As shown, the database overlimit connection control method also includes the following steps:
[0118] S602: In response to a management connection parameter configuration operation for a configuration file of a database, an over-limit management enabling state of the database and a management connection quantity threshold are added to the configuration file.
[0119] The management connection parameter configuration operation is an operation behavior of configuring corresponding management connection parameters in a configuration file of a database.
[0120] Specifically, the operation and maintenance personnel can trigger the management connection parameter configuration operation for the database configuration file through the user terminal. The database server responds to the management connection parameter configuration operation for the database configuration file, obtains the database's over-limit management enablement status and management connection quantity threshold, and adds the over-limit management enablement status and management connection quantity threshold to the configuration file.
[0121] For example, the database server can add a new configuration item in the database configuration file: manage-client-enable, yes, 1000, 60, where parameter 1 (yes) represents enabling over-limit management, parameter 2 (1000) represents the management connection number threshold, and parameter 3 (60) represents the idle connection cleanup time.
[0122] S604: In response to the management user identification parameter configuration operation for the configuration file, add the management user identification of the management user to the configuration file.
[0123] The management user identification parameter configuration operation is an operation behavior of configuring the management user identification parameters in a configuration file of the database.
[0124] Specifically, the operation and maintenance personnel can trigger the management user identification parameter configuration operation for the database configuration file through the user terminal. The database server responds to the management user identification parameter configuration operation for the database configuration file, obtains the management user identifier of the management user, and adds the management user identifier of the management user to the configuration file.
[0125] For example, the database server can add an mflag identification field to the original client structure as a management connection identifier.
[0126] S606: In response to the instruction range configuration operation for the management end, configure at least one emergency operation and maintenance instruction type in the instruction range of the management end.
[0127] The instruction range configuration operation is to configure the operation behavior of the corresponding instruction range in the configuration file of the database.
[0128] Specifically, the operation and maintenance personnel can trigger the instruction range configuration operation for the database configuration file through the user terminal. The database server responds to the instruction range configuration operation for the database configuration file, obtains at least one emergency operation and maintenance instruction type, and adds the emergency operation and maintenance instruction type to the configuration file.
[0129] For example, the database server can define the auth, ping, config, and client command types as emergency operation and maintenance command types in the configuration file, so that the management connection is only allowed to execute a few emergency operation and maintenance commands, that is, only emergency operation and maintenance commands such as status detection, configuration modification, and session management are allowed to execute.
[0130] In the above embodiment, by pre-configuring the database configuration file as above, the database can still reserve connections for the management side in an over-limit state, thereby improving the operation and maintenance management capabilities of the database in abnormal scenarios, avoiding database master-slave switching triggered by detection failure, and effectively reducing the risk of unnecessary service interruption.
[0131] In some embodiments, Figure 7 As shown, a method for controlling over-limit connections of a database is provided, and the method is applied to a Redis database as an example for explanation. The method specifically includes the following steps:
[0132] First, the database server responds to the configuration operation on the database and obtains the configuration file of the database. Specifically, the operation and maintenance personnel can pre-configure the over-limit management activation state of the database, the management connection quantity threshold, the management user ID, the timeout parameter, the preset quantity threshold, the emergency operation and maintenance instruction type, etc. in the database configuration file.
[0133] Subsequently, the database server can receive a connection request sent by the user to the database, obtain the number of client connections to the database, and when the number of client connections does not exceed a preset number threshold, receive the connection request and create a corresponding client for the user in the database.
[0134] When the number of client connections exceeds the preset threshold, the over-limit management activation status of the database is obtained. If the over-limit management activation status is not enabled, a connection number over-limit prompt message is generated and returned to the user terminal.
[0135] If the overlimit management enabling status is enabled, the number of connection requests received within the preset time period is obtained, and the target cleaning duration that matches the number of connection requests is determined based on the number of connection requests and the preset correspondence between the number of requests and the cleaning duration. The timeout parameter is adjusted and updated based on the target cleaning duration, and idle connections are asynchronously cleaned based on the updated timeout parameter, that is, when the idle state duration of the connection is greater than timeout, it is automatically closed.
[0136] At the same time, the database server matches the user ID carried in the connection request with the management user ID to determine whether the user is a management user. If the user is not a management user, a connection limit exceeded prompt message is generated and returned to the user terminal.
[0137] If the user is a management user, the number of management connections of the database is obtained. If the number of management connections exceeds the management connection number threshold, a management connection number limit overlimit prompt message is generated and returned to the user terminal. If the number of management connections does not exceed the management connection number threshold, a management terminal, i.e., a management client, is created for the user in the database.
[0138] In actual use, the database server receives the request instruction sent by the client, and determines whether the client is a management client based on the client information carried in the request instruction. If the client is not a management client, the request instruction is processed.
[0139] If the client is a management client, the instruction type of the request instruction is obtained, the instruction type is matched with the emergency operation and maintenance instruction type, and it is determined whether the request instruction is an allowed instruction. If it is an allowed instruction, the request instruction is processed; if it is not an allowed instruction, a connection closing prompt message is generated and returned to the client. The connection closing prompt message is used to prompt the user that the management connection does not support this instruction, and then the connection is closed.
[0140] The database over-limit connection control method in the above embodiment proposes a management connection reservation mechanism and adds a special management connection to ensure that even when the service reaches the maximum connection limit, the health check and monitoring requests from the management side can still be successfully executed. In the emergency situation of connection over-limit, it provides a way for operation and maintenance personnel to intervene and perform key operation and maintenance operations such as dynamically adjusting connection parameters and clearing invalid sessions to restore system performance. When the connection exceeds the limit, the idle connection is cleared forcibly to effectively release the occupied resources. At the same time, the configuration switch of the management connection function and the detailed parameter setting are introduced to achieve more accurate resource control and optimization.
[0141] In some embodiments, the database server also has statistical information and log recording functions, and can integrate management connection information into info output, including the number of management connections, the number of connections in a blocked state, etc., to facilitate monitoring, collecting data and displaying them. At the same time, error information such as connection rejection and unsupported instructions will be logged to facilitate log collection.
[0142] The above embodiment integrates statistical information into the INFO command output of Redis and increases error information output, so that the operation and maintenance team can quickly locate and solve potential problems.
[0143] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0144] Based on the same inventive concept, the embodiment of the present application also provides a database over-limit connection control device for implementing the above-mentioned database over-limit connection control method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more database over-limit connection control device embodiments provided below can refer to the limitations of the database over-limit connection control method above, and will not be repeated here.
[0145] In some embodiments, Figure 8 As shown, a database over-limit connection control device 800 is provided, comprising: a request receiving module 801, a configuration information acquisition module 802, a condition judgment module 803 and a management connection module 804, wherein:
[0146] The request receiving module 801 is used to receive a connection request sent by a user to a database and obtain the number of client connections to the database.
[0147] The configuration information acquisition module 802 is used to acquire the configuration information of the database when the number of client connections exceeds a preset number threshold.
[0148] The condition determination module 803 is used to determine whether the conditions for establishing a management connection are met between the user and the database based on the configuration information and the user identifier carried in the connection request.
[0149] The management connection module 804 is used to create a management terminal corresponding to the user in the database if the management connection creation conditions are met between the user and the database. The management terminal is used to control the database to perform emergency operation and maintenance operations.
[0150] In some embodiments, the condition judgment module 803 is used to: extract the management connection configuration information and management user identifier of the database from the configuration information; determine that the connection request is a management request when the user identifier carried in the connection request matches the management user identifier; determine whether the database meets the request receiving condition of the management request based on the management connection configuration information; if the database meets the request receiving condition, determine that the management connection creation condition is met between the user and the database.
[0151] In some embodiments, the management connection configuration information includes the over-limit management enabling state of the database and the management connection quantity threshold. The condition judgment module 803 is used to: when the over-limit management enabling state of the database is enabled, obtain the management connection quantity of the database; if the management connection quantity is less than the management connection quantity threshold, determine that the database meets the request receiving condition of the management request.
[0152] In some embodiments, the database over-limit connection control device further includes:
[0153] The connection request quantity acquisition module is used to obtain the number of connection requests received by the database within a preset time period.
[0154] The target cleaning duration determination module is used to determine a target cleaning duration that matches the number of connection requests based on the number of connection requests and a preset correspondence between the number of requests and the cleaning duration.
[0155] The duration update module is used to update the idle connection cleaning duration pre-configured in the database based on the target cleaning duration to obtain the updated idle connection cleaning duration.
[0156] The asynchronous cleanup module is used to control the database to asynchronously clean up idle connections according to the updated idle connection cleanup duration.
[0157] In some embodiments, the database over-limit connection control device further includes:
[0158] The instruction type determination module is used to receive the request instruction sent by the management end and determine the instruction type of the request instruction.
[0159] The connection closing module is used to close the connection between the management end and the database when the instruction type fails to match the emergency operation and maintenance instruction type.
[0160] The prompt module is used to generate and display connection closing prompt information according to the instruction type. The connection closing prompt information is used to prompt the user that the management connection does not support the instruction type.
[0161] In some embodiments, the database over-limit connection control device further includes:
[0162] The management connection parameter configuration module is used to respond to the management connection parameter configuration operation for the configuration file of the database and add the over-limit management enabling state of the database and the management connection quantity threshold in the configuration file.
[0163] The management user identification parameter configuration module is used to add the management user identification of the management user in the configuration file in response to the management user identification parameter configuration operation on the configuration file.
[0164] The instruction range configuration module is used to configure at least one emergency operation and maintenance instruction type in the instruction range of the management end in response to the instruction range configuration operation for the management end.
[0165] Each module in the above-mentioned database over-limit connection control device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0166] In some embodiments, a computer device is provided. The computer device may be a server integrated with a database server. The internal structure diagram thereof may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as connection requests, the number of client connections, a preset number threshold, configuration information, and management connection creation conditions. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a database over-limit connection control method is implemented.
[0167] Those skilled in the art will understand that Fig. 9The 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.
[0168] In some embodiments, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0169] Receive connection requests sent by users to the database and obtain the number of client connections to the database;
[0170] When the number of client connections exceeds a preset number threshold, obtaining configuration information of the database;
[0171] Based on the configuration information and the user identifier carried in the connection request, determine whether the conditions for creating a management connection are met between the user and the database;
[0172] If the conditions for creating a management connection are met between the user and the database, a management terminal corresponding to the user is created in the database. The management terminal is used to control the database to perform emergency operation and maintenance operations.
[0173] In some embodiments, when the processor executes the computer program, the processor further implements the following steps:
[0174] Extracting database management connection configuration information and management user ID from the configuration information;
[0175] In a case where the user identifier carried in the connection request matches the management user identifier, determining that the connection request is a management request;
[0176] Determining, based on the management connection configuration information, whether the database satisfies a request receiving condition of the management request;
[0177] If the database meets the request receiving condition, it is determined that the management connection creation condition is met between the user and the database.
[0178] In some embodiments, when the processor executes the computer program, the processor further implements the following steps:
[0179] When the over-limit management enabling state of the database is enabled, obtain the number of management connections of the database;
[0180] If the number of management connections is less than the management connection number threshold, it is determined that the database meets the request receiving condition of the management request.
[0181] In some embodiments, when the processor executes the computer program, the processor further implements the following steps:
[0182] Get the number of connection requests received by the database within a preset period of time;
[0183] Determine a target cleaning duration that matches the number of connection requests based on the number of connection requests and a preset correspondence between the number of requests and the cleaning duration;
[0184] Based on the target cleaning time, the idle connection cleaning time pre-configured in the database is updated to obtain an updated idle connection cleaning time;
[0185] The database is controlled to asynchronously clean up idle connections according to the updated idle connection cleanup duration.
[0186] In some embodiments, when the processor executes the computer program, the processor further implements the following steps:
[0187] Receive the request instruction sent by the management end, and determine the instruction type of the request instruction;
[0188] If the command type fails to match the emergency operation and maintenance command type, the connection between the management end and the database is closed;
[0189] Generate and display a connection closing prompt message according to the instruction type. The connection closing prompt message is used to prompt the user that the management connection does not support the instruction type.
[0190] In some embodiments, when the processor executes the computer program, the processor further implements the following steps:
[0191] In response to a management connection parameter configuration operation for a configuration file of a database, an over-limit management enabling state of the database and a management connection quantity threshold are added to the configuration file;
[0192] In response to the management user identification parameter configuration operation for the configuration file, adding the management user identification of the management user in the configuration file;
[0193] In response to the instruction range configuration operation for the management end, at least one emergency operation and maintenance instruction type is configured in the instruction range of the management end.
[0194] In some embodiments, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0195] Receive connection requests sent by users to the database and obtain the number of client connections to the database;
[0196] When the number of client connections exceeds a preset number threshold, obtaining configuration information of the database;
[0197] Based on the configuration information and the user identifier carried in the connection request, determine whether the conditions for creating a management connection are met between the user and the database;
[0198] If the conditions for creating a management connection are met between the user and the database, a management terminal corresponding to the user is created in the database. The management terminal is used to control the database to perform emergency operation and maintenance operations.
[0199] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0200] Extracting database management connection configuration information and management user ID from the configuration information;
[0201] In a case where the user identifier carried in the connection request matches the management user identifier, determining that the connection request is a management request;
[0202] Determining, based on the management connection configuration information, whether the database satisfies a request receiving condition of the management request;
[0203] If the database meets the request receiving condition, it is determined that the management connection creation condition is met between the user and the database.
[0204] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0205] When the over-limit management enabling state of the database is enabled, obtain the number of management connections of the database;
[0206] If the number of management connections is less than the management connection number threshold, it is determined that the database meets the request receiving condition of the management request.
[0207] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0208] Get the number of connection requests received by the database within a preset period of time;
[0209] Determine a target cleaning duration that matches the number of connection requests based on the number of connection requests and a preset correspondence between the number of requests and the cleaning duration;
[0210] Based on the target cleaning time, the idle connection cleaning time pre-configured in the database is updated to obtain an updated idle connection cleaning time;
[0211] The database is controlled to asynchronously clean up idle connections according to the updated idle connection cleanup duration.
[0212] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0213] Receive the request instruction sent by the management end, and determine the instruction type of the request instruction;
[0214] If the command type fails to match the emergency operation and maintenance command type, the connection between the management end and the database is closed;
[0215] Generate and display a connection closing prompt message according to the instruction type. The connection closing prompt message is used to prompt the user that the management connection does not support the instruction type.
[0216] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0217] In response to a management connection parameter configuration operation for a configuration file of a database, an over-limit management enabling state of the database and a management connection quantity threshold are added to the configuration file;
[0218] In response to the management user identification parameter configuration operation for the configuration file, adding the management user identification of the management user in the configuration file;
[0219] In response to the instruction range configuration operation for the management end, at least one emergency operation and maintenance instruction type is configured in the instruction range of the management end.
[0220] In some embodiments, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0221] Receive connection requests sent by users to the database and obtain the number of client connections to the database;
[0222] When the number of client connections exceeds a preset number threshold, obtaining configuration information of the database;
[0223] Based on the configuration information and the user identifier carried in the connection request, determine whether the conditions for creating a management connection are met between the user and the database;
[0224] If the conditions for creating a management connection are met between the user and the database, a management terminal corresponding to the user is created in the database. The management terminal is used to control the database to perform emergency operation and maintenance operations.
[0225] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0226] Extracting database management connection configuration information and management user ID from the configuration information;
[0227] In a case where the user identifier carried in the connection request matches the management user identifier, determining that the connection request is a management request;
[0228] Determining, based on the management connection configuration information, whether the database satisfies a request receiving condition of the management request;
[0229] If the database meets the request receiving condition, it is determined that the management connection creation condition is met between the user and the database.
[0230] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0231] When the over-limit management enabling state of the database is enabled, obtain the number of management connections of the database;
[0232] If the number of management connections is less than the management connection number threshold, it is determined that the database meets the request receiving condition of the management request.
[0233] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0234] Get the number of connection requests received by the database within a preset period of time;
[0235] Determine a target cleaning duration that matches the number of connection requests based on the number of connection requests and a preset correspondence between the number of requests and the cleaning duration;
[0236] Based on the target cleaning time, the idle connection cleaning time pre-configured in the database is updated to obtain an updated idle connection cleaning time;
[0237] The database is controlled to asynchronously clean up idle connections according to the updated idle connection cleanup duration.
[0238] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0239] Receive the request instruction sent by the management end, and determine the instruction type of the request instruction;
[0240] If the command type fails to match the emergency operation and maintenance command type, the connection between the management end and the database is closed;
[0241] Generate and display a connection closing prompt message according to the instruction type. The connection closing prompt message is used to prompt the user that the management connection does not support the instruction type.
[0242] In some embodiments, when the computer program is executed by the processor, the following steps are also implemented:
[0243] In response to a management connection parameter configuration operation for a configuration file of a database, an over-limit management enabling state of the database and a management connection quantity threshold are added to the configuration file;
[0244] In response to the management user identification parameter configuration operation for the configuration file, adding the management user identification of the management user in the configuration file;
[0245] In response to the instruction range configuration operation for the management end, at least one emergency operation and maintenance instruction type is configured in the instruction range of the management end.
[0246] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. In addition, the acquisition, storage, processing, and transmission of data are in compliance with relevant laws and regulations.
[0247] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0248] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0249] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for controlling excessive database connections, characterized in that: The method comprises: Receive a connection request from a user to a database, and obtain the number of client connections to the database; When the number of client connections exceeds a preset number threshold, obtaining configuration information of the database; Based on the configuration information and the user identifier carried in the connection request, determining whether a management connection creation condition is met between the user and the database; If the management connection creation condition is met between the user and the database, a management terminal corresponding to the user is created in the database, and the management terminal is used to control the database to perform emergency operation and maintenance operations.
2. The method according to claim 1, characterized in that The determining, based on the configuration information and the user identifier carried in the connection request, whether a management connection creation condition is satisfied between the user and the database includes: Extracting database management connection configuration information and management user identification from the configuration information; In a case where the user identifier carried in the connection request matches the management user identifier, determining that the connection request is a management request; determining, according to the management connection configuration information, whether the database satisfies a request receiving condition of the management request; If the database satisfies the request receiving condition, it is determined that a management connection creation condition is satisfied between the user and the database.
3. The method according to claim 2, characterized in that The management connection configuration information includes the over-limit management enabling state of the database and the management connection quantity threshold; The determining, according to the management connection configuration information, whether the database satisfies a request receiving condition of the management request comprises: When the over-limit management enabling state of the database is enabled, obtaining the number of management connections of the database; If the number of management connections is less than the management connection number threshold, it is determined that the database meets the request receiving condition of the management request.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Obtaining the number of connection requests received by the database within a preset time period; Determine a target cleaning duration that matches the number of connection requests according to the number of connection requests and a preset correspondence between the number of requests and the cleaning duration; Based on the target cleaning duration, the idle connection cleaning duration preconfigured in the database is updated to obtain an updated idle connection cleaning duration; The database is controlled to asynchronously clean up idle connections according to the updated idle connection cleaning duration.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Receiving a request instruction sent by the management terminal, and determining an instruction type of the request instruction; If the instruction type fails to match the emergency operation and maintenance instruction type, closing the connection between the management terminal and the database; A connection closing prompt message is generated and displayed according to the instruction type, and the connection closing prompt message is used to prompt the user that the management connection does not support the instruction type.
6. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In response to a management connection parameter configuration operation for a configuration file of a database, adding an over-limit management enabling state and a management connection quantity threshold of the database to the configuration file; In response to a configuration operation of a management user identification parameter for the configuration file, adding a management user identification of the management user to the configuration file; In response to the instruction range configuration operation for the management end, at least one emergency operation and maintenance instruction type is configured in the instruction range of the management end.
7. A database over-limit connection control device, characterized in that: The device comprises: A request receiving module, used to receive a connection request sent by a user to a database, and obtain the number of client connections to the database; A configuration information acquisition module, used to acquire the configuration information of the database when the number of client connections exceeds a preset number threshold; A condition judgment module, used to determine whether a management connection creation condition is met between the user and the database based on the configuration information and the user identifier carried in the connection request; A management connection module is used to create a management terminal corresponding to the user in the database if the management connection creation condition is met between the user and the database, and the management terminal is used to control the database to perform emergency operation and maintenance operations.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.