Home > database >  GBase JDBC high availability cluster load balancing application configuration
GBase JDBC high availability cluster load balancing application configuration

Time:03-29

One, an overview of the
If we want to have a database connection requests on the words of evenly distributed to various nodes, we can make the

Using GBase JDBC high availability cluster load balancing (this feature requires GBase JDBC 8.3.81.53 _build51. 1 and above version,),

High availability of load balancing is GBaseJDBC in view of the cluster development of the client side load balancing function on the level of interface, the function can send the client to the database connection request distribution to the various nodes, in GBaseJDBC8.3.81.53 _built51. 1 version of load balancing strategy for polling,
Second, the use of scene
Suppose you have the following scenario:

1, the deployment of a GBase cluster, three nodes IP is as follows:

192.168.1.56;

192.168.1.57;

192.168.1.58;

If the three nodes is a management node and data nodes, if we want to have a database connection requests between the three nodes, creating a connection set when failoverEnable, hostList, gclusterId three parameters can,
Connection string written as follows:

The String URL=
"JDBC: gbase://192.168.1.56:5258/test? User=gbase& Password=xxxxxx& FailoverEnable=true& HostList=192.168.1.57, 192.168.1.58 & amp; GclusterId=gcl1 "

Including gclusterId parameter value scope: must begin with a - z any character can contain a to z, 0-9 all character string length is up to 20,

.

For (int I=0; I & lt; 9. I++) {

DriverManager. GetConnection (SampleGBaseJDBCLoadbalance. URL);

}

.

The above code will create nine connection, assuming three nodes are available, the execution result is assigned to each node three connection; If one of the node is not available, GBaseJDBC driver will take 9 database connection requests assigned to two other nodes,

Note:

High availability of load balancing feature set contains high availability, high available when starting in high availability at the same time open when load balancing,

Three, the relevant parameters definition
1, failoverEnable
8 a cluster use, creating a connection, if the cluster when

Before cluster node is not available, whether under the automatic routing to false one of the available nodes, the default is false;
2, the hostList
8 a cluster USES when failoverEnable=true effect, under the condition of node in the cluster IP comma-delimited,

Three cases: cluster node

192.168.0.2;

192.168.0.3;

192.168.0.5;

When you create a database connection, if the current node as 192.168.0.2, is not available, hope automatic routing to the next available connection, you can set the failoverEnable=true& HostList=192.168.0.3, 192.168.0.5
3, gclusterId
8 a cluster USES when failoverEnable=true

And the hostList parameter is not null, set this parameter, 8 a cluster of interface open load balancing strategy for polling (load), gclusterId must start with a - z

Any character at the beginning of the string, gclusterId composition can contain a to z, 0-9 all for up to 20 characters in length, in the same application, gclusterId can have application developers to decide on their own, the whole project only can,

Note: when setting gclusteId, automatic routing load balancing, high availability are automatically converted to

  • Related