Top
Enterprise Postgres 18 for Kubernetes User's Guide

5.18.2 Add/Remove Multi-master Replication

This document describes the procedures for adding or removing multi-master replication for a new database between database clusters that already have multi-master replication configured.

Detailed explanations for each step follow.

5.18.2.1 Modifying Multi-master Replication Definition Files

Modify the multi-master replication definition file.

To add a new replication, add an array element and define the replication targets.

If the databaseName option is omitted and you need to add replication target databases after cluster construction, execute the next turn without modifying the definition.

To delete an existing replication, specify "delete" in the "state" option of the corresponding replication definition. Deleting an array element does not delete the replication.

5.18.2.2 Creating a Database

When adding a database for multi-master replication, create the database to be replicated. For restrictions regarding the replicated database, refer to the chapter on multi-master replication in the Fujitsu Enterprise Postgres Cluster Operation Guide (Multi-master Replication).

FEPOperator adds several extensions to the template1 database. Since tables created by these extensions cannot be replicated, to make the database you create eligible for multi-master replication, use the template0 database as the template when creating your database.

5.18.2.3 Updating Multi-master Replication Using FEPAction Custom Resources

After defining the specification, set spec.fepAction.type to update_multi_master_replication and apply the FEPAction custom resource.

Below is an example definition.

apiVersion: fep.fujitsu.io/v1
kind: FEPAction
metadata:
  name: new-fep-update-replication
  namespace: myns
spec:
  fepAction:
    type: update_multi_master_replication
  args:
     targetRplicationName: m-replication-1
  targetClusterName: new-fep

If the databaseName is not defined in the multi-master replication definition file and a database is created after enabling multi-master replication, applying the FEPAction custom resource will include the added database in the replication scope.

If the "pgactive" extension has not been created with CREATE EXTENSION for the replicated database, the Operator will create the extension with CREATE EXTENSION before creating the replication.

When all defined replication updates succeed, the FEPAction custom resource's "fepActionStatus: fepActionCondition" is set to "Success".

If some updates fail, fepActionCondition is set to "Failed", and "fepActionResult" lists the names of the replication instances that failed to update.

If fepActionCondition is Failed, check the preparation_multimaster_replication table in the postgres database to determine the reason for failure.

To modify only a specific replication within the replication definition, specify `spec.args.targetReplicationName` to perform the modification only on the designated replication.