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:
- #!/usr/bin/env bash
 
- usage() {
-     echo "
-     usage: $0 --devices {devices list}
-     "
- }
 
- while [[ $# -gt 0 ]]; do
-     key="$1"
 
-     case $key in
-         --devices)
-             shift;
-             devices=("$@")
-             break;;
-         *)
-             usage
-             exit 1
-             ;;
-     esac
-     shift
- done
 
- <your_script_to_flush_db>.sh
- sync
- sleep 1