Skip to content

NethVoice - Improve backup procedure to avoid temporary database duplication #7991

@nrauso

Description

@nrauso

Description

During the NethVoice backup, the module-dump-state action can require a very large amount of temporary disk space when the MariaDB database is large.

In a reported case, the node had a 100 GB disk, with about 50% already used:

~]# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda4        99G   49G   51G  50% /

The NethVoice instance had a database of about 25 GB:

~]# du -h /home/nethvoice1 2>/dev/null | sort -h | tail -n 10
6.0G    /home/nethvoice1/.local/share/containers/storage/overlay
23G     /home/nethvoice1/.local/share/containers/storage/volumes/mariadb-data/_data/asteriskcdrdb
24G     /home/nethvoice1/.local/share/containers/storage/volumes/mariadb-data
24G     /home/nethvoice1/.local/share/containers/storage/volumes/mariadb-data/_data
25G     /home/nethvoice1/.local/share/containers/storage/volumes
31G     /home/nethvoice1
31G     /home/nethvoice1/.local
31G     /home/nethvoice1/.local/share
31G     /home/nethvoice1/.local/share/containers
31G     /home/nethvoice1/.local/share/containers/storage

The current module-dump-state logic creates the MariaDB backup inside the container under /tmp/db_backup, then copies it to the local filesystem:

## MariaDB
# exec mariabackup to save database in /tmp/db_backup
podman exec mariadb \
    mariabackup \
        --backup \
        --target-dir=/tmp/db_backup \
        --user=root \
        --password="${MARIADB_ROOT_PASSWORD}"

# copy db_backup in local filesystem
podman cp mariadb:/tmp/db_backup db_backup

This causes the database content to temporarily exist three times:

  • the production MariaDB volume;
  • the temporary backup inside the container;
  • the final db_backup directory in the app home.

With a large database, this can almost fill the root filesystem, as happened in the reported case:

~]# df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda4        99G   95G  4.6G  96% /

On systems where the disk is already more than half full, the backup can fail with no space left on device, and the application can be temporarily affected.

Example failure:

"/db_backup/asteriskcdrdb/report_queue_callers.MYD": copier: put: error writing file "/db_backup/asteriskcdrdb/report_queue_callers.MYD": write /db_backup/asteriskcdrdb/report_queue_callers.MYD: no space left on device
Apr 24 00:05:22 ns8 backup1[1073652]:         * copying from container: copier: get: "/tmp/db_backup"("/tmp/db_backup"): copying /tmp/db_backup/asteriskcdrdb/report_queue_callers.MYD: io: read/write on closed pipe
Apr 24 00:05:22 ns8 backup1[1073991]: Error: saving container fd9da0c00d270d92808345eae29b22e74d4ad000c94d05f7b6389adf6e10e9ed state: writing container fd9da0c00d270d92808345eae29b22e74d4ad000c94d05f7b6389adf6e10e9ed state: unable to open database file: no such file or directory
Apr 24 00:05:22 ns8 backup1[1072277]: [ERROR] module-dump-state failed. Command '['module-dump-state', '10']' returned non-zero exit status 255.
Apr 24 00:05:22 ns8 backup1[1072277]: [ERROR] module-backup aborted.

The purpose of this request is to make the NethVoice backup process safer and more space-efficient, especially for installations with large CDR databases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions