Database access method and apparatus, computing device and computer program product
By establishing communication and authentication mechanisms between the database access scheduling module and the service engine, the problem of sharing the database connection pool across different servers is solved, achieving load balancing and enhanced security, and reducing application load and the risk of exposing IP addresses.
Patent Information
- Application Number
- CN201910581051.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-29
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2039-06-29
AI Technical Summary
In existing technologies, database connection pools can only be used within a single application and cannot be shared between different servers. Furthermore, the database instance is exposed when a connection is established using an IP address and port number, which increases application load and security risks.
The database access scheduling module establishes a communication connection with an independent database access service engine, uses the service engine's identifier and public key for authentication, and enables access to the database instance. The service engine also establishes and manages connections, reducing application load and exposing IP addresses.
It enables cross-server load balancing and independent management of connection pools, reducing application load and security risks, and improving system flexibility and security.
Smart Images

Figure CN112149142B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of databases, and in particular to a database access method, a database access initiation module, a database access service engine, a database access scheduling module, a computing device, and a computer program product. BACKGROUND
[0002] In the prior art, a database connection pool is deployed inside an application. One database connection pool provides access to a database instance for one application.
[0003] In addition, a single application can be distributed and deployed on multiple servers. A database connection pool of the application is deployed on each server, and all connections in each database connection pool are used to connect to the same database instance. In other words, if the application needs to connect to multiple database instances through each server, a connection pool needs to be deployed for each database instance on each server. However, the database connection pools of a single application used to access the same database instance on different servers cannot be shared between different servers.
[0004] In addition, in the prior art, when a connection in a connection pool is established to access a database instance, the Internet Protocol (IP) address and port number of the database instance are used to establish the connection. SUMMARY
[0005] Therefore, the present application provides a database access method, a database access initiation module, a database access service engine, a computing device, and a computer program product, which avoid exposing the IP address and port of a database instance to establish a connection for accessing the database instance.
[0006] In a first aspect, in the database access method provided by the present application, a database access scheduling module establishes a communication connection with a database access service engine using an identifier (for example, an IP address) of the database access service engine. Subsequently, the database access scheduling module receives an access request sent by the database access service engine, and the access request carries an identifier of a database instance. The database access scheduling module sends the access request to the database instance.
[0007] In this way, based on the communication connection established by the database access scheduling module with the database access service engine, when the database access service engine receives an access request from an application, the database access service engine can send the access request to the database instance through the database access scheduling module.
[0008] In a possible design of the first aspect, when the database access scheduling module sends a request for establishing the communication connection to the database access service engine, the request carries an identifier of the database access service engine and a public key of the database access service engine. In this way, the database access engine can authenticate whether to agree to establish the communication connection with the database access scheduling module based on the public key of the database access service engine.
[0009] In a possible design of the first aspect, when the access request received by the database access scheduling module from the database access service engine is an access request encrypted based on a public key of the database access scheduling module, the database access scheduling module decrypts the encrypted access request to obtain an access request by using a private key of the database access scheduling module, and sends the decrypted access request to the database instance.
[0010] In a possible design of the first aspect, the database instance processes the access request and obtains a processing result, and sends the processing result to the database access scheduling module. The database access scheduling module receives the processing result sent by the database instance. Then, the database access scheduling module sends the processing result to the database access service engine. In this way, the database access service engine implements access to the database instance through the access request.
[0011] Optionally, the database access scheduling module encrypts the processing result by using a public key of the database access service engine, so that the database access scheduling module sends the encrypted processing result to the database access service engine.
[0012] In the second aspect, in the database access method provided in the present application, if an application needs to access a database instance, the application sends an access request of the application to a database access initiation module, and the access request carries an identifier of the database instance.
[0013] The database access initiation module determines a database access service engine for accessing the database instance when receiving the access request, and sends the access request to the determined database access service engine. The database access service engine is deployed independently of the application.
[0014] The database access service engine can establish a connection with a database access implementation module (for example, a database instance, for example, a database access scheduling module).
[0015] If the connection is established between the database access service engine and the database instance, the database access service engine can send the access request to the database instance through the connection, and the database instance processes the access request.
[0016] If the connection is established between the database access service engine and the database access dispatch module, the database access service engine can send the access request to the database access dispatch module through the connection. In this way, the database access dispatch module can send the access request to the database instance, so that the database instance can process the access request.
[0017] Compared with the prior art of using the connection provided by the connection pool in the application to access the database instance, the application realizes the access to the database instance through the database access service engine independent of the application. In addition, the connection for accessing the database instance is established by the access service engine, not maintained by the application, thereby reducing the load of the application.
[0018] In a possible design of the second aspect, when receiving the access request, the database access initiation module selects a database access service engine from a plurality of database access service engines, and sends the access request to the selected database access service engine. In this way, the plurality of database access service engines can share the pressure of forwarding a plurality of access requests.
[0019] In a possible design of the second aspect, when receiving the access request, the database access initiation module selects a database access service engine from a plurality of database access service engines according to the load of the plurality of database access service engines. In this way, load sharing can be realized among the plurality of database access service engines.
[0020] Optionally, the load of each database access service engine refers to the number of connections established between the database access service engine and the database access implementation module (for example, a database instance, for example, a database access dispatch module). The greater the number, the greater the load of the database access service engine; on the contrary, the smaller the number, the smaller the load of the database access service engine.
[0021] In a possible design of the second aspect, when receiving the access request, the database access initiation module selects a database access service engine with the smallest load from a plurality of database access service engines. Optionally, the load of each database access service engine refers to the number of connections established between the database access service engine and the database access implementation module (for example, a database instance, for example, a database access dispatch module).
[0022] In a possible design of the second aspect, when receiving the access request, if the access request carries the identifier of the database instance, and there already exists a database access service engine that has established a connection with the database instance, the database access initiation module determines the database access service engine bound to the identifier of the database instance.
[0023] In a possible design of the second aspect, the database access initiating module, upon receiving the access request, determines the database access service engine bound to the database access scheduling module if the access request carries an identifier of the database access scheduling module and a database access service engine that has established a connection with the database access scheduling module already exists. In this case, the database access initiating module sends the access request to the database access service engine, so that the database access scheduling module receives the access request from the database access service engine. Since the database instance specified by the access request is associated with the database access scheduling module, the database access scheduling module can forward the access request to the database instance specified by the access request upon receiving the access request.
[0024] In a possible design of the second aspect, upon receiving the access request, the database access service engine establishes a connection between the database access service engine and the database instance according to the identifier of the database instance. In this way, data can be transmitted between the database access service engine and the database instance based on the connection, for example, the database access service engine sends the access request to the database instance, or the database instance sends a processing result corresponding to the access request to the database access service engine.
[0025] In a possible design of the second aspect, upon receiving the access request, the database access service engine sends the access request to the database instance using a connection between the database access service engine and the database instance that has been established according to a keyword used to identify the connection if the access request carries the keyword. In this way, if the keyword is application-specific, the application can use the same connection to access the same database instance based on the keyword.
[0026] In a possible design of the second aspect, upon receiving the access request, the database access service engine establishes a connection between the database access service engine and the database instance according to the identifier of the database instance if the access request does not carry a keyword used to identify a connection. Since the access request does not carry the keyword used to identify the connection, even if there is an existing connection between the database access service engine and the database instance, the database access service engine still needs to establish a new connection, and uses the new connection to transmit data (for example, the access request or a processing result corresponding to the access request) between the database access service engine and the database instance.
[0027] In a possible design of the second aspect, when receiving the access request, if the access request carries the identifier of the database access scheduling module, the database access service engine sends the access request to the database access scheduling module.
[0028] For example, in a case where a communication connection has been established between the database access service engine and the database access scheduling module, the application can specify the identifier of the database access scheduling module in the access request. In this way, the database access service engine can determine the communication connection based on the identifier of the database access scheduling module, and thus the database access service engine can continue to use the communication connection to send the access request to the database access scheduling module.
[0029] If multiple applications respectively specify the same identifier of the database access scheduling module in their own access requests, the database access service engine, the communication connection between the database access service engine and the database access scheduling module, and the database access scheduling module can be shared to implement transmission of related data of the access requests.
[0030] In a possible design of the second aspect, after the database instance processes the access request and generates a processing result corresponding to the access request, if the database instance is directly connected with the database access service engine, the database instance sends the processing result to the database access service engine; if the database instance is connected with the database access scheduling module, the database instance sends the processing result to the database access scheduling module, so that the database access scheduling module forwards the processing result to the database access service engine.
[0031] The database access service engine sends the processing result to the database access initiating module. Accordingly, the database access initiating module sends the processing result to the application.
[0032] In this way, the application can implement access to the database instance through the access request, and obtain the processing result of the access request.
[0033] In a third aspect, the present application provides a database access apparatus. The apparatus comprises functional modules for implementing the steps performed by the database access initiating module in the method provided in the first aspect or any possible design of the first aspect, or for implementing the steps performed by the database access initiating module in the method provided in the second aspect or any possible design of the second aspect.
[0034] The present application provides another database access apparatus. The apparatus comprises functional modules for implementing the steps performed by the database access service engine in the method provided by the first aspect or any possible design of the first aspect, or for implementing the steps performed by the database access service engine in the method provided by the second aspect or any possible design of the second aspect.
[0035] The present application provides another database access apparatus. The apparatus comprises functional modules for implementing the steps performed by the database access implementation module (e.g. database instance, e.g. database access scheduling module) in the method provided by the first aspect or any possible design of the first aspect, or for implementing the steps performed by the database access implementation module (e.g. database instance, e.g. database access scheduling module) in the method provided by the second aspect or any possible design of the second aspect.
[0036] In the third aspect, the present application provides a computing device comprising a processor and a memory. The memory stores computer instructions; and the processor executes the computer instructions stored in the memory, so that the computing device performs the steps performed by the database access initiation module in the method provided by the first aspect or various possible designs of the first aspect, or performs the steps performed by the database access service engine in the method provided by the first aspect or various possible designs of the first aspect, or performs the steps performed by the database access implementation module (e.g. database instance, e.g. database access scheduling module) in the method provided by the first aspect or various possible designs of the first aspect, or performs the steps performed by the database access initiation module in the method provided by the second aspect or various possible designs of the second aspect, or performs the steps performed by the database access service engine in the method provided by the second aspect or various possible designs of the second aspect, or performs the steps performed by the database access implementation module (e.g. database instance, e.g. database access scheduling module) in the method provided by the second aspect or various possible designs of the second aspect.
[0037] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions. When a processor of a computing device executes the computer instructions, the computing device performs the steps performed by the database access initiating module in the method provided by the first aspect or various possible designs of the first aspect, or the computing device performs the steps performed by the database access service engine in the method provided by the first aspect or various possible designs of the first aspect, or the computing device performs the steps performed by the database access implementing module (e.g., a database instance, e.g., a database access scheduling module) in the method provided by the first aspect or various possible designs of the first aspect, or the computing device performs the steps performed by the database access initiating module in the method provided by the second aspect or various possible designs of the second aspect, or the computing device performs the steps performed by the database access service engine in the method provided by the second aspect or various possible designs of the second aspect, or the computing device performs the steps performed by the database access implementing module (e.g., a database instance, e.g., a database access scheduling module) in the method provided by the second aspect or various possible designs of the second aspect.
[0038] In a fifth aspect, the present application provides a computer program product, which includes computer instructions stored in a computer readable storage medium. A processor of a computing device can read the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computing device to perform the steps performed by the database access initiating module in the method provided by the first aspect or various possible designs of the first aspect, or to cause the computing device to perform the steps performed by the database access service engine in the method provided by the first aspect or various possible designs of the first aspect, or to cause the computing device to perform the steps performed by the database access implementing module (e.g., a database instance, e.g., a database access scheduling module) in the method provided by the first aspect or various possible designs of the first aspect, or to cause the computing device to perform the steps performed by the database access initiating module in the method provided by the second aspect or various possible designs of the second aspect, or to cause the computing device to perform the steps performed by the database access service engine in the method provided by the second aspect or various possible designs of the second aspect, or to cause the computing device to perform the steps performed by the database access implementing module (e.g., a database instance, e.g., a database access scheduling module) in the method provided by the second aspect or various possible designs of the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 An example of an application scenario applicable to the present application;
[0040] Figure 2One of the application scenarios applicable to the present application;
[0041] Figure 3 One of the application scenarios applicable to the present application;
[0042] Figure 4 One of the flow diagrams of the database access method provided by the present application;
[0043] Figure 5 One of the flow diagrams of the database access method provided by the present application;
[0044] Figure 6 One of the logical structure diagrams of the database access initiating module 600 provided by the present application;
[0045] Figure 7 One of the logical structure diagrams of the database access service engine 700 provided by the present application;
[0046] Figure 8 One of the logical structure diagrams of the database access scheduling module 800 provided by the present application;
[0047] Figure 9 One of the structure diagrams of the computing device 900 provided by the present application. DETAILED DESCRIPTION
[0048] The technical solutions provided by the present application will be described below in combination with the drawings in the present application.
[0049] Figure 1 One of the possible scenarios applicable to the present application is provided. The database access initiating module (for example, the database access initiating module 111, the database access initiating module 112, the database access initiating module 113) is configured to receive an access request and forward the access request to a database access service engine. The database access service engine (for example, the database access service engine 121, the database access service engine 122, the database access service engine 123) is configured to forward the access request to a database access implementing module. The database access implementing module (for example, the database access implementing module 131, the database access implementing module 132, the database access implementing module 133) is configured to schedule or process the access request.
[0050] In the present application, the database access service engine is independent of the application deployment. For example, the database access service engine is not integrated into the application. For example, the database access service engine is deployed on a different server from the application. In this way, the database access service engine can serve different database access initiating modules.
[0051] Optionally, the database access initiating module can be integrated into the application; optionally, the database access initiating module can be deployed independently of the application, for example, the application and the database access initiating module are deployed on the server where the application is located at the same time.
[0052] The database access initiating module can receive an access request from the application. In one possible implementation, the access request can include a statement in SQL format, which can be referred to as "SQL statement" hereinafter. For example, a user can operate the application to input a SQL statement to trigger the application to generate an access request including the SQL statement.
[0053] Optionally, the database access initiating module can be implemented in the form of a software development kit (SDK).
[0054] In one possible implementation, each database access initiating module serves a single application. Specifically, each database access initiating module receives an access request generated by the application it is responsible for. For example, the database access initiating module 111 can be responsible for receiving an access request from one application; the database access initiating module 112 and the database access initiating module 113 can be responsible for receiving an access request from another application at the same time. For example, the another application can send an access request to the database access initiating module 112 or the database access initiating module 113, so that the database access initiating module 112 and the database access initiating module 113 can be used to balance the load of receiving the access request from the another application.
[0055] The database access initiating module can send the access request to the database access service engine.
[0056] For example, the database access initiating module 111 can query the meta database 14 to determine that the database access service engine 121 has the smallest current load through the meta database 14. Thus, the database access initiating module 111 sends the access request from the application to the database access service engine 121. The database access service engines can be balanced. Figure 1 For example, the database access initiating module 111 can query the meta database 14 to determine that the database access service engine 121 has the smallest current load through the meta database 14. Thus, the database access initiating module 111 sends the access request from the application to the database access service engine 121. The database access service engines can be balanced.
[0057] Figure 1 For example, the database access initiating module 111 can query the meta database 14 to determine that the database access service engine 121 has the smallest current load through the meta database 14. Thus, the database access initiating module 111 sends the access request from the application to the database access service engine 121. The database access service engines can be balanced. Figure 2 In the scenario where the database access implementation module 131 is the database instance 231, if the application specifies the identifier of the database instance 231 (for example, the Internet Protocol (IP) address and port number of the database instance 231) to be accessed through the access request, the database access initiation module 111 records the binding relationship between the identifier of the database instance 231 and the database access service engine 121 in the meta database 14. Subsequently, when the database access initiation module 111 receives a new access request of the application, if the new access request carries the identifier of the database instance 231, the database access initiation module 111 finds the binding relationship in the meta database 14 using the identifier of the database instance 231, and then sends the new access request to the database access service engine 121 specified by the binding relationship.
[0058] In addition, in combination with Figure 1 and Figure 2 In the scenario where the database access implementation module 131 is the database instance 231, the database access service engine 121 can establish a connection to the database instance 231 according to the identifier of the database instance 231. In one possible implementation, after the database access service engine 121 successfully establishes the connection to the database instance 231, the database access service engine 121 records a key for identifying the connection. Optionally, the database access service engine 121 can also send the key to the database access initiation module 111, so that the database access initiation module 111 feeds back the key to the application.
[0059] Optionally, the database access service engine 121 can also record the number of connections established by the database access service engine 121 in the meta database 14. In this way, the more the number of connections belonging to the database access service engine 121 recorded in the meta database 14, the greater the load of the database access service engine 121; on the contrary, the less the number of connections belonging to the database access service engine 121 recorded in the meta database 14, the smaller the load of the database access service engine 121. Similarly, the meta database 14 records the number of connections possessed by all the database access service engines respectively; subsequently, the database access initiation module can balance the loads among the plurality of database access service engines according to the number of connections, for example, selects the database access service engine with the smallest load from the plurality of database access service engines shown in FIG. 1. Figure 1
[0060] In one possible implementation of the present application, in combination with Figure 1 and Figure 2 The database access implementation module can be a database instance. The database instance processes the access request when the database access implementation module receives the access request sent by the database access service engine. For example, the database access implementation module 133 is a database instance 233. When the database instance 233 receives the access request sent by the database access service engine 122, the database instance 233 processes the access request according to the SQL statement carried by the access request.
[0061] In a possible implementation of the present application, the database access implementation module can be a database instance. Figure 1 and Figure 3 The database access implementation module can be a database access scheduling module, which is in communication connection with at least one database instance. The database access scheduling module sends the access request to the database instance specified by the access request when the database access scheduling module receives the access request sent by the database access service engine. For example, the database access scheduling module 333 receives the access request sent by the database access service engine 122. If the access request carries the identifier of the database instance 373, the database access scheduling module 333 sends the access request to the database instance 373. For example, the database access scheduling module 331 receives the access request sent by the database access service engine 121. If the access request carries the identifier of the database instance 372, the database access scheduling module 331 sends the access request to the database instance 372.
[0062] In a possible implementation of the present application, as shown in Figure 3 If the database access scheduling module and the database access service engine are deployed in the same network; for example, the database access scheduling module 333 and the database access service engine 122 are both deployed in a public cloud to provide services, that is, the database access scheduling module 333 and the database access service engine 122 are both deployed in the network used by the public cloud. The database access scheduling module 333 can access the database instance 373 and the database instance 374. When the database access scheduling module 333 receives the access request sent by the database access service engine 122, if the access request carries the identifier of the database instance 373, the database access scheduling module 333 sends the access request to the database instance 373; if the access request carries the identifier of the database instance 374, the database access scheduling module 333 sends the access request to the database instance 374. Optionally, the database instance 373 and the database instance 374 are both deployed in the public cloud to provide services, that is, the database instance 373 and the database instance 374 are both deployed in the network used by the public cloud.
[0063] In a possible implementation of the present application, as shown in Figure 3As shown, if the database access implementation module is deployed within a local area network (LAN), then the database access implementation module is the database access scheduling module 331 within that LAN. This database access scheduling module 331 can access database instances within the LAN. For example, the database access scheduling module 331 in LAN 381 receives an access request sent by the database access service engine 121; the database access scheduling module 331 sends the access request to the database instance 372 based on the identifier of the database instance 372 specified in the access request; the database instance 372 processes the access request, for example, by executing the SQL statement carried in the access request.
[0064] exist Figure 3 In the illustrated architecture, after the database access scheduling module 333 establishes a communication connection with the database access service engine 122, the database access service engine 122 records the identifier of the database access scheduling module 332 and the binding relationship between the database access scheduling module 333 and the database access service engine 122 in the metadata database 14. Subsequently, if the database access initiation module 112 receives an access request that records the identifier of the database access scheduling module 333, the database access initiation module 112 sends the access request to the database access service engine 122 according to the binding relationship recorded in the metadata database 14, so that the database access service engine 122 can ultimately forward the access request to the database access scheduling module 333. Therefore, the binding relationship between the database access scheduling module and the database access service engine is recorded in the metadata database 14.
[0065] In one application scenario, the database access service engine 121 is deployed in a public cloud, while the database access scheduling module 331 and multiple database instances (e.g., database instance 371, database instance 372) are deployed within a local area network 381. The database access scheduling module 331 obtains the IP address of the database access service engine 121, for example, by manually entering the IP address into the module. The module then uses this IP address to request and establish a communication connection with the database access service engine 121, for example, based on the Transmission Control Protocol (TCP). In this way, the database access service engine 121 can establish a communication connection with the database access scheduling module 331, allowing the database access service engine 121 in the public cloud to access the multiple database instances (e.g., database instance 371, database instance 372) in the local area network 381 through the database access scheduling module 331.
[0066] Similarly, the database access service engine 122 in the public cloud can access multiple database instances in the local area network 382 through the database access scheduling module 332. Figure 3 (Not indicated).
[0067] Thus, after the database access scheduling module in the local area network initiatively establishes a communication connection with the database access service engine in the public cloud, the database access service engine in the public cloud can access the database instance in the local area network through the database access scheduling module.
[0068] A possible application scenario is that the local area network is a network of a private cloud.
[0069] In a possible implementation manner of the present application, Figure 3 In the architecture shown in the figure, after the database access scheduling module 331 in the local area network 381 initiatively establishes a communication connection with the database access service engine 121, the database access service engine 121 records the binding relationship between the identifier of the database access scheduling module 331 and the database access service engine 121 in the meta database 14. Subsequently, if the access request received by the database access initiating module 331 records the identifier of the database access scheduling module 331, the database access initiating module 331 sends the access request to the database access service engine 121 according to the binding relationship recorded in the meta database 14, so as to forward the access request to the database access scheduling module 331 by the database access service engine 121. Similarly, after the database access scheduling module 332 in the local area network 382 initiatively establishes a communication connection with the database access service engine 122, the database access service engine 122 records the binding relationship between the identifier of the database access scheduling module 332 and the database access service engine 122 in the meta database 14. Similarly, after the database access scheduling module 333 initiatively establishes a communication connection with the database access service engine 122, the database access service engine 122 records the binding relationship between the identifier of the database access scheduling module 333 and the database access service engine 122 in the meta database 14. It can be seen that the present application records the binding relationship between the database access scheduling module and the database access service engine in the meta database 14.
[0070] In a possible implementation manner, Figure 3 In the architecture shown in the figure, if the database access service engine directly connects the database access scheduling module, the binding relationship between the identifier of the database access scheduling module and the database access service engine is recorded in the meta database 14; if the database access service engine directly connects the database instance, the binding relationship between the database instance and the database access service engine is recorded in the meta database 14. Thus, in the architecture shown in the figure, Figure 3In the architecture shown, when the database access initiation module searches the metadata database 14 to determine the destination of the access request, if the database access service engine is directly connected to the database access scheduling module, the database access scheduling module identifier carried in the access request is used to find the binding relationship to determine the database access service engine. If the database access service engine is directly connected to the database instance, the database instance identifier carried in the access request is used to find the binding relationship to determine the database access service engine.
[0071] based on Figure 2 Based on the architecture shown, this application provides a database access method. Combined with... Figure 2 ,exist Figure 4 The diagram illustrates a flow of the database access method, which includes steps S411 to S417.
[0072] Step S411: The application sends an access request to the database access initiation module.
[0073] Specifically, the application sends an access request to the database access initiation module that provides services to the application. For example, the database access initiation module 111 provides services to an application; for each access request generated by the application, the application sends the access request to the database access initiation module 111.
[0074] The access request includes an identifier for the database instance. This identifier allows the database instance used to process the access request to be identified.
[0075] For example, a database instance can be identified by its IP address. Alternatively, a database instance can be identified by its IP address and port number.
[0076] For example, the identifier of a database instance includes its name. This allows for further determination of whether a database instance is the one that needs to be accessed, based on its name.
[0077] For example, the identifier of a database instance can be one or a combination of the following parameters: the IP address of the database instance, or the IP address and port number, or the name of the database instance.
[0078] For example, the access request could include a statement in SQL format. The database instance can then execute the SQL statement included in the access request.
[0079] For example, the access request carries the identifier of the services currently offered by the application.
[0080] In step S412, the database access initiation module determines the database access service engine associated with the database instance.
[0081] In step S413, the database access initiation module sends the access request to the determined database access service engine.
[0082] In one possible implementation, if no database access service engine is assigned to the database instance specified by the identifier of the database instance carried in the access request, the database access initiating module selects one from multiple database access service engines and sends the access request to the selected database access service engine. Accordingly, the database access initiating module records the binding relationship between the identifier of the database instance and the database access service engine in the metadata database 14.
[0083] For example, with Figure 2 For example, when the database access initiation module 111 receives an access request from the application, it can query the metadata database 14. If no database access service engine is assigned to the database instance specified by the identifier of the database instance carried in the access request, the module selects one from multiple database access service engines (e.g., database access service engine 121, database access service engine 122, and database access service engine 123), for example, database access service engine 121. Then, the database access initiation module 111 sends the access request to database access service engine 121.
[0084] For example, with Figure 2 For example, when the database access initiation module 111 receives an access request from the application, it can query the metadata database 14. If the query result does not match the database instance specified by the identifier of the database instance carried in the access request, a database access service engine is selected from among the multiple database access service engines (e.g., database access service engine 121, database access service engine 122, and database access service engine 123) based on their load, for example, database access service engine 121. Therefore, the database access initiation module 111 sends the access request to database access service engine 121.
[0085] For example, with Figure 2For example, when the database access initiating module 111 receives an access request sent by an application, the database access initiating module 111 can query the meta database 14, and if no database access service engine is assigned to the database instance specified by the identifier of the database instance carried by the access request, the database access initiating module 111 selects a database access service engine with the least load from the plurality of database access service engines (e.g., the database access service engine 121, the database access service engine 122, and the database access service engine 123). Assuming that the database access service engine 121 has the least load at present, the database access initiating module 111 sends the access request to the database access service engine 121. In addition, the database access initiating module 111 records the binding relationship between the database access service engine 121 and the identifier of the database instance in the meta database 14.
[0086] In a possible implementation, if the binding relationship corresponding to the identifier of the database instance carried by the access request has been recorded in the meta database 14, the database access initiating module queries the meta database 14 to determine the database access service engine specified by the binding relationship. Thus, the database access initiating module sends the access request to the determined database access service engine.
[0087] In a possible implementation, each database access service engine (e.g., the database access service engine 121 or the database access service engine 122 or the database access service engine 123) records its own load information (e.g., the number of deployed connections) and heartbeat information in the meta database 14 periodically. In this way, when the database access initiating module determines the database access service engine for sending the access request by using the meta database 14, the database access initiating module can further determine whether the database access service engine is available by using the heartbeat information of the database access service engine. If the database access service engine is available, the database access initiating module performs step S413 to send the access request to the database access service engine. If the database access service engine is unavailable, the database access initiating module re-performs step S412 to select a new database access service engine.
[0088] In a possible implementation in which the database access initiating module determines that the database access service engine is available, the database access initiating module determines that the database access service engine is not down or determines that the database access service engine has not lost the communication connection according to the heartbeat information of the database access service engine recorded in the meta database 14.
[0089] In step S414, the database access service engine sends the access request to the database instance.
[0090] In a possible implementation, if the access request carries a key for identifying a connection between the database access service engine and the database instance specified by the access request, the database access service engine uses the connection to send the access request to the database instance. In this way, if the key for identifying the connection is added to multiple access requests issued by an application, the access requests are all sent to the database instance through the same connection. If the multiple access requests are issued continuously and sent to the database instance through the same connection, the transaction consistency of a transaction composed of the multiple access requests is ensured.
[0091] In a possible implementation, if the access request does not carry the key for identifying the connection, the database access service engine can establish a new connection between the database access service engine and the database instance specified by the access request. For example, the connection established between the database access service engine and the database instance can be a communication connection, for example, a JDBC (Java database connectivity) connection.
[0092] For the newly established connection between the database access service engine and the database instance, the database access service engine records a key for identifying the connection. For example, the database access engine 121 records the newly established connection between the database access service engine 121 and the database instance 231, the database access engine 122 records the newly established connection between the database access service engine 122 and the database instance 232, and the database access engine 122 records the key for identifying the connection and records the binding relationship between the key and the database instance 231. Subsequently, the database access service engine 122 can determine the connection specified by the key through the binding relationship. Figure 2
[0093] In addition, since the access request does not carry the key for identifying the connection, even if there is an existing connection between the database access service engine and the database instance, the database access service engine still needs to establish a new connection, and use the newly established connection to transmit data (for example, the access request or the processing result corresponding to the access request) related to the access request between the database access service engine and the database instance.
[0094] Optionally, the database access service engine can also send the keyword to the database access initiation module that previously forwarded the access request, so that the database access initiation module feeds back the keyword to the application that previously generated the access request. Subsequently, the application can add the keyword in a new access request, and accordingly, the database access service engine sends the new access request to the database instance associated with the keyword after receiving the keyword through the database access initiation module. Thus, the new access request with the keyword sent by the application is ensured to be sent to the database instance for processing, and the consistency of the transaction composed of multiple new access requests with the keyword is ensured.
[0095] For example, for a newly established connection between the database access service engine 121 and the database instance 231, the database access service engine 121 can send a keyword (used to identify the newly established connection) to the database access initiation module 111, so that the database access initiation module 111 feeds back the keyword to the application that previously generated the access request. Subsequently, the application can add the keyword in a new access request; accordingly, the database access service engine 121 sends the new access request to the database instance 231 associated with the keyword after receiving the keyword through the database access initiation module 111.
[0096] Step S415: The database instance sends the processing result corresponding to the access request to the database access service engine.
[0097] Specifically, after receiving the access request sent by the database access service engine, the database instance processes the access request and obtains a processing result. The database instance sends the processing result corresponding to the access request to the database access service engine.
[0098] For example, the database instance 231 receives the access request sent by the access service engine 121, and the database instance 231 processes the access request, for example, executes the SQL format statement carried by the access request, for example, queries data using the SQL format statement and obtains a query result. The database instance 231 sends the processing result (for example, the query result) corresponding to the access request to the access service engine 121. If a JDBC connection is established between the database instance 231 and the access service engine 121, the transmission of the access request and the processing result between the database instance 231 and the access service engine 121 is completed using the JDBC connection.
[0099] Step S416: The database access service engine sends the processing result corresponding to the access request to the database access initiation module.
[0100] Specifically, the database access service engine that previously forwarded the access request sends the processing result corresponding to the access request to the database access initiating module that previously forwarded the access request. For example, if the access request was forwarded to the database instance 231 through the database access initiating module 111 and the database access service engine 121, then the database instance 231 sends the processing result corresponding to the access request to the database access service engine 121, so that the database access service engine 121 sends the processing result to the database access initiating module 111.
[0101] In step S417, the database access initiation module sends the processing result corresponding to the access request to the application.
[0102] Specifically, the database access initiating module that previously forwarded the access request sends the processing result corresponding to the access request to the application that generated the access request (i.e., the application served by the database access initiating module). For example, after receiving the processing result corresponding to the access request from the access service engine 121, the database access initiating module 111 sends the processing result to the application that previously generated the access request. In this way, the application obtains the processing result corresponding to the access request, such as the query result obtained by the database instance 231 based on the SQL format statement included in the access request.
[0103] based on Figure 3 Based on the architecture shown, this application provides a database access method. Combined with... Figure 3 ,exist Figure 5 The diagram illustrates a flow of the database access method, which includes steps S511 to S521.
[0104] Step S511: The database access scheduling module establishes a communication connection with the database access engine.
[0105] One possible implementation, see Figure 3 The database access scheduling module and the database access service engine are deployed in the same network, and they can establish a communication connection within this network. For example, both the database access scheduling module 333 and the database access service engine 122 are deployed in a public cloud to provide services; that is, both are deployed in the network used by that public cloud. The database access scheduling module 333 uses the IP address of the database access service engine 122 to establish a communication connection with it, or the database access service engine 122 uses the IP address of the database access scheduling module 333 to establish a communication connection with it.
[0106] One possible implementation, seeFigure 3 The database access scheduling module is located in the local area network. The database access engine is not located in the local area network, i.e. the database access engine is not located in the same local area network as the database access scheduling module. For example, the database access scheduling module 331 in the local area network 381 obtains the IP address of the database access service engine 121, e.g. the IP address of the database access service engine 121 is pre-recorded in the database access scheduling module 331, e.g. the IP address of the database access service engine 121 is manually entered in the database access scheduling module 331. The database access scheduling module 331 actively requests to establish a communication connection (e.g. the communication connection can be a TCP-based communication connection) with the database access service engine 121 using the IP address. In this way, the database access scheduling module 331 can establish a communication connection with the database access service engine 121. Similarly, the database access scheduling module 332 can actively establish a communication connection with the database access service engine 122 using the IP address of the database access service engine 122; the database access scheduling module 333 can actively establish a communication connection with the database access service engine 122 using the IP address of the database access service engine 122. As can be seen, each database access scheduling module can actively establish a communication connection with a database access service engine using the IP address of the database access service engine.
[0107] It should be noted that the communication connection established between the database access scheduling module and the database access engine can be a TCP-based communication connection, or can be a communication connection established based on other protocols. Thus, based on the communication connection, data can be transmitted between the database access scheduling module and the database access engine.
[0108] When the database access scheduling module and the database access engine successfully establish a communication connection (e.g. the communication connection can be a TCP-based communication connection), the database access engine records the binding relationship between the identification of the database access scheduling module and the communication connection.
[0109] For example, when the database access scheduling module 331 successfully establishes a communication connection with the database access service engine 121, the database access service engine 121 records the binding relationship between the identifier of the database access scheduling module 331 and the communication connection (the communication connection between the database access scheduling module 331 and the database access service engine 121). When the database access scheduling module 332 successfully establishes a communication connection with the database access service engine 122, the database access service engine 122 records the binding relationship between the identifier of the database access scheduling module 332 and the communication connection (the communication connection between the database access scheduling module 332 and the database access service engine 122). When the database access scheduling module 333 successfully establishes a communication connection with the database access service engine 122, the database access service engine 122 records the binding relationship between the identifier of the database access scheduling module 333 and the communication connection (the communication connection between the database access scheduling module 333 and the database access service engine 122).
[0110] In step S512, the database access engine records the binding relationship between the database access service engine and the database access scheduling module that have established the communication connection in the meta database 14.
[0111] In one possible implementation, the single database access scheduling module initiatively requests to establish a communication connection with the single database access service engine, and if the communication connection is successfully established, the database access engine records the binding relationship between the database access scheduling module and the database access service engine in the meta database 14.
[0112] The binding relationship between the single database access scheduling module and the single database access service engine can specifically include the identifier of the database access scheduling module and the identifier of the database access service engine.
[0113] For example, the database access scheduling module 332 can proactively establish a communication connection with the database access service engine 122 using its IP address. If the communication connection is successfully established, the database access service engine 122 records the binding relationship corresponding to the communication connection in the metadata database 14. This binding relationship includes the identifier of the database access scheduling module 332 (e.g., the keyword of the database access scheduling module 332) and the identifier of the database access service engine 122 (e.g., the IP address of the database access service engine 122). Similarly, the database access scheduling module 333 can proactively establish a communication connection with the database access service engine 122 using its IP address. If the communication connection is successfully established, the database access service engine 122 records the binding relationship corresponding to the communication connection in the metadata database 14. This binding relationship includes the identifier of the database access scheduling module 333 (e.g., the keyword of the database access scheduling module 333) and the identifier of the database access service engine 122 (e.g., the IP address of the database access service engine 122).
[0114] In this way, the load size of a single database access service engine can be determined based on the number of binding relationships recorded in metadata 14. Optionally, such as... Figure 3 As shown, this binding relationship can be between a database access scheduling module and a database access service engine (e.g., the binding relationship between the identifier of database access scheduling module 333 and the identifier of database access service engine 122, or the binding relationship between the identifier of database access scheduling module 331 and the identifier of database access service engine 121), or the binding relationship between the identifier of a database instance and a database access service engine (e.g., the binding relationship between the identifier of database instance 374 and the identifier of database access service engine 123). In this way, all the binding relationships possessed by the database access service engine can be comprehensively considered to evaluate the load size of the database access service engine.
[0115] Additionally, the database access initiation module can search the metadata database 14 based on the identifier of the database access scheduling module carried in the access request, and find the binding relationship that matches the identifier of the database access scheduling module. Then, the access request is sent to the database access service engine specified by that binding relationship.
[0116] Step S513: The application sends an access request to the database access initiation module.
[0117] Specifically, the application sends an access request to the database access initiating module which provides service for the application. For example, the database access initiating module 111 provides service for an application; for the access request generated by the application, the application sends the access request to the database access initiating module 111.
[0118] The access request carries the identification of the database access scheduling module. The identification of the database access scheduling module can be the IP address of the database access scheduling module. In a possible implementation, the identification of the database access scheduling module can be the IP address and port number of the database access scheduling module.
[0119] In addition, the access request carries the identification of the database instance. In this way, the database instance used for processing the access request can be determined through the identification of the database instance.
[0120] For example, the identification of the database instance is the IP address of the database instance. For example, the identification of the database instance is the IP address and port number of the database instance.
[0121] For example, the identification of the database instance includes the name of the database instance. In this way, whether the database instance is the database instance that needs to be accessed can be further determined based on the name of the database instance.
[0122] For example, the identification of the database instance can be a combination of one or more of the following parameters: the IP address of the database instance, or the IP address and port number, or the database instance.
[0123] For example, the access request carries a statement which can include a SQL format. In this way, the database instance can execute the SQL format statement carried by the access request.
[0124] For example, the access request carries the identification of the service currently provided by the application.
[0125] Step S514, the database access initiating module determines the database access service engine associated with the database access scheduling module.
[0126] Step S515, the database access initiating module sends the access request to the determined database access service engine.
[0127] Specifically, the database access initiating module finds the meta database 14 based on the identification of the database access scheduling module carried by the access request, and finds the binding relationship matching the identification of the database access scheduling module. The database access initiating module sends the access request to the database access service engine specified by the binding relationship.
[0128] For example, the database access initiating module 113 finds the binding relationship corresponding to the identifier of the database access scheduling module 333 in the meta database 14 using the identifier of the database access scheduling module 333 carried by the access request, and the binding relationship records the identifier of the database access service engine 122. Then, the database access initiating module 113 sends the access request to the database access service engine 122.
[0129] For example, the database access initiating module 111 finds the binding relationship corresponding to the identifier of the database access scheduling module 331 in the meta database 14 using the identifier of the database access scheduling module 331 carried by the access request, and the binding relationship records the identifier of the database access service engine 121. Then, the database access initiating module 111 sends the access request to the database access service engine 121.
[0130] In step S516, the database access service engine sends the access request to the database access scheduling module.
[0131] Specifically, the access request carries the identifier of the database access scheduling module. The database access service engine finds the binding relationship matching the identifier of the database access scheduling module according to the identifier of the database access scheduling module, and the binding relationship records the identifier of the database access scheduling module and the communication connection between the database access service engine and the database access scheduling module. In this way, the database access service engine sends the access request to the database access scheduling module based on the communication connection.
[0132] For example, referring to Figure 3 The database access service engine 121 records the binding relationship of the identifier of the database access scheduling module 331 and the communication connection (the communication connection between the database access scheduling module 331 and the database access service engine 121). When the database access service engine 121 receives an access request, if the access request carries the identifier of the database access scheduling module 331, the database access service engine 121 sends the access request to the database access scheduling module 331 according to the communication connection recorded by the binding relationship.
[0133] For example, referring to Figure 3 The database access service engine 122 records the binding relationship of the identifier of the database access scheduling module 332 and the communication connection (the communication connection between the database access scheduling module 332 and the database access service engine 122). When the database access service engine 122 receives an access request, if the access request carries the identifier of the database access scheduling module 332, the database access service engine 122 sends the access request to the database access scheduling module 332 according to the communication connection recorded by the binding relationship.
[0134] For example, referring to Figure 3 The database access service engine 122 records the binding relationship between the identity of the database access scheduling module 333 and the communication connection (the communication connection between the database access scheduling module 333 and the database access service engine 122). When the database access service engine 122 receives an access request, if the access request carries the identity of the database access scheduling module 333, the database access service engine 122 sends the access request to the database access scheduling module 333 according to the communication connection recorded by the binding relationship.
[0135] Step S517, the database access scheduling module sends the access request to the database instance specified by the access request.
[0136] Specifically, the access request carries the identity of the database instance. The database access scheduling module sends the access request to the database instance specified by the identity. Optionally, the database access scheduling module and the database instance are located in the same local area network.
[0137] For example, in the local area network 381, when the database access scheduling module 331 receives an access request, if the access request carries the identity of the database instance 371, the database access scheduling module 331 sends the access request to the database instance 371; if the access request carries the identity of the database instance 372, the database access scheduling module 331 sends the access request to the database instance 372, so that the database instance 372 processes the access request.
[0138] For example, when the database access scheduling module 333 receives an access request, if the access request carries the identity of the database instance 373, the database access scheduling module 333 sends the access request to the database instance 373; if the access request carries the identity of the database instance 374, the database access scheduling module 333 sends the access request to the database instance 374.
[0139] The database instance processes the access request to obtain a processing result. For example, the access request carries a statement including a SQL format, and the database instance performs data query according to the SQL format statement to obtain a query result.
[0140] Step S518, the database instance sends the processing result corresponding to the access request to the database access scheduling module.
[0141] Specifically, the database instance sends the processing result corresponding to the access request to the database access scheduling module which previously forwards the access request to the database instance.
[0142] For example, if the database access scheduling module 331 previously sends an access request to the database instance 371, the database instance 371 processes the access request to obtain a processing result, and sends the processing result to the database access scheduling module 331 accordingly.
[0143] For example, if the database access scheduling module 333 previously sends an access request to the database instance 373, the database instance 373 processes the access request to obtain a processing result, and sends the processing result to the database access scheduling module 333 accordingly.
[0144] Step S519, the database access scheduling module sends the processing result corresponding to the access request to the database access service engine.
[0145] Specifically, the database access service engine is the database access service engine that previously sends the access request to the database access scheduling module. After the database access scheduling module obtains the processing result corresponding to the access request from the database instance, the database access scheduling module sends the processing result to the database access service engine.
[0146] For example, after the database access scheduling module 331 receives the processing result corresponding to the access request, the database access scheduling module 331 sends the processing result to the database access service engine 121 through the communication connection between the database access scheduling module 331 and the database access service engine 121.
[0147] For example, after the database access scheduling module 333 receives the processing result corresponding to the access request, the database access scheduling module 333 sends the processing result to the database access service engine 122 through the communication connection between the database access scheduling module 333 and the database access service engine 122.
[0148] Step S520, the database access service engine sends the processing result corresponding to the access request to the database access initiating module.
[0149] Specifically, the database access service engine that previously forwards the access request sends the processing result corresponding to the access request to the database access initiating module that previously forwards the access request.
[0150] For example, if the access request is forwarded to the database access scheduling module 331 through the database access initiating module 111 and the database access service engine 121, after the database access scheduling module 331 sends the processing result corresponding to the access request to the database access service engine 121, the database access service engine 121 sends the processing result to the database access initiating module 111.
[0151] For example, if the access request is forwarded to the database access scheduling module 333 via the database access initiation module 112 and the database access service engine 122, the database access scheduling module 333 sends the processing result corresponding to the access request to the database access service engine 122, and then the database access service engine 122 sends the processing result to the database access initiation module 112.
[0152] In step S521, the database access initiation module sends the processing result corresponding to the access request to the application.
[0153] Specifically, the database access initiation module that previously forwards the access request sends the processing result corresponding to the access request to the application that generates the access request (i.e., the application that the database access initiation module serves). For example, after the database access initiation module 111 receives the processing result corresponding to the access request from the access service engine 121, the database access initiation module 111 sends the processing result to the application that previously generates the access request. In this way, the application obtains the processing result corresponding to the access request, for example, obtains the query result obtained by the database instance 231 according to the SQL format statement included in the access request.
[0154] If the database instance is located in a local area network, steps S511 to S521 can be used to implement the access of the application to the database instance in the local area network. In one application scenario, the application, the database access initiation module 111, and the access service engine 121 are all deployed in a public cloud, and the database access scheduling module 331, the database instance 371, and the database instance 372 are deployed in a private cloud. The network used by the public cloud is different from the local area network 381 used by the private cloud. However, the database access scheduling module 331 successfully establishes a communication connection with the access service engine 121 by using the IP address of the access service engine 121 in advance, and based on the communication connection, the application can implement the access to the database access scheduling module 331 in the local area network 381 through the access service engine 121, thereby indirectly implementing the access to the database instance (for example, the database instance 371 or the database instance 372) in the local area network 381.
[0155] If the database instance and the database access service engine are located in the same network (for example, the network used by the public cloud), steps S511 to S521 can be used to implement the access of the application to the database instance in the same network.
[0156] Based on Figure 3 Based on the architecture shown in FIG. 1, the present application provides a database access method. The database access method is described in combination with Figure 5 In the database access method shown in FIG. 2, the steps included in the database access method are further optimized from the security perspective. Figure 3 In the database access method shown in FIG. 2, the steps included in the database access method are further optimized from the security perspective.
[0157] As a possible implementation of step S511, when the database access scheduling module initiatively establishes a communication connection with the database access engine, the database access scheduling module sends the public key of the database access engine to the database access engine, so that the database access engine performs authentication of whether to agree to establish the communication connection according to the public key. In addition, if the communication connection is successfully established, the database access scheduling module encrypts data that needs to be sent to the database access engine using the public key.
[0158] For example, in the architecture shown in Figure 3 In the architecture shown in FIG. 3, the database access engine 122 generates a public key and a private key for the database access engine 122 to use, and stores the public key and the private key in the meta database 14. The database access scheduling module uses the public key of the database access engine 122 to request to establish a communication connection with the database access engine 122, and the database access engine 122 queries the meta database 14 using the public key. If the meta database 14 records the public key as the public key of the database access engine 122, the authentication is successful, and the database access engine 122 successfully establishes a communication connection with the database access scheduling module. Subsequently, based on the communication connection between the database access engine 122 and the database access scheduling module (for example, the database access scheduling module 332 or the database access scheduling module 333), for data that the database access scheduling module needs to send to the database access engine 122, the database access scheduling module uses the public key of the database access engine 122 to encrypt the data, and then sends the encrypted data to the database access engine 122 based on the communication connection.
[0159] As a possible implementation of step S518, for a processing result corresponding to an access request sent by the database access scheduling module to the database access engine, the database access scheduling module uses the public key of the database access engine to encrypt the processing result, and sends the encrypted processing result to the database access engine.
[0160] For example, in the architecture shown in Figure 6 In the architecture shown in FIG. 3, after the database access scheduling module 333 receives a processing result corresponding to an access request from the database instance 373, the database access scheduling module 333 uses the public key of the database access engine 122 to encrypt the processing result, and sends the encrypted processing result to the database access engine 122.
[0161] As a possible implementation, data (for example, an application-generated access request) sent by the database access engine to the database access scheduling module is encrypted using the public key of the database access scheduling module, and the database access engine sends the encrypted data to the database access scheduling module. Accordingly, the database access scheduling module uses the private key of the database access scheduling module to decrypt the data from the encrypted data.
[0162] For example, the database access scheduling module 332 generates a public key and a private key for use by the database access scheduling module 332, and stores the public key and the private key. The database access scheduling module 332 sends the public key to the database access engine 122. Subsequently, the database access engine 122 encrypts an access request using the public key, and sends the encrypted access request to the database access scheduling module 332. Accordingly, the database access scheduling module 332 decrypts the access request from the encrypted access request using the private key.
[0163] The application also provides a database access initiating module (for example, the database access initiating module 111 or the database access initiating module 112 or the database access initiating module 113), which is deployed on a computing device (for example, a server) of the application. The database access initiating module includes functional units for the database access initiating module to implement the above-mentioned database access method; the application does not limit how to divide the functional units in the database access initiating module, and the following exemplary provides a division of the functional units, as shown in the following. Figure 6
[0164] The database access initiating module 600 shown in the following is used for the purpose of illustration, and the database access initiating module 600 includes: Figure 7 A receiving unit 602, configured to receive an access request of an application, the access request carrying an identifier of a database instance;
[0165] A determining unit 601, configured to determine a database access service engine, the database access service engine being independent of the application, and the database access service engine being configured to establish a connection for accessing the database instance;
[0166] A sending unit 603, configured to send the access request to the determined database access service engine, the database access service engine having an ability to send the access request to the database instance
[0167] Optionally, the determining unit 601 is configured to select one database access service engine from a plurality of database access service engines.
[0168] Optionally, the determining unit 601 is configured to select one database access service engine from a plurality of database access service engines according to loads of the plurality of database access service engines.
[0169] Optionally, the determining unit 601 is configured to select a database access service engine with a minimum load from a plurality of database access service engines.
[0170] Optionally, the determining unit 601 is configured to select a database access service engine with a minimum load from a plurality of database access service engines.
[0171] Optionally, the determining unit 601 is configured to determine, according to the identifier of the database instance carried in the access request, a database access service engine bound to the identifier of the database instance.
[0172] Optionally, the determining unit 601 is configured to determine, according to the identifier of the database access scheduling module carried in the access request, a database access service engine bound to the database access scheduling module, the database access scheduling module being configured to send the access request received from the database access service engine to the database instance.
[0173] Optionally, the receiving unit 602 is configured to receive a processing result corresponding to the access request sent by the database access service engine; and the sending unit 603 is configured to send the processing result to the application.
[0174] The present application also provides a database access service engine (for example, the database access service engine 121 or the database access service engine 122 or the database access service engine 123), which is deployed on a computing device (for example, a server) of the present application. The database access service engine comprises functional units for implementing the above-mentioned database access method by the database access initiating module; the present application does not limit how to divide the functional units in the database access service engine, and the following exemplary provides a division of the functional units, as shown in the following. Figure 7
[0175] As shown in the database access service engine 700 shown in the following. Figure 8
[0176] The receiving unit 701 is configured to receive an access request sent by a database access initiating module, the access request carrying an identifier of a database instance.
[0177] The sending unit 702 is configured to send the access request to the database instance, or send the access request to a database access scheduling module associated with the database instance.
[0178] Optionally, the database access service engine comprises:
[0179] The connection establishing unit 703 is configured to establish a connection between the database access service engine and the database instance according to the identifier of the database instance, the connection being configured to transmit data between the database access service engine and the database instance.
[0180] Optionally, the sending unit 702 is configured to send the access request to the database instance according to the keyword carried in the access request and the connection between the database access service engine and the database instance that is established by using the keyword.
[0181] Optionally, the sending unit 702 is configured to send the access request to the database access scheduling module according to the identifier of the database access scheduling module carried in the access request.
[0182] Optionally, the receiving unit 701 is configured to receive a processing result corresponding to the access request sent by the database instance or receive a processing result corresponding to the access request sent by the database access scheduling module.
[0183] Correspondingly, the sending unit 702 is configured to send a processing result corresponding to the access request to the database access initiating module.
[0184] The application further provides a database access scheduling module (for example, the database access scheduling module 331 or the database access scheduling module 332 or the database access scheduling module 333), which is deployed on a computing device (for example, a server) of the application. The database access scheduling module comprises functional units for the database access scheduling module to implement the above-mentioned database access method; the application does not limit how to divide the functional units in the database access scheduling module, and the following exemplary provides a division of the functional units, as shown in the following. Figure 8
[0185] As shown in the database access scheduling module 800 shown in the following. Figure 9 The database access scheduling module 800 comprises:
[0186] The connection establishing unit 803 is configured to establish a communication connection with the database access service engine by using an identifier of the database access service engine.
[0187] The receiving unit 801 is configured to receive an access request sent by the database access service engine, wherein the access request carries an identifier of a database instance.
[0188] The sending unit 802 is configured to send the access request to the database instance.
[0189] Optionally, the identifier of the database access service engine is an IP address of the database access service engine.
[0190] Optionally, the connection establishing unit 803 is configured to send a request for establishing the communication connection to the database access service engine, the request carrying an identifier of the database access service engine and a public key of the database access service engine, the public key of the database access service engine being used for authentication of the database access engine for establishing the communication connection.
[0191] Optionally, the database access scheduling module 800 comprises:
[0192] The decryption unit 804 is configured to, when the access request received by the database access scheduling module from the database access service engine is an access request encrypted based on a public key of the database access scheduling module, decrypt the encrypted access request using a private key of the database access scheduling module to obtain an access request, and send the decrypted access request to the database instance by the sending unit 802.
[0193] Optionally, the receiving unit 801 is configured to receive a processing result corresponding to the access request sent by the database instance.
[0194] The sending unit 802 is configured to send the processing result to the database access service engine.
[0195] Optionally, the database access scheduling module 800 comprises:
[0196] The encryption unit 805 is configured to encrypt the processing result using a public key of the database access service engine, and send the encrypted processing result to the database access service engine by the sending unit 802.
[0197] Optionally, Figure 9 A possible basic hardware architecture of the computing device described in the present application is schematically provided.
[0198] Referring to Figure 9 The computing device 900 comprises a processor 901, a memory 902, a communication interface 903 and a bus 904.
[0199] In the computing device 900, the number of processors 901 can be one or more, Figure 9 Only one processor 901 is shown. Optionally, the processor 901 can be a central processing unit (CPU). If the computing device 900 has multiple processors 901, the types of the multiple processors 901 can be different or can be the same. Optionally, the multiple processors 901 of the computing device 900 can also be integrated as a multi-core processor.
[0200] The memory 902 stores computer instructions and data; the memory 902 can store computer instructions and data required for implementing the database access method provided in the present application, for example, the memory 902 stores instructions for implementing the steps performed by the database access initiation module in the database access method, for another example, the memory 902 stores instructions for implementing the steps performed by the database access service engine in the database access method, and for another example, the memory 902 stores instructions for implementing the steps performed by the database access implementation module (for example, a database instance, for example, a database access scheduling module) in the database access method. The memory 902 can be any one or any combination of the following storage media: non-volatile memory (for example, read-only memory (ROM), solid state disk (SSD), hard disk (HDD), optical disk), volatile memory.
[0201] The communication interface 903 can be any one or any combination of the following devices: a network interface (for example, an Ethernet interface), a wireless network card, and the like devices with network access functions.
[0202] The communication interface 903 is used for data communication between the computing device 900 and other computing devices or terminals.
[0203] The bus 904 is represented by a thick line. The bus 904 can connect the processor 901 with the memory 902 and the communication interface 903. In this way, the processor 901 can access the memory 902 through the bus 904, and also can interact with other computing devices or terminals through the communication interface 903.
[0204] In the present application, the computing device 900 executes computer instructions in the memory 902, so that the computing device 900 implements the database access method provided in the present application, for example, the computing device performs the steps performed by the database access initiation module in the database access method, for another example, the computing device performs the steps performed by the database access service engine in the database access method, and for another example, the computing device performs the steps performed by the database access implementation module (for example, a database instance, for example, a database access scheduling module) in the database access method.
[0205] The application provides a computer readable storage medium, which stores computer instructions. When the processor 901 of the computing device 900 executes the computer instructions, the computing device 900 performs the steps performed by the database access initiation module in the database access method, or the computing device 900 performs the steps performed by the database access service engine in the database access method, or the computing device 900 performs the steps performed by the database access implementation module (for example, a database instance, for example, a database access scheduling module) in the database access method.
[0206] The application provides a computer program product, which comprises computer instructions stored in a computer readable storage medium. The processor 901 of the computing device 900 can read the computer instructions from the computer readable storage medium, and the processor 901 executes the computer instructions, so that the computing device 900 performs the steps performed by the database access initiation module in the database access method, so that the computing device 900 performs the steps performed by the database access service engine in the database access method, and so that the computing device 900 performs the steps performed by the database access implementation module (for example, a database instance, for example, a database access scheduling module) in the database access method.
[0207] The application provides a computer program product, which comprises computer instructions stored in a computer readable storage medium. The processor 901 of the computing device 900 can read the computer instructions from the computer readable storage medium, and the processor 901 executes the computer instructions, so that the computing device 900 performs the steps performed by the database access initiation module in the database access method, so that the computing device 900 performs the steps performed by the database access service engine in the database access method, and so that the computing device 900 performs the steps performed by the database access implementation module (for example, a database instance, for example, a database access scheduling module) in the database access method.
[0208] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified; and these modifications do not make the corresponding technical solutions deviate from the protection scope of the claims.
Claims
1. A database access method, characterized by, The method comprises: The database access scheduling module initiatively establishes a communication connection with the database access service engine using the identifier of the database access service engine, the database access scheduling module is deployed in a local area network, and the database access service engine is deployed in a public cloud, the local area network being independent of the public cloud; The database access scheduling module receives an access request sent by the database access service engine, the access request carrying an identifier of a database instance, the database instance being deployed in the local area network, the identifier of the database instance being an IP address of the database instance, or the identifier of the database instance being an IP address and a port number of the database instance; The database access scheduling module sends the access request to the database instance.
2. The method of claim 1, wherein, The identifier of the database access service engine is an IP address of the database access service engine.
3. The method of claim 1, wherein, The database access scheduling module initiatively establishes a communication connection with the database access service engine using the identifier of the database access service engine, the database access scheduling module is deployed in a local area network, and the database access service engine is deployed in a public cloud, the local area network being independent of the public cloud; The database access scheduling module sends a request for establishing the communication connection to the database access service engine, the request carrying the identifier of the database access service engine and a public key of the database access service engine, the public key of the database access service engine being used for authentication of the database access service engine for establishing the communication connection.
4. The method of claim 1, wherein, The method comprises: When the access request received by the database access scheduling module from the database access service engine is an access request encrypted based on a public key of the database access scheduling module, the database access scheduling module decrypts the encrypted access request using a private key of the database access scheduling module to obtain an access request, and sends the decrypted access request to the database instance.
5. The method of claim 1, wherein, The method comprises: The database access scheduling module receives a processing result corresponding to the access request sent by the database instance; The database access scheduling module sends the processing result to the database access service engine.
6. The method of claim 5, wherein, The method comprises: The database access scheduling module encrypts the processing result using a public key of the database access service engine, and sends the encrypted processing result to the database access service engine.
7. The method according to any one of claims 1 to 6, characterized in that, The database access service engine is independent of an application that generates the access request.
8. A database access scheduling module, characterized by The database access scheduling module comprises: A connection establishing unit is configured to establish a communication connection with the database access service engine using an identifier of the database access service engine, the database access scheduling module being deployed in a local area network, and the database access service engine being deployed in a public cloud, the local area network being independent of the public cloud; A receiving unit is configured to receive an access request sent by the database access service engine, the access request carrying an identifier of a database instance, the database instance being deployed in the local area network, the identifier of the database instance being an IP address of the database instance, or the identifier of the database instance being an IP address and a port number of the database instance; A sending unit is configured to send the access request to the database instance.
9. The database access scheduling module of claim 8, wherein, The identifier of the database access service engine is an IP address of the database access service engine. 10.The database access scheduling module of claim 8, wherein, The connection establishing unit is configured to send a request for establishing the communication connection to the database access service engine, the request carrying an identifier of the database access service engine and a public key of the database access service engine, the public key of the database access service engine being used for the database access service engine to authenticate the establishment of the communication connection.
11. The database access scheduling module of claim 8, wherein, The database access scheduling module comprises: The decryption unit is configured to, when the access request received by the database access scheduling module from the database access service engine is an access request encrypted based on a public key of the database access scheduling module, decrypt the encrypted access request to obtain an access request using a private key of the database access scheduling module, so that the sending unit sends the decrypted access request to the database instance. 12.The database access scheduling module of any of claims 8 to 11, wherein, The receiving unit is configured to receive a processing result corresponding to the access request sent by the database instance; The sending unit is configured to send the processing result to the database access service engine. 13.The database access scheduling module of claim 12, wherein, The encryption unit is configured to encrypt the processing result using a public key of the database access service engine, so that the sending unit sends the encrypted processing result to the database access service engine.
14. A computing device, comprising: The computing device comprises a processor and a memory; The memory is configured to store computer instructions; The processor is configured to execute the computer instructions stored in the memory, so that the computing device performs the steps implemented by the database access scheduling module in the method of any of claims 1 to 7.
15. A computer program product, characterised in that, The computer program product comprises computer instructions, which instruct a computing device to perform the steps implemented by the database access scheduling module in the method of any of claims 1 to 7. The computer program product comprises computer instructions, which instruct a computing device to perform the steps implemented by the database access scheduling module in the method of any of claims 1 to 7.
Citation Information
Patent Citations
Method, device and system for realizing database multipath access
CN106131233A
Method and apparatus to rotate data encryption keys in databases with no down time
US20150310221A1