A method and system for establishing connection between JDBC and OLAP database cluster

By introducing the connection staging area and load balancing distribution mechanism into JDBC and OLAP database clusters, the problem that traditional JDBC drivers cannot collaboratively access multiple database instances is solved, and efficient load balancing and high-availability connections are achieved, which is suitable for large-scale OLAP databases. Clustered multidimensional data analysis and data mining scenarios.

CN118277210BActive Publication Date: 2024-09-24TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410698321.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-24
Estimated Expiration
2044-05-31

AI Technical Summary

Technical Problem

The traditional JDBC driver cannot effectively perform collaborative access with multiple database instances in a large-scale OLAP database cluster, and cannot meet the need to efficiently establish reliable connections, especially in multi-dimensional data analysis and data mining scenarios.

Method used

Provides a method to establish a connection between JDBC and OLAP database cluster. It initializes connection parameters, sets the connection temporary area, and uses the distribution mechanism of polling, real-time load minimization and periodic load minimization to obtain the node IP, borrow and maintain available connections to ensure load balancing and high availability.

Benefits of technology

It realizes efficient load balancing connections to large-scale OLAP database clusters, avoids waste of resources, improves access efficiency, ensures the availability and reliability of connections in the event of node failure, and supports high availability and load balancing of applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The present invention provides a method and system for establishing a connection between a JDBC and an OLAP database cluster, belonging to the technical field of databases. The method comprises: initializing connection parameters, and setting a connection temporary storage area including node IP and connection set mapping; responding to an upstream program's connection application request, and analyzing a distribution mechanism for obtaining the connection application request; obtaining a node IP corresponding to the connection application request through a corresponding distribution mechanism; borrowing a distribution connection from a connection temporary storage area according to the node IP, and returning the distribution connection to a caller when the distribution connection is available, so as to complete the connection establishment. The present invention can establish a connection between a JDBC and an OLAP database cluster in a load balancing manner, thereby improving access efficiency and ensuring the availability and reliability of the connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a method and system for establishing a connection between a JDBC and an OLAP database cluster. Background Art

[0002] Large-scale OLAP database clusters for online analytical processing often store massive amounts of data, and data retrieval and query often involve the collaboration of multiple cluster nodes. Establishing efficient and reliable connections with them is a prerequisite for multidimensional data analysis and data mining, and is crucial.

[0003] Traditional JDBC drivers usually establish a connection with a single database instance for data access, which cannot meet the scenario of collaborative access to multiple database instances in a large-scale OLAP database cluster. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides a method and system for establishing a connection between JDBC and an OLAP database cluster.

[0005] The present invention provides a method for establishing a connection between a JDBC and an OLAP database cluster, comprising:

[0006] S1: Initialize connection parameters and set up a connection temporary storage area including node IP and connection set mapping;

[0007] S2: responding to the connection request of the upstream program, and analyzing and obtaining the distribution mechanism of the connection request, wherein the distribution mechanism includes polling, real-time load minimization and periodic load minimization;

[0008] S3: Obtain the node IP corresponding to the connection application request through the corresponding distribution mechanism;

[0009] S4: Borrowing a distribution connection from the connection temporary storage area according to the node IP, and when the distribution connection is available, returning the distribution connection to the caller to complete the connection establishment.

[0010] According to a method for establishing a connection between a JDBC and an OLAP database cluster provided by the present invention, the connection parameters in step S1 include: a high availability switch, a host list, a cluster ID, an invalid connection detection cycle, a load balancing strategy, an initial number of connections, a minimum number of connections, and a maximum number of connections.

[0011] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S3 specifically includes:

[0012] When the distribution mechanism is polling, the polled node IP is used as the node IP corresponding to the connection request;

[0013] When the distribution mechanism is real-time load minimization, the database server obtains the node IP with the smallest load as the node IP corresponding to the connection request;

[0014] When the distribution mechanism is periodic load minimization, the node IP with the minimum load is obtained from the locally cached cluster load information as the node IP corresponding to the connection request.

[0015] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S4 further comprises:

[0016] S41: Determine whether there is an idle connection in the connection temporary storage area, if there is an idle connection, execute step S42, if there is no idle connection, execute step S43;

[0017] S42: Determine whether an existing idle connection is available. If the connection is available, use the available connection as a distribution connection and return the distribution connection to the caller.

[0018] S43: After creating an idle connection and storing the created idle connection in a connection temporary storage area, the connection temporary storage area borrows the idle connection as a distribution connection, and returns the distribution connection to the caller.

