Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

Load Balancing Structure

The load balancing structure increases the availability of the CUBRID servie by placing several nodes in the HA configuration (one master node and one slave node) and distributes read-load.

Because the replica nodes receive replication logs from the nodes in the HA configuration and maintain the same data, and because the nodes in the HA configuration do not receive replication logs from the replica nodes, its network and disk usage rate is lower than that of the multiple-slave structure.

Because replica nodes are not included in the HA structure, they provide read service without failover, even when all other nodes in the HA structure fail.

An Example of Node Configuration

admin_ha_comp_replica_ex.png

You can configure each node in load balancing structure as shown below:

  • node A (master node)
    • Configure the ha_mode of the cubrid.conf file to on.
    • ha_mode=on
    • The following example shows how to configure cubrid_ha.conf:
    • ha_port_id=59901
    • ha_node_list=cubrid@nodeA:nodeB 
    • ha_replica_list=cubrid@nodeC:nodeD
    • ha_db_list=testdb
  • node B (slave node): Configure this node in the same manner as node A.
  • node C (replica node)
    • Configure the ha_mode of the cubrid.conf file to replica.
    • ha_mode=replica
    • You can configure the cubrid_ha.conf file in the same manner as node A.
  • node D (replica node): Configure this node in the same manner as node C.

You must enter the list of DB server hosts in the order so that each broker can be connected appropriate HA or load balancing server in the databases.txt file of a broker node.

The following is an example of the databases.txt file in node A and node B.

#db-name    vol-path                  db-host       log-path             lob-base-path

testdb     /home/cubrid/DB/testdb1   nodeA:nodeB   /home/cubrid/DB/testdb/log file:/home/cubrid/CUBRID/testdb/lob

The following is an example of the databases.txt file in node C.

#db-name    vol-path                  db-host       log-path             lob-base-path

testdb     /home/cubrid/DB/testdb   nodeC   /home/cubrid/DB/testdb/log        file:/home/cubrid/CUBRID/testdb/lob

The following is an example the databases.txt in node D.

#db-name    vol-path                  db-host       log-path             lob-base-path

testdb     /home/cubrid/DB/testdb   nodeD   /home/cubrid/DB/testdb/log file:/home/cubrid/CUBRID/testdb/lob

The cubrid_broker.conf can be set in a variety of ways according to configuration of the broker. It can also be configured as separate equipment with the databases.txt file.

In this example, the RW broker is configured in node A and node B and the PHRO broker is configured in node C and node D.

The following is an example of cubrid_broker.conf in node A and node B.

[%RW_broker]

 

# Broker mode setting parameter

ACCESS_MODE             =RW

The following is an example cubrid_broker.conf in node C.

[%PHRO_broker]

 

# Broker mode setting parameter

ACCESS_MODE             =PHRO

PREFERRED_HOSTS         =nodeC:nodeD

The following is an example cubrid_broker.conf in node D.

[%PHRO_broker]

 

# Broker mode setting parameter

ACCESS_MODE             =PHRO

PREFERRED_HOSTS         =nodeD:nodeC

Connection Configuration of Applications

Connect the application to access in read/write mode to the broker of node A or node B. The following is an example of a JDBC application.

Connection connection = DriverManager.getConnection("jdbc:CUBRID:nodeA:33000:testdb:::?charSet=utf-8&altHosts=nodeB:33000", "dba", "");

Connect the application to access in read-only mode to the broker of node C or node D. The following is an example of a JDBC application.

Connection connection = DriverManager.getConnection("jdbc:CUBRID:nodeC:33000:testdb:::?charSet=utf-8&altHosts=nodeD:33000", "dba", "");

For details, see JDBC Configuration, CCI Configuration, and PHP Configuration in Environment Configuration.

Remark

The path of a transaction log in these configurations is as follows:

admin_ha_comp_replica.png