Database access method, device, equipment and medium
By migrating the routing middleware to the database node cluster, the problem of low database access efficiency in the existing technology is solved, and more efficient database access is achieved.
Patent Information
- Application Number
- CN202211062499.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-09-01
AI Technical Summary
In the prior art, when an application accesses a MySQL database through a routing middleware, the access efficiency is low and the resources of the database node cluster cannot be effectively utilized.
Migrate the target routing middleware from the terminal device to the database node cluster, and select the target node through the target routing middleware in the node cluster to process the access request, shortening the communication link.
It improves the efficiency of database access, optimizes the node selection process, and reduces access delays and waiting time.
Smart Images

Figure CN115460201B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technologies, and in particular to a database access method, apparatus, device, and medium. Background Art
[0002] MySQL (My Structured Query Language) is one of the most popular databases. When using a MySQL database, an application obtains data from the database node through a routing middleware.
[0003] Currently, routing middleware is typically deployed on the application side, with different applications corresponding to different routing middleware. When an application accesses a database, it sends the access request to the corresponding routing middleware, which then forwards the received access request to the database node for processing, resulting in low database access efficiency. Summary of the Invention
[0004] The present application provides a database access method, apparatus, device and medium to improve database access efficiency.
[0005] In a first aspect, an embodiment of the present application provides a database access method, applied to a terminal device, comprising:
[0006] generating an access request in response to an access operation on a database;
[0007] An access request is sent to a target routing middleware deployed in a node cluster of the database, so that the target routing middleware selects a target node from the node cluster to process the access request.
[0008] In a second aspect, an embodiment of the present application further provides a database access method applicable to a request distribution device, comprising:
[0009] Receiving a request for accessing a database sent by a terminal device;
[0010] Select the target routing middleware from the routing middleware deployed in the node cluster of the database;
[0011] An access request is sent to the target routing middleware, so that the target routing middleware selects a target node from the database node cluster to process the access request.
[0012] In a third aspect, an embodiment of the present application further provides a database access device, applied to a terminal device, comprising:
[0013] An access request generating module, configured to generate an access request in response to an access operation on a database;
[0014] The access request sending module is used to send an access request to a target routing middleware deployed in a node cluster of the database, so that the target routing middleware selects a target node from the node cluster to process the access request.
[0015] In a fourth aspect, an embodiment of the present application further provides a database access device, which is applied to a request distribution device, comprising:
[0016] An access request receiving module, configured to receive an access request to a database sent by a terminal device;
[0017] The target routing middleware selection module is used to select the target routing middleware from the routing middlewares deployed in the node cluster of the database;
[0018] The access request sending module is used to send an access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request.
[0019] In a fifth aspect, an embodiment of the present application further provides an electronic device, including:
[0020] one or more processors;
[0021] a memory for storing one or more programs;
[0022] When one or more programs are executed by one or more processors, the one or more processors implement a database access method provided by the first aspect and / or the second aspect embodiments.
[0023] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a database access method as provided in the embodiments of the first aspect and / or the second aspect.
[0024] In an embodiment of the present application, an access request is generated in response to a database access operation; the access request is sent to a target routing middleware deployed in the database's node cluster, causing the target routing middleware to select a target node from the node cluster to process the access request. Using this technical solution, the target routing middleware is migrated from the terminal hosting the database access application to the database's node cluster, shortening the communication link between the target routing middleware and the database and improving database access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a flowchart of a database access method in Example 1 of the present application;
[0026] Figure 2 This is a flowchart of a database access method in Example 2 of the present application;
[0027] Figure 3 This is a flowchart of a database access method in Example 3 of the present application;
[0028] Figure 4A This is a flowchart of a database access method in Example 4 of the present application;
[0029] Figure 4B This is a schematic diagram of a database access in Example 5 of the present application;
[0030] Figure 5 This is a structural diagram of a database access device in Example 5 of the present application;
[0031] Figure 6 This is a structural diagram of a database access device in Example 6 of the present application;
[0032] Figure 7 This is a structural diagram of an electronic device in Example 7 of the present application. DETAILED DESCRIPTION
[0033] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present application and are not intended to limit the present application. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions of the present application, not all of the structures.
[0034] Example 1
[0035] Figure 1 This is a flowchart of a database access method in Example 1 of the present application. This embodiment is applicable to accessing data in a database. The method can be performed by a database access device, which is implemented by software and / or hardware and is specifically configured in an electronic device. Specifically, the electronic device can be a terminal device.
[0036] like Figure 1 The database access method shown is executed by a terminal device and includes:
[0037] S101: Generate an access request in response to an access operation on a database.
[0038] The database may be a data warehouse consisting of at least one database node that is communicatively connected to a terminal device. A database node is a node in a database node cluster that is used to store data and respond to access requests. It should be noted that the database may be any database in the prior art, and this application does not limit this. For example, the database may be a MySQL database or an InfluxDB (Influx DataBase) database.
[0039] The access request may be used to instruct access to corresponding data in the database. Each time a database access operation is responded to, an access request corresponding to the access operation is generated.
[0040] Optionally, the access request may include an access field for locating the data to be accessed in the database. There may be at least one access field, and the access field may include at least one type. This application does not impose any restrictions on the number of access fields and / or the specific number of field types. Optionally, the field type may correspond to various attributes of the data.
[0041] For example, if the data stored in the database is a student's test scores, the field type may include at least one of the student's ID number, the student's name, the student's class, and the test subject.
[0042] S102: Send an access request to a target routing middleware deployed in a node cluster of a database, so that the target routing middleware selects a target node from the node cluster to process the access request.
[0043] The database node cluster may be a cluster composed of database nodes, wherein the number of database nodes is at least one, and usually multiple. The data stored in each database node in a single database cluster is the same.
[0044] Routing middleware is software that transfers data between terminal devices and database nodes. Target routing middleware is software that receives access requests and dispatches them to the target node. The target node can be the database node that processes the access request.
[0045] Optionally, the target node can be determined according to a corresponding node selection algorithm. This application does not limit the node selection algorithm. For example, the node selection algorithm can be a load balancing algorithm or a random algorithm.
[0046] In an optional embodiment, the target routing middleware may determine a database node with a smaller load among the database nodes according to a load balancing algorithm, establish a connection with the database node, and then send the access request to the corresponding database node.
[0047] In another optional embodiment, the target routing middleware may determine a database node according to a random algorithm, establish a connection with the database node, and then send the access request to the corresponding database node.
[0048] Optionally, an access request is sent to the request distribution device, so that the request distribution device selects a target routing middleware from each routing middleware deployed in the node cluster of the database, and sends the access request to the target routing middleware.
[0049] The request dispatching device may be a device that is in communication with the terminal device and the routing middleware, and includes identification information of each routing middleware, for selecting a target routing middleware from among the routing middleware to forward the access request. The target routing middleware may be selected based on the load of each routing middleware.
[0050] The above technical solution can select a target routing middleware with a lower load among various routing middlewares, thereby improving the efficiency of the target routing middleware in processing access requests, thereby improving the efficiency of accessing database data.
[0051] In an embodiment of the present application, an access request is generated in response to a database access operation; the access request is sent to a target routing middleware deployed in the database's node cluster, causing the target routing middleware to select a target node from the node cluster to process the access request. Using this technical solution, the target routing middleware is migrated from the terminal hosting the database access application to the database's node cluster, shortening the communication link between the target routing middleware and the database and improving database access efficiency.
[0052] Example 2
[0053] Figure 2 This is a flowchart of a database access method in Example 2 of the present application. This embodiment is applicable to situations where a database is accessed. The method can be executed by a database access device, which is implemented by software and / or hardware and is specifically configured in a request distribution device.
[0054] It should be noted that for the parts not described in detail in the embodiments of the present application, reference can be made to the description of the aforementioned embodiments.
[0055] like Figure 2 The database access method shown is executed by the request distribution device and includes:
[0056] S201: Receive a database access request sent by a terminal device.
[0057] The database can be a data warehouse consisting of at least one database node that is communicatively connected to the terminal device. A database node is a node in the database's corresponding node cluster that is used to store data and respond to access requests. It should be noted that the database can be any database known in the art and is not limited in this application. For example, the database can be a MySQL database or an InfluxDB database.
[0058] The access request may be used to instruct access to corresponding data in the database. Each time a database access operation is responded to, an access request corresponding to the access operation is generated.
[0059] Optionally, the access request may include an access field for locating the data to be accessed in the database. There may be at least one access field, and the access field may include at least one type. This application does not impose any restrictions on the number of access fields and / or the specific number of field types. Optionally, the field type may correspond to various attributes of the data.
[0060] For example, if the data stored in the database is a student's test scores, the field type may include at least one of the student's ID number, the student's name, the student's class, and the test subject.
[0061] S202: Select a target routing middleware from each routing middleware deployed in the node cluster of the database.
[0062] The database node cluster may be a cluster composed of database nodes, wherein the number of database nodes is at least one, and usually multiple. The data stored in each database node in a single database cluster is the same.
[0063] Routing middleware is software that transfers data between terminal devices and database nodes. Target routing middleware is software that receives access requests and dispatches them to the target node. The target node can be the database node that processes the access request.
[0064] The target routing middleware may be determined based on the load conditions of each routing middleware.
[0065] S203: Send an access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request.
[0066] Optionally, the target node can be determined according to a corresponding node selection algorithm. This application does not limit the node selection algorithm. For example, the node selection algorithm can be a load balancing algorithm or a random algorithm.
[0067] In an optional embodiment, the target routing middleware may determine a database node with a smaller load among the database nodes according to a load balancing algorithm, establish a connection with the database node, and then send the access request to the corresponding database node.
[0068] In another optional embodiment, the target routing middleware may determine a database node according to a random algorithm, establish a connection with the database node, and then send the access request to the corresponding database node.
[0069] The embodiment of the present application receives a database access request sent by a terminal device; selects a target routing middleware from each routing middleware deployed in the database's node cluster; and sends the access request to the target routing middleware, causing the target routing middleware to select a target node from the database's node cluster to process the access request. Using this technical solution, the target routing middleware is migrated from the terminal side hosting the database access application to the database's node cluster, shortening the communication link between the target routing middleware and the database, thereby improving the efficiency of database access.
[0070] Example 3
[0071] Figure 3 This is a flowchart of a database access method in Example 3 of the present application. Based on the above embodiments, this embodiment optimizes and improves the selection operation of the target routing middleware.
[0072] It should be noted that for the parts not described in detail in the embodiments of the present application, reference can be made to the description of the aforementioned embodiments.
[0073] Furthermore, "selecting target routing middleware from each routing middleware deployed in the node cluster of the database" is refined into "selecting available routing middleware from each routing middleware deployed in the node cluster of the database; selecting target routing middleware from available routing middleware" to improve the selection mechanism of target routing middleware.
[0074] like Figure 3 The database access methods shown include:
[0075] S301: Receive a database access request sent by a terminal device.
[0076] S302: Select available routing middleware from various routing middlewares deployed in the node cluster of the database.
[0077] Among them, the available routing middleware can be understood as a routing middleware that can respond to external access requests and forward access requests. Some routing middleware may be unable to respond to access requests due to factors such as excessive load or failure. At this time, if an access request is still sent to it, the terminal device will take too long to access the database data or will be unable to access the database data, affecting the efficiency of database access. Therefore, a liveness request can be sent to each routing middleware deployed in the node cluster of the database. Among them, the liveness request is used to request the routing middleware to feedback information on whether it is alive to the request distribution device, so as to verify whether each routing middleware has the ability to respond to the request.
[0078] For example, if the request dispatching device receives feedback information from a routing middleware, it is considered that the routing middleware can respond to the liveness request and has the ability to respond to the request. In this case, the request dispatching device can use the routing middleware as an available routing middleware.
[0079] For example, if the request dispatching device does not receive feedback from a routing middleware, the routing middleware is deemed unavailable and identified as abnormal. The abnormal routing middleware can be marked and an abnormality alert generated based on the abnormal routing middleware to instruct relevant technical personnel to promptly troubleshoot and resolve the abnormality.
[0080] Optionally, a liveness check request can be sent to each routing middleware at regular intervals to determine in real time whether the routing middleware can respond to the liveness check request, thereby preventing the available routing middleware from being unable to respond to access requests in subsequent processes. The interval can be independently set by the relevant technical personnel based on experience or actual needs, and this application does not impose any restrictions on this.
[0081] By adopting this method, a live request is sent to each routing middleware, which can exclude routing middleware that cannot transmit data, determine the available routing middleware, and improve the efficiency of selecting the target routing middleware.
[0082] S303: Select target routing middleware from available routing middleware.
[0083] In an optional embodiment, if there is only one available routing middleware, the available routing middleware is used as the target routing middleware.
[0084] In another optional embodiment, if there are at least two available routing middlewares, the distribution priority of the corresponding available routing middlewares can be determined based on the request distribution status of each available routing middleware. According to the distribution priority, the target routing middleware is selected from the available routing middlewares.
[0085] Optionally, the request distribution can be determined based on the request load of the corresponding available routing middleware. The request load can be the number of requests processed by the available routing middleware. The distribution priority can be used to represent the level at which each routing middleware processes the corresponding access request.
[0086] Exemplarily, the request distribution situation can be determined based on the current request load of the corresponding available routing middleware. The current request load of each available routing middleware is determined, and the distribution priority of the available routing middleware with the lower current load is determined to be high priority, and the high-priority available routing middleware is used as the target routing middleware.
[0087] Exemplarily, the request distribution situation can be determined based on the historical request load of the corresponding available routing middleware. The historical request load of each available routing middleware is determined, and the distribution priority of the available routing middleware with a lower historical load is determined to be a high priority, and the high-priority available routing middleware is used as the target routing middleware.
[0088] By adopting this method, a target routing middleware with a lower request load can be selected from the available routing middleware, which shortens the waiting processing time of the access request in the routing middleware and thus improves the efficiency of accessing the database.
[0089] S304: Send an access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request.
[0090] The embodiment of the present application selects available routing middleware from various routing middlewares deployed in the node cluster of the database, and selects target routing middleware from the available routing middleware, so that the selected target routing middleware has the ability to respond to access requests and can process access requests as quickly as possible, thereby improving the efficiency of accessing the database.
[0091] Example 4
[0092] Figure 4A This is a flowchart of a database access method provided in Example 4 of the present application. This example of the present application provides a preferred implementation method based on the technical solutions in the above-mentioned embodiments.
[0093] The embodiments of this application will be combined with Figure 4B The database access system framework diagram shown in the figure provides a detailed explanation of the database access method.
[0094] like Figure 4A A database access method shown includes:
[0095] S401: The terminal device generates an access request in response to an access operation to a database.
[0096] See also Figure 4B , where the device where the APP (Application) is installed is the terminal device.
[0097] S402: The terminal device sends an access request to the request distribution device.
[0098] S403: The request distribution device generates a liveness detection request in real time or periodically.
[0099] See also Figure 4B , where the smart DNS (Domain Name System) is the request distribution device in this application.
[0100] S404: The request distribution device sends a liveness request to each routing middleware in the database node cluster.
[0101] See also Figure 4B MySQL MGR (My Structured Query Language Group Replication) cluster is a database node cluster.
[0102] (DataBase, database) node is the node in the database cluster used to respond to access requests, and router is the routing middleware.
[0103] S405: The available routing middleware in the database generates feedback information in response to the liveness detection request.
[0104] S406: The routing middleware may send feedback information to the request distribution device.
[0105] S407: The request distribution device selects a routing middleware from available routing middleware.
[0106] S408: The request distribution device sends an access request to the target routing middleware.
[0107] S409: The target routing middleware in the database selects a target node from the database node cluster and processes the access request.
[0108] The embodiment of the present application uses the above technical solution to eliminate unresponsive routing middleware, select target routing middleware from available routing middleware, shorten the waiting processing time of access requests in the routing middleware, and improve the efficiency of selecting the target routing middleware; shorten the communication link between the target routing middleware and the database, and improve the efficiency of accessing the database.
[0109] Example 5
[0110] Figure 5 The figure shows a structure diagram of a database access device in the fifth embodiment of the present application. This embodiment is applicable to the case of accessing a database. The device is implemented using software and / or hardware and is specifically configured in an electronic device. Specifically, the electronic device can be a terminal device.
[0111] like Figure 5 The database access device shown in FIG. 5 includes an access request creation module 501 and an access request sending module 502.
[0112] An access request generating module 501 is configured to generate an access request in response to an access operation to a database;
[0113] The access request sending module 502 is used to send an access request to a target routing middleware deployed in a node cluster of the database, so that the target routing middleware selects a target node from the node cluster to process the access request.
[0114] In an embodiment of the present application, an access request generation module generates an access request in response to a database access operation. An access request sending module sends the access request to a target routing middleware deployed in the database's node cluster, causing the target routing middleware to select a target node from the node cluster to process the access request. This technical solution migrates the target routing middleware from the terminal hosting the database access application to the database's node cluster, shortening the communication link between the target routing middleware and the database and improving database access efficiency.
[0115] In an optional embodiment, the access request sending module 501 includes:
[0116] The access request sending unit is used to send an access request to the request distribution device, so that the request distribution device selects a target routing middleware from each routing middleware deployed in the node cluster of the database and sends the access request to the target routing middleware.
[0117] The above-mentioned database access device can execute the database access method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing each database access method.
[0118] Example 6
[0119] Figure 6 This is a structural diagram of a database access device provided in Example 6 of the present application. This embodiment is applicable to the case of accessing a database, and the device is implemented using software and / or hardware and is specifically configured in a request distribution device.
[0120] like Figure 6 The database access device shown in FIG. 6 includes an access request receiving module 601, a target routing middleware selecting module 602, and an access request sending module 603.
[0121] The access request receiving module 601 is used to receive a database access request sent by a terminal device;
[0122] The target routing middleware selection module 602 is used to select a target routing middleware from each routing middleware deployed in the node cluster of the database;
[0123] The access request sending module 603 is used to send an access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request.
[0124] In the embodiment of the present application, an access request receiving module receives an access request to a database sent by a terminal device; and a target routing middleware is selected from each routing middleware deployed in a node cluster of the database through a target routing middleware selection module. An access request is sent to the target routing middleware through an access request sending module, so that the target routing middleware selects a target node from the node cluster of the database to process the access request. By adopting the above technical solution, the target routing middleware is migrated from the terminal side carrying the database access application to the node cluster of the database, which can shorten the communication link between the target routing middleware and the database and improve the efficiency of accessing the database.
[0125] In an optional embodiment, the target routing middleware selection module 603 includes:
[0126] An available routing middleware selection unit, used to select available routing middleware from various routing middlewares deployed in the node cluster of the database;
[0127] The target routing middleware selection unit is used to select the target routing middleware from the available routing middleware.
[0128] In an optional embodiment, the available routing middleware selection unit includes:
[0129] A liveness detection request sending subunit is used to send liveness detection requests to each routing middleware deployed in the node cluster of the database;
[0130] The available routing middleware determining subunit is configured to use the routing middleware that has received the feedback information of the liveness detection request as the available routing middleware.
[0131] In an optional embodiment, if the number of available routing middlewares is at least two, the target routing middleware selection unit includes:
[0132] The distribution priority determination subunit is used to determine the distribution priority of the corresponding available routing middleware according to the request distribution status of each available routing middleware;
[0133] The target routing middleware selection subunit is used to select the target routing middleware from the available routing middlewares according to the distribution priority.
[0134] The above-mentioned database access device can execute the database access method provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing each database access method.
[0135] Example 7
[0136] Figure 7This is a block diagram of an electronic device in Example 5 of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0137] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0138] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0139] The computing unit 701 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as the database access method. For example, in some embodiments, the database access method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the database access method described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the database access method by any other appropriate means (e.g., by means of firmware).
[0140] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0142] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0144] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0145] A computer system may include a client and a server. The client and server are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services. The server may also be a server in a distributed system or a server integrated with blockchain.
[0146] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved. This is not limited herein.
[0147] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A database access method, characterized in that: Applied to terminal equipment, including: generating an access request in response to an access operation on a database; Sending the access request to a target routing middleware deployed in a node cluster of the database, so that the target routing middleware selects a target node from the node cluster to process the access request; The step of sending the access request to a target routing middleware deployed in a node cluster of the database includes: Sending the access request to a request distribution device, so that the request distribution device selects a target routing middleware from each routing middleware deployed in the node cluster of the database, and sends the access request to the target routing middleware; The process of the request distribution device selecting a target routing middleware from each routing middleware deployed in the node cluster of the database is as follows: Sending a liveness request to each routing middleware deployed in the node cluster of the database; The routing middleware that receives the feedback information of the live detection request is used as the available routing middleware; The liveness detection request is sent to each routing middleware at a certain interval to determine in real time whether the routing middleware can respond to the liveness detection request; Select the target routing middleware from the available routing middleware; If the number of the available routing middleware is at least two, selecting the target routing middleware from the available routing middleware includes: Determine the distribution priority of the corresponding available routing middleware based on the request distribution status of each available routing middleware; Selecting the target routing middleware from the available routing middlewares according to the distribution priority; The request distribution device is a device that is in communication with the terminal device and the routing middleware, and the request distribution device includes an intelligent domain name system.
2. A database access method, characterized in that: Applicable to request distribution equipment, including: Receiving a request for accessing a database sent by a terminal device; Sending a liveness request to each routing middleware deployed in the node cluster of the database; The routing middleware that receives the feedback information of the live detection request is used as the available routing middleware; The liveness detection request is sent to each routing middleware at a certain interval to determine in real time whether the routing middleware can respond to the liveness detection request; Select a target routing middleware from the available routing middlewares; If the number of the available routing middleware is at least two, selecting the target routing middleware from the available routing middleware includes: Determine the distribution priority of the corresponding available routing middleware based on the request distribution status of each available routing middleware; Selecting the target routing middleware from the available routing middlewares according to the distribution priority; Sending the access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request; The request distribution device is a device that is in communication with the terminal device and the routing middleware, and the request distribution device includes an intelligent domain name system.
3. A database access device, characterized in that: Applied to terminal equipment, including: An access request generating module, configured to generate an access request in response to an access operation on a database; An access request sending module, configured to send the access request to a target routing middleware deployed in a node cluster of the database, so that the target routing middleware selects a target node from the node cluster to process the access request; The access request sending module includes: an access request sending unit, configured to send the access request to a request distribution device, so that the request distribution device selects a target routing middleware from each routing middleware deployed in a node cluster of the database, and sends the access request to the target routing middleware; The access request sending unit is specifically configured to: Sending a liveness request to each routing middleware deployed in the node cluster of the database; The routing middleware that receives the feedback information of the live detection request is used as the available routing middleware; The liveness detection request is sent to each routing middleware at a certain interval to determine in real time whether the routing middleware can respond to the liveness detection request; Select the target routing middleware from the available routing middleware; If the number of the available routing middleware is at least two, selecting the target routing middleware from the available routing middleware includes: Determine the distribution priority of the corresponding available routing middleware based on the request distribution status of each available routing middleware; Selecting the target routing middleware from the available routing middlewares according to the distribution priority; The request distribution device is a device that is in communication with the terminal device and the routing middleware, and the request distribution device includes an intelligent domain name system.
4. A database access device, characterized in that: Applicable to request distribution equipment, including: An access request receiving module, configured to receive an access request to a database sent by a terminal device; A target routing middleware selection module is used to select a target routing middleware from each routing middleware deployed in the node cluster of the database; An access request sending module, configured to send the access request to the target routing middleware, so that the target routing middleware selects a target node from the node cluster of the database to process the access request; The target routing middleware selection module includes: An available routing middleware selection unit, used to select available routing middleware from various routing middlewares deployed in the node cluster of the database; A target routing middleware selection unit is used to select a target routing middleware from available routing middlewares; The available routing middleware selection unit includes: A liveness detection request sending subunit is used to send a liveness detection request to each routing middleware deployed in the node cluster of the database; wherein the liveness detection request is sent to each routing middleware once at a certain interval to determine in real time whether the routing middleware can respond to the liveness detection request; An available routing middleware determining subunit, configured to use the routing middleware that receives the feedback information of the live detection request as the available routing middleware; If the number of available routing middleware is at least two, the target routing middleware selection unit includes: The distribution priority determination subunit is used to determine the distribution priority of the corresponding available routing middleware according to the request distribution status of each available routing middleware; a target routing middleware selection subunit, configured to select the target routing middleware from the available routing middlewares according to the distribution priority; The request distribution device is a device that is in communication with the terminal device and the routing middleware, and the request distribution device includes an intelligent domain name system.
5. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the database access method according to claim 1 and / or the database access method according to claim 2.
6. A computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the database access method according to claim 1 and / or the database access method according to claim 2 are implemented.
Citation Information
Patent Citations
Service processing method, device and server for service supporting system
CN104735118A
Database access control method and device, database main system and electronic equipment
CN111783042A
High-availability client load balancing method based on database middleware cluster
CN113032431A