[0019] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S42 further includes:

[0020] S421: When the idle connection is unavailable, the unavailable connection is released, and the abnormal node in the connection temporary storage area is updated.

[0021] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S4 further includes:

[0022] S44: when a connection is borrowed and distributed from the connection temporary storage area according to the node IP, maintaining the connection in the connection set of the connection temporary storage area;

[0023] Step S44 specifically includes:

[0024] S441: Clean up invalid connections;

[0025] S442: Maintain the number of connections;

[0026] S443: Release the expired connection.

[0027] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S441 specifically includes:

[0028] S4411: Monitor the connection status corresponding to the node IP in the connection temporary storage area, and take the node IP with abnormal connection status as the faulty node IP;

[0029] S4412: Remove and release the idle connections in the connection set corresponding to the IP address of the faulty node;

[0030] Step S4411 specifically includes:

[0031] S44111: Interact with each cluster server to confirm the node IP availability;

[0032] S44112: Monitor the node status in the locally cached node information to confirm the node IP availability.

[0033] According to a method for establishing a connection between JDBC and an OLAP database cluster provided by the present invention, step S442 specifically includes:

[0034] S4421: when the number of idle connections in the connection temporary storage area is less than the minimum number of connections, adding idle connections until the number of idle connections in the connection temporary storage area is greater than or equal to the minimum number of connections;

[0035] S4422: when the number of idle connections in the connection temporary storage area is greater than the maximum number of connections, reducing the idle connections until the number of idle connections in the connection temporary storage area is less than or equal to the maximum number of connections;

[0036] Step S4421 specifically includes:

[0037] S44211: remove any node IP from the normal node queue in the connection temporary storage area;

[0038] S44212: Create a connection based on the node IP that has exited the queue;

[0039] S44213: Add the created connection to the mapping corresponding to the node IP that is out of the queue in the connection temporary storage area;

[0040] Step S4422 specifically includes:

[0041] S44221: remove any node IP from the normal node queue in the connection temporary storage area;

[0042] S44222: Remove any idle connection from the mapping corresponding to the node IP dequeued from the connection temporary storage area;

[0043] S44223: Release the removed idle connection.

[0044] The present invention also provides a system for establishing a connection between JDBC and an OLAP database cluster, which is used to execute a method for establishing a connection between JDBC and an OLAP database cluster as described in any one of the above items, including:

[0045] Initialization module: used to initialize connection parameters and set up a connection temporary storage area including node IP and connection set mapping;

[0046] Connection distribution module: used to respond to the connection request of the upstream program and analyze and obtain the distribution mechanism of the connection request, which includes polling, real-time load minimization and periodic load minimization;

[0047] It is also used to obtain the node IP corresponding to the connection request through the corresponding distribution mechanism;

[0048] It is also used to borrow a distribution connection from the connection temporary storage area according to the node IP, and when the distribution connection is available, return the distribution connection to the caller to complete the connection establishment;

[0049] Connection management module: used to clean up invalid connections in the connection buffer, maintain the number of connections in the connection buffer, and release expired connections in the connection buffer.

[0050] A system for establishing a connection between JDBC and an OLAP database cluster provided by the present invention also includes:

[0051] Node monitoring module: used to monitor the availability status and load information of cluster nodes.

[0052] The present invention provides a method and system for establishing a connection between JDBC and an OLAP database cluster, so as to meet the scenario of collaborative access to multiple database instances of a large-scale OLAP database cluster. The method can not only efficiently establish a connection with the large-scale OLAP database cluster in a load balancing manner, and evenly distribute the connections used by users to the database cluster nodes; the established connections can also be placed in a temporary storage area, so as to avoid the waste of resources caused by repeated establishment of connections and improve the access efficiency; in addition, the connections in the temporary storage area are cleaned up in time when a node fails, so as to ensure the availability and reliability of the connections.

[0053] The present invention is applied to the scenario where JDBC performs collaborative access to multiple database instances of a large-scale OLAP database cluster. The large-scale OLAP database cluster is composed of multiple nodes. When an exception occurs in one cluster node, other cluster nodes can still provide available connections for the application to ensure the availability of the application.

[0054] The present invention enables the JDBC driver to provide an advanced feature for the upstream application program, that is, when a cluster node cannot be connected normally, JDBC automatically uses another cluster node for connection switching without modifying the application code, and can evenly distribute the database connection requests to each node, thereby achieving high availability and load balancing of the application to the cluster nodes.

