Consistent replication of Linux databases

Consistent replication of Linux databases

To get consistent state of running databases on Linux, e.g. MySQL, PostgreSQL, use pre-backup and post-backup scripts, located in /usr/bin/hlragent/scripts/. These scripts are automatically called during the replication process. To flush the data, add your custom script execution before sync of unfreeze part of the script.

Scripts description:

pre_begin_backup.sh - is called before creating a snapshot
post_begin_backup.sh - is called after creating a snapshot
pre_end_backup.sh -  is called before snapshot deletion
post_end_backup.sh  - is called after replication is complete

Example:

Edit /usr/bin/hlragent/scripts/pre_begin_backup.sh to execute your custom script to flush the data forcibly before taking a snapshot:

  1. #!/usr/bin/env bash

  2. usage() {
  3.     echo "
  4.     usage: $0 --devices {devices list}
  5.     "
  6. }

  7. while [[ $# -gt 0 ]]; do
  8.     key="$1"

  9.     case $key in
  10.         --devices)
  11.             shift;
  12.             devices=("$@")
  13.             break;;
  14.         *)
  15.             usage
  16.             exit 1
  17.             ;;
  18.     esac
  19.     shift
  20. done

  21. <your_script_to_flush_db>.sh
  22. sync
  23. sleep 1




    • Related Articles

    • How to turn on debug logging for Hystax Linux Replication Agent

      Task Turn on debug logging to perform advanced troubleshooting of Hystax Linux Replication Agent (HLRAgent) Solution Stop the HLRAgent service with the following command: sudo service hlragent stop Enable debug logs, set the value ...
    • How to set a block device exclusion for the Linux replication agent

      TaskSet a block device exclusion for the Linux replication agent. Solution In case there are disks on the machines that don't need to be replicated, they can be excluded by setting certain parameters in the cbt.conf configuration file. 1 Stop the ...
    • How to turn on debug logging for Hystax VMware Replication Agent

      Task Turn on debug logging to perform advanced troubleshooting of Hystax VMware Replication Agent (HVRAgent) SolutionGo to the TUI and select the “Agent options” menu Choose the “Enable debug logging” option You can see the logs in agent TUI or in ...
    • How to set volume exclusion for the Windows replication agent

      Task Set a volume exclusion for the Windows replication agent. Solution In case there are disks on the machines that are not needed for replication, they can be excluded by setting certain parameters in the cbt.conf configuration file: 1. Stop the ...
    • How to turn on debug logs for Hystax Windows Replication Agent

      Task Turn on debug logging to perform advanced troubleshooting for Hystax Windows Replication Agent (HWRAgent). Solution HWRAgent is running as two separate processes - HWRAgent service and Replication Manager (Repman_x64.exe), so you need to turn on ...