한국어 Login Register

Versions available for this page: CUBRID 8.3.1 | 

Replacing Master Database (Automatic)

The automatic method provides a faster and more convenient way of replacing the master database with a slave. The replacement is done by using the repl_check_sync and repl_change_master utilities. Only slave databases whose replication parameter option for_recovery was set to 'Y' can be used for automatic replacement.

When a slave database is created, the ownership of every class is changed to that of the replication user. Therefore, authorization changes are not replicated even in for_recovery. Only user and group additions/deletions are replicated. After the master database is replaced with the slave, authorization for each user must be defined by DBA. Also, after the slave database has replaced the master, triggers must be activated by DBA because all of them are inactivated in the slave database.

Check the synchronization status of the slave database (repl_check_sync)

If a failure occurs in the master database, you must use one of the slave databases to replace the master. In such an event, the first thing that should be done is to check the synchronization status among all slave databases and whether or not it has already been completed. The repl_check_sync utility checks the status of the synchronization among currently configured slave databases.

Syntax

repl_check_sync dist_db_name.config [-p passwd]

  • dist_db_name.config : Distribution database configuration log file
  • -p passwd : The DBA password for the distribution database.
  • dist_db_name.config : Writes the cubrid repl_agent host line by line (hostname port_id)
Example

 192.168.2.100 5627

 192.168.2.200 5627

As the result of the execution, the numbers of the last logs to be reflected on each slave database are displayed.

Result :

agent_ip  status   log number    last_updated_time

1.1.1.1    A          1234/110     15:30:30
1.1.1.2    A          1234/123     15:29:30
1.1.1.3    A          1234/110     15:28:30
1.1.1.4    A          1234/123     15:27:30
1.1.1.5    A          1234/123     15:26:30

In the output, status consists of the following information.

A : Active (Replication being performed)

F : First (Start the initial replication)

I : Idle (Idle - No replication contents)

Replace the master database with the slave (repl_change_master)

After checking the synchronization status with the repl_check_sync utility, you must change the information about triggers, accounts, and so on to be the same as that of the original. The repl_change_master utility transforms the specified slave database to a master database based on the information about the master contained in the distribution database.

Syntax

repl_change_master servers_info_file

  • servers_info_file : Writes information of the distribution database line by line (dist_name dist_host dist_passwd)
Example

distdb1 192.168.2.100 admin

distdb2 192.168.2.200 admin