[0055] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0057] Figure 1 The present invention provides a flow chart of a method for establishing a connection between JDBC and an OLAP database cluster.

[0058] Figure 2 The present invention provides a schematic diagram of a system structure for establishing a connection between JDBC and an OLAP database cluster.

[0059] Reference numerals:

[0060] 100, initialization module; 200, connection temporary storage area; 300, connection distribution module; 400, connection management module; 500, node monitoring module. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0062] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0063] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.

[0064] The present invention provides a method for establishing a connection between a JDBC and an OLAP database cluster, comprising:

[0065] S1: Initialize connection parameters and set up a connection temporary storage area including node IP and connection set mapping;

[0066] In this phase, various connection parameters are initialized first, and the connection management function and node status monitoring function are started, which specifically include: setting connection initialization parameters; initializing the connection temporary storage area; starting the connection management thread; and starting the node status monitoring thread.

[0067] In addition, the so-called connection temporary storage area mentioned above is a memory area allocated by JDBC for caching connections. It maintains two queues, one queue is used to store normal connection nodes, and the other queue is used to store abnormal connection nodes. In addition, it also maintains a mapping, that is, the mapping of each node IP and the connection set. During initialization, JDBC will initialize a batch of connections according to the number specified by the initial connection number and evenly distribute them to the host list specified by the user, and put the connections in the temporary storage area for standby.

[0068] The connection parameters in step S1 include: high availability switch, host list, cluster ID, invalid connection detection period, load balancing strategy, initial number of connections, minimum number of connections and maximum number of connections.

[0069] Furthermore, the above parameters are all configuration item names, among which the keyword for enabling high availability is failoverEnable, which determines whether to enable high availability; the keyword for the host list is hostlist, which is a list of IP addresses of cluster nodes separated by commas, and hostList does not need to include the primary IP address in the url; the keyword for the cluster ID is gclusterId, and different lists will be created for different gclusterIds to distinguish the connected clusters; the keyword for the invalid connection detection period is testInvalidConnPeriod, which determines how long to detect invalid connections in a temporary storage area and clean them up; the keyword for the load balancing strategy is lbsStrategy, which is a connection distribution strategy; the keyword for the initial number of connections is initSize, which is the number of connections cached during initialization; the keyword for the maximum number of connections is maxSize, which is the maximum number of connections that can be saved; the keyword for the minimum number of connections is minSize, which is the minimum number of connections that need to be saved.

[0070] S2: responding to the connection request of the upstream program, and analyzing and obtaining the distribution mechanism of the connection request, wherein the distribution mechanism includes polling, real-time load minimization and periodic load minimization;

[0071] This stage first determines the connection distribution mechanism, which specifically includes three types: polling: polling the connection requested by the application to each node in the database cluster; real-time minimum load: each time a connection is requested, first request the IP address of the node with the smallest current load from the database server, then find the corresponding connection from the temporary storage area based on the IP address and return it to the application; periodic minimum load: JDBC will save a copy of the load information of each node in the database cluster locally and update this information regularly. Each time an application requests a connection, first obtains the IP address of the node with the smallest current load from this local cache information, then finds the corresponding connection from the temporary storage area based on the IP address and returns it to the application.

[0072] S3: Obtain the node IP corresponding to the connection application request through the corresponding distribution mechanism;

[0073] Wherein, step S3 specifically includes:

[0074] When the distribution mechanism is polling, the polled node IP is used as the node IP corresponding to the connection request;

[0075] When the distribution mechanism is real-time load minimization, the database server obtains the node IP with the smallest load as the node IP corresponding to the connection request;

[0076] When the distribution mechanism is periodic load minimization, the node IP with the minimum load is obtained from the locally cached cluster load information as the node IP corresponding to the connection request.

[0077] In this stage, if the distribution mechanism is polling, obtain the polled node IP; if the real-time load is the smallest, obtain the node IP with the smallest load from the database server; if the periodic load is the smallest, obtain the node IP with the smallest load from the locally cached cluster load information; borrow a connection from the connection buffer based on the obtained node IP.

[0078] S4: Borrowing a distribution connection from the connection temporary storage area according to the node IP, and when the distribution connection is available, returning the distribution connection to the caller to complete the connection establishment.

[0079] After steps S2 and S3, the node IP corresponding to the connection request is obtained, and then the connection is borrowed from the temporary storage area and returned to the caller, and then the connection is returned to the connection temporary storage area.

