GOLDILOCKS Database Replication

Overview

This chapter describes CYCLONE, LOGMIRROR and CYFILE.

GOLDILOCKS supports two types of replication, and they are CYCLONE and LOGMIRROR. CYCLONE replicates transactions using CDC, and LOGMIRROR replicates redo log files from the source database.

CYFILE employs the CDC method to store or record transactions applied to the original database in Comma-Separated Values (CSV) format file.

Replication tool

Tool

Replication target

Description

CYCLONE

Transaction

It uses the CDC method to replicate transactions reflected in the master, and then applies them to the slave.

LOGMIRROR

Redo log file

It replicates the redo log files from the master database to the slave identically.

CYFILE

Transaction

It uses the CDC method to store or record transactions in a CSV format file.

Operating Method

CYCLONE

For more information about general operational methods and options, refer to CYCLONE.

Adding and Deleting Nodes

CYCLONE operates in group units, similar to the replication nodes. When adding nodes, a group must be added, and when deleting nodes, a group must be dropped.

Examples of Adding Nodes

...
...
GROUP_NAME = Group1
{
    PORT = 21102
    CAPTURE_TABLE =
    (
        testTable1,
        testTable2
    )
}
GROUP_NAME = Group2
{
    PORT = 21103
    CAPTURE_TABLE =
    (
        testTable5,
        testTable6
    )
}
...
...
GROUP_NAME = Group1
{
    PORT = 21102    
    APPLY_TABLE = 
    (
        testTable1 To testTable3,
        testTable2 To testTable4
    )
}
GROUP_NAME = Group2
{
    PORT = 21103    
    APPLY_TABLE = 
    (
        testTable5 To testTable7,
        testTable6 To testTable8
    )
}
prompt> cyclone --master --start --group Group2
[GROUP2] Startup done as Master.

prompt> cyclone --master --status
======================================
|       CYCLONE STATUS - MASTER      |
======================================
 GROUP1 Running...
 GROUP2 Running...
--------------------------------------
prompt> cyclone --slave --start --group Group2
[GROUP2] Startup done as Slave.

prompt> cyclone --slave --status
======================================
        CYCLONE STATUS - SLAVE        
======================================
 GROUP1 Running...
 GROUP2 Running...
--------------------------------------

Examples of Deleting Nodes

prompt> cyclone --slave --stop --group Group2
stop done.

prompt> cyclone --slave --status
======================================
CYCLONE STATUS - SLAVE
======================================
GROUP1 Running...
--------------------------------------
prompt> cyclone --master --stop --group Group2
stop done.

prompt> cyclone --master --status
======================================
CYCLONE STATUS - MASTER
======================================
GROUP1 Running...
--------------------------------------
...
...
GROUP_NAME = Group1
{
    PORT = 21102
    CAPTURE_TABLE =
    (
        testTable1,
        testTable2
    )
}
GROUP_NAME = Group2
{
    PORT = 21103
    CAPTURE_TABLE =
    (
        testTable5,
        testTable6
    )
}
...
...
GROUP_NAME = Group1
{
    PORT = 21102    
    APPLY_TABLE = 
    (
        testTable1 To testTable3,
        testTable2 To testTable4
    )
}
GROUP_NAME = Group2
{
    PORT = 21103    
    APPLY_TABLE = 
    (
        testTable5 To testTable7,
        testTable6 To testTable8
    )
}

Initializing Replication

Initializing replication is executed when existing replication nodes or a group's table gives up execution due to a DDL operation. Either a specific node or all nodes can be initialized.

The initializing replication is performed by restarting the replication running on the slave using the --reset option.
On the other hand, no action is required on the master.

Examples of Initializing Replication on a Specific Node

prompt> cyclone --slave --stop --group Group2
stop done.

prompt> cyclone --slave --status
======================================
        CYCLONE STATUS - SLAVE        
======================================
 GROUP1 Running...
--------------------------------------
prompt> cyclone --slave --start --reset --group Group2
[GROUP2] Startup done as Slave.

