Clearing a “Data replication pg_xlog usage more than 1 GB” alarm

Last Updated : Sep 14, 2023 |

Use this procedure to clear a Data replication pg_xlog usage more than 1 GB alarm.

Caution:

This procedure is service interrupting and will cause down time on the deployment. Try to do this during low or no traffic periods.

Condition

Alarm message text
Data replication pg_xlog usage more than 1 GB
Alarm level
Critical

Solution

Procedure

Scenario 1 — Check the replication status between the SBC systems to see if the Data Replication is broken alarm is active.

  1. Do one of the following depending on the type of system you are troubleshooting:
    • On an SBC system, run the following commands:

      psql -U postgres -d sbcedb

      sbcedb=# select * from alarms;

    • On an EMS system, run the following commands:

      psql -U postgres -d commondb

      commondb=# select * from alarms;

    If the alarm is seen, then follow the steps in Clearing a “Data Replication is broken” alarm to clear the alarm. This should also fix the Data replication pg_xlog usage more than 1 GB issue.

Scenario 2 — The number of pg_xlogs will grow if the peer SBC or EMS system is down for a long time. To prevent the disk space from getting full, you must act immediately when this alarm is seen.

  1. Check the database alarms table. If the table has the alarm Peer SBC is unreachable, confirm that the peer SBC or EMS system is powered up and in operation. It must be in operation so that database replication can occur.
    • On an SBC system, run the following commands:

      psql -U postgres -d sbcedb

      sbcedb=# select * from alarms;

    • On an EMS system, run the following commands:

      psql -U postgres -d commondb

      commondb=# select * from alarms;

    If the peer SBC or EMS has a true hardware failure, break the replication on the SBC or EMS system that is in operation so that pg_xlogs will no longer grow on that system. To break the replication, downtime is required.

  2. On the operational SBC or EMS system, do the following:
    1. Do a database backup using the following command:

      /usr/local/ipcs/db/scripts/dbmanage.py --takedb-backup

    2. Stop replication using the following command:

      /usr/local/ipcs/icu3/scripts/bdrmon.py --breakreplication

    3. Reboot the system using the following command:

      /sbin/reboot

Scenario 3 — Disk space of /var becomes 100% full and the SBC or EMS system goes down. This happens when the alarms Data Replication is broken, Data replication pg_xlog usage more than 1 GB, and Peer SBC is unreachable have occurred and were not attended to.

  1. Run the following command to check the /var partition files to see which files are causing the disk space issue:

    cd /var

    du –sh

    This command lists the file size of each file in the / root directory. Confirm whether any pg_xlog files are more than 1 GB verify that the cause of the issue is really due to log size or replication being down.

  2. Do a backup of the entire database. In a HA system or active-active EMS system, do a backup of the database on both systems, if possible. In the SBC or EMS that is operational, run the following command:

    /usr/local/ipcs/db/scripts/dbmanage.py --takedb-backup

  3. For any systems that are down because /var is 100% full, you cannot use the standard backup command. You must use the following commands:
    Important:

    Confirm that the archive directory you select has enough space for the complete database backup.

    mkdir /archive/tst

    tar -zcvf /archive/tst/db-bkp.tar.gz /var/lib/pgsql/9.4-bdr/data/

When using Steps 7–9, the down SBC will get all of the SBC configurations from the SBC that is up and running.

  1. On the SBC or EMS system that is operational, break the database replication and reboot the system using the following commands:

    /usr/local/ipcs/icu3/scripts/bdrmon.py --breakreplication

    /sbin/reboot

  2. Confirm that the operational SBC or EMS system comes back online and starts all processes.
  3. On the SBC or EMS system that is down or has database issues, confirm that both application processes and the database are down. Run the following commands to delete the database directory, recreate the database directory, recreate the database, break replication, and reboot the server:

    rm -rf /var/lib/pgsql/9.4-bdr/data/

    /usr/local/ipcs/db/scripts/db_post_tasks.sh 1

    /usr/local/ipcs/db/scripts/dbmanage.py --dbcreate --dbname sbcedb --dbtype sbcedb --no-schema True

    /usr/local/ipcs/icu3/scripts/bdrmon.py --breakreplication

    /sbin/reboot