[0080] Wherein, step S4 further comprises:

[0081] S41: Determine whether there is an idle connection in the connection temporary storage area, if there is an idle connection, execute step S42, if there is no idle connection, execute step S43;

[0082] S42: Determine whether an existing idle connection is available. If the connection is available, use the available connection as a distribution connection and return the distribution connection to the caller.

[0083] Wherein, step S42 also includes:

[0084] S421: when the idle connection is unavailable, the unavailable connection is released, and the abnormal node in the connection temporary storage area is updated;

[0085] S43: After creating an idle connection and storing the created idle connection in a connection temporary storage area, the connection temporary storage area borrows the idle connection as a distribution connection, and returns the distribution connection to the caller.

[0086] When borrowing a connection from the connection buffer, it is first necessary to determine whether there is an idle connection in the buffer. If there is an idle connection, determine whether the connection is available. If the connection is available, borrow a connection from the mapping and return it to the caller. If the connection is not available, release the connection, fail to obtain the connection, and update the normal node queue and abnormal node queue in the buffer at the same time. If there is no idle connection, create a new connection, put the new connection into the buffer mapping, and then borrow a connection from the mapping and return it to the caller.

[0087] Furthermore, when returning the connection to the connection buffer, first check whether the connection is available. If the connection is available, return the connection to the buffer. If the connection is not available, remove the connection from the buffer mapping and release the connection.

[0088] Wherein, step S4 also includes:

[0089] S44: when a connection is borrowed and distributed from the connection temporary storage area according to the node IP, maintaining the connection in the connection set of the connection temporary storage area;

[0090] In some embodiments, the execution process of step S44, specifically steps S441 to S443, is: clear invalid connections, maintain the number of connections, release expired connections, sleep for 1 second, and repeat steps S441 to S443.

[0091] Step S44 specifically includes:

[0092] S441: Clean up invalid connections;

[0093] Step S441 specifically includes:

[0094] S4411: Monitor the connection status corresponding to the node IP in the connection temporary storage area, and take the node IP with abnormal connection status as the faulty node IP;

[0095] Step S4411 specifically includes:

[0096] S44111: Interact with each cluster server to confirm the node IP availability;

[0097] S44112: Monitor the node status in the locally cached node information to confirm the node IP availability.

[0098] S4412: Remove and release the idle connections in the connection set corresponding to the IP address of the faulty node;

[0099] In the above process of cleaning up invalid connections, when JDBC detects that a node in the cluster fails, all idle connections corresponding to the node in the temporary storage area must be cleaned up, while connections that have been borrowed are ignored.

[0100] Specifically, first obtain the connection status corresponding to each node IP in the temporary storage area. Then, if the connection status is abnormal, it means that the node is faulty and needs to be cleaned up. Then determine whether there are idle connections in the connection set corresponding to the faulty node IP in the temporary storage area. If there are idle connections, remove and release all idle connections from the temporary storage area mapping, and update the normal node queue and abnormal node queue in the temporary storage area.

[0101] There are two mechanisms for monitoring status:

[0102] Each time a test is performed, the server actually interacts with the cluster server to determine whether the node IP is available.

[0103] The node status monitoring function relies on the node information cached locally to determine whether the node IP is available.

[0104] The specific process of the first mechanism mentioned above is: obtain a connection from the temporary storage area, if the connection is successfully borrowed, determine whether the connection is available, if the connection is available, set the state to available, otherwise set the state to unavailable.

[0105] The specific process of the second mechanism is as follows: obtaining local cache node information, obtaining information on whether the node is available from the locally cached node information, and if available, setting the state to available, otherwise setting the state to unavailable.

[0106] S442: Maintain the number of connections;

[0107] In this phase, maintaining the number of idle connections means ensuring that the number of idle connections in the temporary storage area meets the following conditions: maximum number of connections >= number of idle connections >= minimum number of connections, including: reducing connections and increasing connections. Increasing connections means that when the number of idle connections in the temporary storage area is less than the minimum number of connections, the connection management function will add connections to the temporary storage area, and reducing connections means that when the number of idle connections in the temporary storage area is greater than the maximum number of connections, the connection management function will reduce the number of idle connections in the temporary storage area.

[0108] Step S442 specifically includes:

[0109] S4421: when the number of idle connections in the connection temporary storage area is less than the minimum number of connections, adding idle connections until the number of idle connections in the connection temporary storage area is greater than or equal to the minimum number of connections;