prompt> cyclone --slave --status
======================================
        CYCLONE STATUS - SLAVE        
======================================
 GROUP1 Running...
 GROUP2 Running...
--------------------------------------

Examples of Initializing Replication for All Nodes

prompt> cyclone --stop --slave
prompt> cyclone --slave --start --reset
[GROUP1] Startup done as Slave.
[GROUP2] Startup done as Slave.

prompt> cyclone --slave --status
======================================
        CYCLONE STATUS - SLAVE        
======================================
 GROUP1 Running...
 GROUP2 Running...
--------------------------------------

LOGMIRROR

For more information about general operational methods and options, refer to LOGMIRROR.

Retrieving LOGMIRROR State

When interworking with LOGMIRROR, GOLDILOCKS includes the response waiting process of LOGMIRROR. If LOGMIRROR is waiting for a response, GOLDILOCKS will also be in a blocked state, waiting. This state can be checked in v$system_stat.

gSQL> SELECT * FROM V$SYSTEM_STAT WHERE STAT_NAME='LOG_MIRROR_SYNC_STATE';

STAT_NAME             STAT_VALUE COMMENTS                                     
--------------------- ------ ---------------------------------------------
LOG_MIRROR_SYNC_STATE      0 logmirror sync state( 0 : sync, 1 : blocked )


1 row selected.

If STAT_VALUE is 0, it indicates an ordinary state rather than a standby state. If STAT_VALUE is 1, it indicates a blocked state waiting for a response. To restart the GOLDILOCKS service while LOGMIRROR is waiting for a response, the LOGMIRROR service can be stopped by modifying LOG_MIRROR_TIMEOUT as follows.

gSQL> ALTER SYSTEM SET LOG_MIRROR_TIMEOUT = 20;

System altered.

Initializing Replication

Initializing the replication of LOGMIRROR must be done manually to prevent data loss or an unrecoverable situation caused by incorrect user options.

Control files and redo log files are stored on the LOGMIRROR slave. The necessary information for operation is stored and updated in these control files.

Examples of Initializing Replication

prompt> logmirror --slave --stop 
stop done.
prompt> logmirror --master --stop 
stop done.

CYFILE

For more information about general operational methods and options, refer to CYFILE.

Starting, Stopping, and Checking the Status of Cyfile

Example

prompt> cyfile --start --reset all
Startup done.
prompt> cyfile --stop
Stop done.
prompt> cyfile --status
cyfile --status
======================================
|          CYFILE STATUS             |
======================================
 GROUP1 Running...
======================================

Trace Log

The following provides detailed information about the trace log.

Trace log

Name

Category

File name

CYCLONE

Master

cyclone_master_GROUP_NAME.trc

Slave

cyclone_slave_GROUP_NAME.trc

LOGMIRROR

Master

LogMirror_master.trc

Slave

LogMirror_slave.trc

CYFILE

-

cyfile_GROUP_NAME.trc

Troubleshooting for CYCLONE

The following are error messages and troubleshooting for CYCLONE.

Troubleshooting for CYCLONE

Error message

Solution

Service is not available

Ensure that GOLDILOCKS is running normally.

table does not exist

Check the table name specified in the configuration file.

schema does not exist

Check the schema name specified in the configuration file.

previously added. Maybe duplicated

Check if a table is duplicated in the configuration file.

table must have a primary key

Ensure that a table in the configuration file has a primary key.

internal error occurred.

Check the error details.

table must set supplemental log

Ensure that supplemental logging is enabled in GOLDILOCKS.

group XXX is already running

Check if the corresponding group is already running.

GOLDILOCKS_DATA system environment is invalid

Ensure that the GOLDILOCKS_DATA environment variable is set.

log file reused or invalid. restart cyclone with '--reset' option

This error occurs when the redo log file is reused or the archived redo log file does not exist. In this case, initialize CYCLONE and restart it.

fail to analyze flow

This error occurs when analyzing an abnormal redo log file.

Ensure that the release versions between the master and slave are the same.

Communication link failure

Check the network status. Restart CYCLONE.

