Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-23657

Make use of gzip/gunzip upon cdr and cel backup and restore

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 15
    • Fix Version/s: None
    • Component/s: Backup & Restore
    • Labels:
      None
    • Asterisk Version:
      16
    • Distro Version:
      FreePBX 15 & 16

      Description

      [==\\ THE ISSUE //==]

      We have a customer that completely filled up their disk space during a backup
      job, triggering an alert from our monitoring. Investigating this issue further,
      I determined that disk filled during the dumping of the cel table :

      [backup.log]
      ..... TRUNCATED.....
      3057 [2022-07-26 04:00:06] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.INFO]: Working with cdr module [] []
      3058 [2022-07-26 04:02:06] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.DEBUG]: Adding directory to tar: /tmp/dbdump [] []
      3059 [2022-07-26 04:02:06] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.DEBUG]: Adding file to tar: files/tmp/dbdump/cdr.sql [] []
      3060 [2022-07-26 04:06:33] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.DEBUG]: Adding module manifest for cdr [] []
      3061 [2022-07-26 04:06:33] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.INFO]: Working with cel module [] []
      3062 [2022-07-26 04:14:20] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.INFO]: Exporting Advanced settings from cel [] []
      3063 [2022-07-26 04:14:20] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.DEBUG]: Adding directory to tar: /tmp/dbdump [] []
      3064 [2022-07-26 04:14:20] [720e8be9-dc0a-40f7-9856-e719bf3b7c2b.DEBUG]: Adding file to tar: files/tmp/dbdump/cel.sql [] []
      ..... END OF FILE.....

      Ended up with a (partial) dump of the cel data, in the form of a 19GB .sql file:

      1. ls -lh /tmp/dbdump/
        total 19G
        rw-rr- 1 asterisk asterisk 19G Jul 26 04:14 cel.sql

      At a glance, looks like this was address back in v13 of freepbx/pbxact. See the
      following ticket:

      https://issues.freepbx.org/browse/FREEPBX-14935

      This code is technically still in class.backup.php, but as I understand it,
      each module defines their own method of backup and restore via :

      _AMPWEBROOT_/admin/modules/<modulename>/(Backup.php | | Restore.php)

      Looking at the class within cdr/Backup.php that extends the base, it looks like
      it executes the following:

      /usr/bin/mysqldump --host localhost --user freepbxuser -p<*PASS_HERE*> asteriskcdrdb --opt --compact --table cdr --skip-lock-tables --skip-triggers --no-create-info --result-file=/tmp/dbdump/cdr.sql

      Essentially the same for cel of course.

      [==\\ THE REQUEST //==]

      Can we get you to pipe the output from mysqldump directly into gzip/gunzip upon
      cdr and cel backup and restore, as was done under FREEPBX-14935? We would
      greatly appreciate it. I'm working with the customer to prune their cdrs/cels, so that
      this exported data will be smaller, so Im not worried about the customer.Its not the
      first time I've pruned for a customer, but this is the first customer on v15 thats
      generated large cdr/cel exports on backup.

       

       

       

       

      Additionally, I made some tests and these are the results:

       

       

      Running the CDR backup without gzip:

       

       

      As you can see the difference is important ..

       

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                akarshmr Akarsh MR
                Reporter:
                slobera Sergio Lobera
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  NextupJiraPlusStatus

                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.