Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 | 

HA Configuration

To use the HA feature, the following configuration is required.

For HA configuration, the CUBRID heartbeat feature must be activated in both active and standby servers. The broker and the database server can be configured either on a single device or in separate systems. The following figure describes how to configure the environment and run.


Create a Node Group ID

Create the same user account (e.g. ha_user1) for Active and Standby servers and start CUBRID with this account. The UNIX user account that is created becomes the node group ID of the server that will run in HA mode.

Prepare to Run HA Start Script

The HA script is located in the CUBRID/share/init.d/cubrid-ha. Prepare it in an active and a standby (etc/init.d/) server, respectively. If you configure HA with a different account in one host and then register this configuration to the system server, you should changer the HA start script name into cubrid-ha-{unix user id}. And then you should copy each script to /etc/init.d directory. Note that a root authorization is required to register the system service; otherwise, you can omit the script name change and copy the script.

[root@server_s1 init.d]# cd /home/ha_user1/CUBRID/share/init.d/

[root@server_s1 init.d]# cp cubrid-ha /etc/init.d/

Copy the Database

Create a new DB (e.g. tdb01) in the active server and copy it to the standby server. You can use one of the following methods - data volume copy, backup/recovery and unloaddb/loaddb.

Configure the Database Server (cubrid.conf)

You must add the HA related parameter to the cubrid.conf configuration file. The HA related parameter must be configured in [common] section. For databases that will not run in HA mode, set the value of the ha_mode to no in [@<database>] section. An error will occur when the value of the ha_mode is no in [common] section and the value of the ha_mode is yes in [@<database>] section.

  • ha_mode : A parameter used to configure the HA feature. Its default value is off. Change the value of this parameter to on.
  • ha_port_id : A parameter used to set the UDP port. Through this port, each cub_master process exchanges heartbeat messages and detects node failures.
  • ha_node_list : A parameter used to specify the ID for the node group running in HA mode and the host names of the member nodes that belong to the group. Host names of the member nodes and of the current node must be registered in the /etc/hosts. The following example specifies the host names of the active server (server_s1) and of the standby server (server_s2) as members of the node group called ha_user1.




ha_mode = on

ha_port_id = 41523

ha_node_list = ha_user1@server_s1:server_s2

Configure the HA Script

Add the following configuration to the HA start script files prepared in active and standby database servers.

  • CUBRID_USER : Specifies the node group ID, which is the UNIX user account used to install and start CUBRID.
  • DB_LIST : Specifies the name of the database that will run in HA mode. If you specify more than one name, separate them with spaces.



CUBRID_USER = ha_user1

DB_LIST = ’tdb01’


# DB_LIST = ’tdb01 tdb02 tdb03’

Configuring the Broker

The default operation mode of the broker is one that requires read and write operations. If necessary, you can set it as a Read only or Slave only broker by using the ACCESS_MODE parameter in the cubrid_broker.conf file.




RW := Read-Write broker (default value)

RO := Read-Only broker

SO := Slave-Only broker

You can check the operation mode of a running broker with the -f parameter of the cubrid broker status utility. For more information about the broker status, see Checking the Broker Status.

% broker1  - cub_cas [4430,40821] /home/CUBRID/log/broker/broker1.access /home/CUBRID/







1 26946     0     0 51168 IDLE         2009/11/06 16:06:41      -          -                   -

2 26947     0     0 51172 IDLE         2009/11/06 16:06:41      -          -                   -

3 26948     0     0 51172 IDLE         2009/11/06 16:06:41      -          -                   -

4 26949     0     0 51172 IDLE         2009/11/06 16:06:41      -          -                   -

5 26950     0     0 51172 IDLE         2009/11/06 16:06:41      -          -                   -

Setting Database Host Information

You need to add the host information of the Active and the Standby servers to be used in the HA configuration to the database location file (databases.txt) in the broker/server system. The Active and the Standby servers are separated by a colon (:). More than one Standby servers can be added with each host being separated by a colon (:). As described above, in the environment where multiple hosts are specified for the same database, you must specify a host name (@host) next to a target database name when executing utilities such as csql, backupdb or applylogdb in client/server (CS) mode. On the other hand, in case of executing utilities in stand-alone (SA) mode, you cannot specify a host name next to a target database.


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

tbl01            /home/db/db2      server_s1:server_s2       /home/db/db2

tbl02            /home/db/db1      server_s1:server_s2       /home/db/db1