Configure Bi-Directional Replication

In a bidirectional configuration, there are Extract and Replicat processes on both the source and target systems to support the replication of transactional changes on each system to the other system. To support this configuration, each Extract must be able to filter the transactions applied by the local Replicat, so that they are not recaptured and sent back to their source in a continuous loop. Additionally, tables whose key columns are AUTO_INCREMENT columns must be set so that there is no conflict between the values on each system.

  1. Configure Oracle GoldenGate for high availability or active-active replication.
  2. To filter out Replicat operations in a bi-directional configuration so that the applied operations are not captured and looped back to the source again, take the following steps on each MySQL database:
    • Configure each Replicat process to use a checkpoint table. Replicat writes a checkpoint to this table at the end of each transaction. You can use one global checkpoint table or one per Replicat process.

    • Specify the name of the checkpoint table with the FILTERTABLE option of the TRANLOGOPTIONS parameter in the Extract parameter file. The Extract process will ignore transactions that end with an operation to the specified table, which should only be those of Replicat.

      Note:

      Although optional for other supported databases as a means of enhancing recovery, the use of a checkpoint table is required for MySQL when using bidirectional replication (and likewise, will enhance recovery).

      If using a parallel Replicat in a bidirectional replication, then multiple filter tables are supported using the TRANLOGOPTIONS FILTERTABLE option. Multiple filter tables allow the TRANLOGOPTIONS FILTERTABLE to be specified multiple times with different table names or wildcards.

      You can include single or multiple TRANLOGOPTIONS FILTERTABLE entries in the Extract parameter file. In the following example, multiple TRANLOGOPTIONS FILTERTABLEentries are included in the Extract parameter file with explicit object names and wildcards.
      TRANLOGOPTIONS FILTERTABLE ggs.chkpt2
      TRANLOGOPTIONS FILTERTABLE ggs.chkpt_RABC_*
  3. If replicating data for tables that have AUTO_INCREMENT columns, edit the MySQL server and auto_increment_offset parameters to avoid discrepancies that could be caused by the bi-directional operations. The following illustrates these parameters, assuming two servers: ServerA and ServerB.

    ServerA:

    auto-increment-increment = 2
    auto-increment-offset = 1

    ServerB:

    auto-increment-increment = 2
    auto-increment-offset = 2