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 | 

Configuring and Starting Broker, and Verifying the Broker Status

Configuring the Broker

To provide normal service during a database failover, it is necessary to configure an available database node in the db-host of databases.txt. And ACCESS_MODE in the cubrid_broker.conf file must be specified; if it is omitted, the default value is configured to Read Write mode. If you want to divide into a separate device, you must configure cubrid_broker.conf and databases.txt in the broker device.

  • databases.txt
  • databases.txt
  • #db-name        vol-path                db-host         log-path        lob-base-path
  • testdb          /home1/cubrid1/CUBRID/testdb  nodeA:nodeB        /home1/cubrid1/CUBRID/testdb/log file:/home1/cubrid1/CUBRID/testdb/lob
  • cubrid_broker.conf
  • [%testdb_RWbroker]
  • SERVICE                 =ON
  • BROKER_PORT             =33000
  • MIN_NUM_APPL_SERVER     =5
  • MAX_NUM_APPL_SERVER     =40
  • APPL_SERVER_SHM_ID      =33000
  • LOG_DIR                 =log/broker/sql_log
  • ERROR_LOG_DIR           =log/broker/error_log
  • SQL_LOG                 =ON
  • TIME_TO_KILL            =120
  • SESSION_TIMEOUT         =300
  • KEEP_CONNECTION         =AUTO
  • CCI_DEFAULT_AUTOCOMMIT  =ON
  •  
  • # broker mode parameter
  • ACCESS_MODE             =RW
Starting Broker and Verifying its Status

A broker is used to access applications such as JDBC, CCI or PHP. Therefore, to simply test server redundancy, execute the CSQL interpreter that is directly connected to the server processes, without having to start a broker. To start a broker, execute cubrid broker start. To stop it, execute cubrid broker stop.

The following example shows how to execute a broker from the master node

[nodeA]$ cubrid broker start

@ cubrid broker start

++ cubrid broker start: success

[nodeA]$ cubrid broker status

@ cubrid broker status

% testdb_RWbroker  - cub_cas [9531,33000] /home1/cubrid1/CUBRID/log/broker//testdb.access /home1/cubrid1/CUBRID/log/broker//testdb.err

 JOB QUEUE:0, AUTO_ADD_APPL_SERVER:ON, SQL_LOG_MODE:ALL:100000

 LONG_TRANSACTION_TIME:60.00, LONG_QUERY_TIME:60.00, SESSION_TIMEOUT:300

 KEEP_CONNECTION:AUTO, ACCESS_MODE:RW

---------------------------------------------------------

ID   PID   QPS   LQS PSIZE STATUS

---------------------------------------------------------

 1  9532     0     0  48120  IDLE

Configuring Applications

Specifies the host name (nodeA_broker, nodeB_broker) and port for an application to connect in the connection URL. The altHosts attribute defines the broker where the next connection will be made when the connection to a broker fails. The following is an example of a JDBC program. For more information on CCI and PHP, see CCI Configuration and PHP Configuration.

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