32.8 Command Line Scripts to Re-initiate Replication and Resolve Conflicts

You can use the following command line scripts to examine and resolve replication conflicts between the servers in a cluster:

  • rereplicate

  • drop-triggers

  • purge

  • copy-db

  • dump-outgoing-batches

  • dump-outgoing-conflicts

  • forget

NOTE:To view all the applicable command line parameters, perform the following steps:

  1. Run the following command to connect to the container:

    docker exec -ti aaf_aucore_1 bash

  2. Run the following command to view list of command line parameters:

    /opt/penv/bin/au-replica --help

For more information, see the README.txt file located in the /opt/Aucore/aucore/scripts/db-sync/ path of container.

32.8.1 Rereplicate

You can enforce the replication of all tables from one server to the peer servers in the cluster. To rereplicate, perform the following steps:

  1. Run the following command to connect to the container:

    docker exec -ti aaf_aucore_1 bash

  2. Run the following command on the server from where you want to enforce the replication:

    /opt/penv/bin/au-replica rereplicate

To enforce the replication process for a specific table in a server, run the following command in the respective server:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica rereplicate [–table <table_name>]

    For example, /opt/penv/bin/au-replica rereplicate [–table <1087>]

32.8.2 Drop Triggers

You can remove the trigger, stop recording any change to the database, and stop replicating all tables to the peer servers in the cluster.

To stop recording changes to the database and drop the triggers run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica stop

  3. au-replica drop-triggers

Run the following commands to enable the trigger, initiate storing changes to the database, and start the replication with the peer servers:

  1. docker exec -ti aaf_aucore_1 bash

  2. au-replica start

32.8.3 Purge

To forget all pending replicas and re-initialize the replication of tables with peer servers, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica purge

32.8.4 Copy DB

To copy the database from specified server to the current server, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica copy-db

To copy the database from specific server to the current server, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. SRC_PASSWORD=XXX au-replica copy-db [--host SRC_HOST]

where:

  • SRC_HOST is registrator by default.

  • SRC_PASSWORD is environment variable and by default reads the password from server table (where host=SRC_HOST).

You can fetch the local DB password using the following command:

docker exec aaf_aucore_1 cat /opt/AuCore/data/production.ini | grep replica.url

This command returns the following output:

replica.url = postgresql+psycopg2://root:Password1@127.0.0.1/aucore_prod

The text between colon (:) and at symbol (@) is the actual password.

32.8.5 Troubleshooting the Outgoing Batches

To view the list of the outgoing batches, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica dump-outgoing-batches

To view the list of outgoing conflicts that are detected by the server, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica dump-outgoing-conflicts

To forget a particular outgoing batch, run the following commands:

  1. docker exec -ti aaf_aucore_1 bash

  2. /opt/penv/bin/au-replica forget-outgoing-batch <batch_id>

    For example, /opt/penv/bin/au-replica forget-outgoing-batch 24

    This script is similar to Forget option available in the administration console.