[0110] Step S4421 specifically includes:

[0111] S44211: remove any node IP from the normal node queue in the connection temporary storage area;

[0112] S44212: Create a connection based on the node IP that has exited the queue;

[0113] S44213: Add the created connection to the mapping corresponding to the node IP that is out of the queue in the connection temporary storage area;

[0114] S4422: when the number of idle connections in the connection temporary storage area is greater than the maximum number of connections, reducing the idle connections until the number of idle connections in the connection temporary storage area is less than or equal to the maximum number of connections;

[0115] Step S4422 specifically includes:

[0116] S44221: remove any node IP from the normal node queue in the connection temporary storage area;

[0117] S44222: Remove any idle connection from the mapping corresponding to the node IP dequeued from the connection temporary storage area;

[0118] S44223: Release the removed idle connection.

[0119] S443: Release expired connection;

[0120] The connections saved in the temporary storage area all have a lifetime. When the lifetime of a connection expires, the connection management function will clear the expired connection. The specific process is as follows: traverse the connection set mapped by each node IP in the temporary storage area. For each connection, determine whether the connection timeout is greater than the current time. If the connection timeout is greater than the current time, remove the connection from the temporary storage area mapping and release the connection.

[0121] The present invention also provides a system for establishing a connection between JDBC and an OLAP database cluster, which is used to execute a method for establishing a connection between JDBC and an OLAP database cluster as described in any one of the above items, including:

[0122] Initialization module 100: used to initialize connection parameters and set a connection temporary storage area 200 including node IP and connection set mapping;

[0123] The connection distribution module 300 is used to respond to the connection application request of the upstream program and analyze and obtain the distribution mechanism of the connection application request, wherein the distribution mechanism includes polling, real-time load minimization and periodic load minimization;

[0124] It is also used to obtain the node IP corresponding to the connection request through the corresponding distribution mechanism;

[0125] It is also used to borrow a distribution connection from the connection temporary storage area according to the node IP, and when the distribution connection is available, return the distribution connection to the caller to complete the connection establishment;

[0126] The connection management module 400 is used to clean up invalid connections in the connection temporary storage area 200, maintain the number of connections in the connection temporary storage area 200, and release expired connections in the connection temporary storage area 200.

[0127] Among them, it also includes:

[0128] Node monitoring module 500: used to monitor the availability status and load information of cluster nodes.

[0129] Furthermore, the node monitoring module is used to monitor the availability and load information of all nodes in the cluster. It will cache the information of all nodes in the cluster locally in JDBC for use by the connection distribution module and the connection management module.

[0130] The node monitoring module has two mechanisms: JDBC periodically requests the database server for status information of all cluster nodes; JDBC starts a monitoring, and the database server actively notifies JDBC when the status of a cluster node changes.

[0131] For the first mechanism mentioned above, its workflow is: JDBC connects to the database server to obtain all node status information; updates the local cache; sleeps for a cycle; and repeats the above steps in a loop.

[0132] For the second mechanism mentioned above, the workflow is as follows: JDBC starts listening and waiting; receives node status change information from the database server; updates the local cache; and repeats the above steps in a loop.