Master disconnect abnormally

Check the network status. Restart CYCLONE.

Protocol error occurred

Check the error details.

Already slave connected

Check if the slave is already running.

Invalid group name

Check the specified group name at the startup and termination. The group name must be the same as described in the configuration file.

Invalid capture information

This error occurs when the existing operational information is abnormal. In this case, initialize CYCLONE and restart it.

Redo log file read timeout

Ensure that the archived redo log files exist normally.

Invalid archive log file

The archived redo log file is not functioning normally. In this case, initialize CYCLONE and restart it.

Fail to write file

Check the available disk space, and then restart CYCLONE.

Invalid Meta File

This error occurs when the meta files managed by CYCLONE are corrupted. In this case, initialize CYCLONE and restart it.

Redo log file does not exist

Ensure that GOLDILOCKS, operating as master, is running normally.

[APPLIER-INSERT] XXX

INSERT failed due to XXX.

[APPLIER-DELETE] XXX

DELETE failed due to XXX.

[APPLIER-UPDATE] XXX

UPDATE failed due to XXX.

Troubleshooting for LOGMIRROR

The following are error messages and troubleshooting for LOGMIRROR.

Troubleshooting for LOGMIRROR

Error message

Solution

Service is not available

Ensure that GOLDILOCKS is running normally.

Invalid Protocol value

Check the error details.

file does not exist

Ensure that the corresponding file exists normally.

invalid Control file

The control file is corrupted. Initialize and restart LOGMIRROR.

Communication link failure

Check the network status. Restart LOGMIRROR.

GOLDILOCKS_DATA system environment is invalid

Ensure that GOLDILOCKS_DATA environment variable is set.

There is no Shared Memory Area for LogMirror

Ensure that the LOG_MIRROR_MODE property is set to 'enabled' in the properties of GOLDILOCKS, which is operating as the master.

Master disconnect abnormally

Check the network status. Restart LOGMIRROR.

Invalid Log File

Ensure that the corresponding file exists normally.

Connection Information does not exist

Ensure that the connection information for GOLDILOCKS in the configuration files is correct.

Archive Log File does not exist

Ensure that the ARCHIVELOG_MODE in GOLDILOCKS, operating as the master, is set correctly.

Troubleshooting for CYFILE

The following are error messages and troubleshooting for CYFILE.

Troubleshooting for CYFILE

Error message

Solution

Service is not available

Ensure that GOLDILOCKS is running normally.

table does not exist

Check the table name specified in the configuration file.

schema does not exist

Check the schema name specified in the configuration file.

previously added. Maybe duplicated

Check if a table is duplicated in the configuration file.

table must have a primary key

Ensure that a table in the configuration file has a primary key.

internal error occurred.

Check the error details.

table must set supplemental log

Ensure that supplemental logging is enabled in GOLDILOCKS.

group XXX is already running

Check if the corresponding group is already running.

GOLDILOCKS_DATA system environment is invalid

Ensure that the GOLDILOCKS_DATA environment variable is set.

log file reused or invalid. restart cyfile with '--reset' option

This error occurs when the redo log file is reused or archived redo log file does not exist. In this case, initialize cyfile and restart it.

fail to analyze flow

This error occurs when analyzing an abnormal redo log file.

Ensure that the release versions between the master and the slave are the same.

Invalid group name

Check the specified group name at the startup and termination. The group name must be the same as described in the configuration file.

Invalid capture information

This error occurs when the existing operational information is abnormal. In this case, initialize cyfile and restart it.

Redo log file read timeout

Ensure that the archived redo log files exist normally.

Invalid archive log file

The archived redo log file is not functioning normally. In this case, initialize cyfile and restart it.

Fail to write file

Check the available disk space, and then restart cyfile.

Invalid Meta File

This error occurs when the meta files managed by cyfile are corrupted. In this case, initialize cyfile and restart it.

Redo log file does not exist

Ensure that GOLDILOCKS is running normally.

Control has broken(CRC Error)

The control file of cyfile is damaged. Retry using the mirror file.