[0133] The present invention provides a method and system for establishing a connection between JDBC and an OLAP database cluster. First, the connection parameters can be configured through an initialization module, such as whether to enable high availability, a host list, a load balancing mechanism, etc.; second, the concept of a temporary storage area is introduced in JDBC to maintain three structures, namely, a normal node queue, an abnormal node queue, and a node and connection mapping; third, on the basis of the temporary storage area, the connections applied for by the user are evenly distributed to the database cluster nodes through a connection distribution module, and the cluster node corresponding to the connection obtained by the user is the node with the smallest load; fourth, the invalid connections in the temporary storage area are actively cleaned up through a connection management module, so that the connection applied for by the user from JDBC is available; fifth, the node status information of the JDBC local cache can be updated in time through a node monitoring module to ensure that the connection status information is accurate, the connections used by the user can be evenly distributed to the database cluster nodes, and the connection cache can be cleaned up in time when a node fails.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for establishing a connection between JDBC and an OLAP database cluster, characterized in that: include: S1: Initialize connection parameters and set a connection temporary storage area including node IP and connection set mapping. The connection temporary storage area is a memory area allocated by JDBC for caching connections. The connection temporary storage area maintains two queues, one queue is used to store normal connection nodes, and the other queue is used to store abnormal connection nodes. The connection temporary storage area also maintains a mapping, which is the mapping of each node IP and the connection set; S2: responding to the connection request of the upstream program, and analyzing and obtaining the distribution mechanism of the connection request, wherein the distribution mechanism includes polling, real-time load minimization and periodic load minimization; S3: Obtain the node IP corresponding to the connection request through the corresponding distribution mechanism; specifically including: When the distribution mechanism is polling, the polled node IP is used as the node IP corresponding to the connection request; When the distribution mechanism is real-time load minimization, the database server obtains the node IP with the smallest load as the node IP corresponding to the connection request; When the distribution mechanism is periodic load minimization, the node IP with the minimum load is obtained from the locally cached cluster load information as the node IP corresponding to the connection request; S4: Borrowing a distribution connection from the connection temporary storage area according to the node IP, and returning the distribution connection to the caller when the distribution connection is available to complete the connection establishment; specifically including: S41: Determine whether there is an idle connection in the connection temporary storage area, if there is an idle connection, execute step S42, if there is no idle connection, execute step S43; S42: Determine whether an existing idle connection is available. If the connection is available, use the available connection as a distribution connection and return the distribution connection to the caller. S43: after creating an idle connection and storing the created idle connection in a connection temporary storage area, the connection temporary storage area borrows the idle connection as a distribution connection, and returns the distribution connection to the caller; S44: When a connection is borrowed and distributed from the connection temporary storage area according to the node IP, the connection in the connection set of the connection temporary storage area is maintained; specifically including: S441: Clean up invalid connections; specifically including: S4411: Monitor the connection status corresponding to the node IP in the connection temporary storage area, and take the node IP with abnormal connection status as the faulty node IP; specifically including: S44111: Interact with each cluster server to confirm the node IP availability; S44112: Monitor the node status in the locally cached node information to confirm the node IP availability; S4412: Remove and release the idle connections in the connection set corresponding to the IP address of the faulty node; S442: Maintain the number of connections; specifically includes: S4421: when the number of idle connections in the connection temporary storage area is less than the minimum number of connections, adding idle connections until the number of idle connections in the connection temporary storage area is greater than or equal to the minimum number of connections; S4422: when the number of idle connections in the connection temporary storage area is greater than the maximum number of connections, reducing the idle connections until the number of idle connections in the connection temporary storage area is less than or equal to the maximum number of connections; Step S4421 specifically includes: S44211: remove any node IP from the normal node queue in the connection temporary storage area; S44212: Create a connection based on the node IP that has exited the queue; S44213: Add the created connection to the mapping corresponding to the node IP that is dequeued in the connection temporary storage area; . Step S4422 specifically includes: S44221: remove any node IP from the normal node queue in the connection temporary storage area; S44222: Remove any idle connection from the mapping corresponding to the node IP dequeued from the connection temporary storage area; S44223: Release the removed idle connection; S443: Release the expired connection.

2. A method for establishing a connection between JDBC and an OLAP database cluster according to claim 1, characterized in that: The connection parameters in step S1 include: high availability switch, host list, cluster ID, invalid connection detection period, load balancing strategy, initial connection number, minimum connection number and maximum connection number.

3. A method for establishing a connection between JDBC and an OLAP database cluster according to claim 1, characterized in that: Step S42 also includes: S421: When the idle connection is unavailable, the unavailable connection is released, and the abnormal node in the connection temporary storage area is updated.

4. A system for establishing a connection between JDBC and an OLAP database cluster, used to execute a method for establishing a connection between JDBC and an OLAP database cluster as claimed in any one of claims 1 to 3, characterized in that: include: Initialization module: used to initialize connection parameters and set up a connection temporary storage area including node IP and connection set mapping; Connection distribution module: used to respond to the connection request of the upstream program and analyze and obtain the distribution mechanism of the connection request, which includes polling, real-time load minimization and periodic load minimization; It is also used to obtain the node IP corresponding to the connection request through the corresponding distribution mechanism; It is also used to borrow a distribution connection from the connection temporary storage area according to the node IP, and when the distribution connection is available, return the distribution connection to the caller to complete the connection establishment; Connection management module: used to clean up invalid connections in the connection buffer, maintain the number of connections in the connection buffer, and release expired connections in the connection buffer.

5. A system for establishing a connection between JDBC and OLAP database cluster according to claim 4, characterized in that: Also includes: Node monitoring module: used to monitor the availability status and load information of cluster nodes.