CDR Restore Fails

I have two servers up and running on identical versions of FreePBX and all modules. I used the backup and restore module to backup every module and ran a restore, and it worked for the most part. I had to reinstall a couple modules, no big deal.

What’s failing right now is the CDR database. See below:

[root@freepbx ~]# fwconsole backup --restore /var/spool/asterisk/backup/uploads/20220317-165656-1647561416-15.0.23-1340680487.tar.gz
Transaction ID is: 11859018-5ec0-46d0-acec-f13bacd0fb9e
Determining backup file type...type is current
Starting restore job with file: /var/spool/asterisk/backup/uploads/20220317-165656-1647561416-15.0.23-1340680487.tar.gz
Extracting Backup
Extracting backup...
Processing cdrResetting cdr module data
Checking if field cnum is present in cdr table..OK!
Checking if field cnam is present in cdr table..OK!
Checking if field outbound_cnum is present in cdr table..OK!
Checking if field outbound_cnam is present in cdr table..OK!
Checking if field dst_cnam is present in cdr table..OK!
Checking if field linkedid is present in cdr table..OK!
Checking if field peeraccount is present in cdr table..OK!
Checking if field sequence is present in cdr table..OK!
Generating CSS...Done
Restoring from cdr [FreePBX\modules\Cdr\Restore]
CDR table Restore Error The command "/usr/bin/mysql --host localhost --port 3306 --user freepbxuser -pjdC5iryMenUz asteriskcdrdb < /tmp/backup/11859018-5ec0-46d0-acec-f13bacd0fb9e/files/tmp/dbdump/cdr.sql" failed.

Exit Code: 1(General error)

Working directory: /root
Done

Restore processing for modules are finished successfully
Apache will Restart now... And your GUI may die if the ports are changed !!!!
Reloading...... DONERunning Post Restore Hooks.. Please note that hook will restart httpd service so please refresh your page (using new ports)
Running Post Restore Hooks DONE
Finished
Restore completed successfully

I’m not sure where it is getting that password for freepbxuser - it’s not the correct password on either of the servers. I suppose I can force the password to be that and update freepbx.conf but there has to be some problem that caused this in the first place.

It’s almost like the cdr.sql file that is created using the backup and restore module is not correct. I ran:

mysqldump -u root asteriskcdrdb > asteriskcdrdb.sql

and imported that file using the command as shown during the restore failure and that worked. When I tried to run the command as shown in the restore failure manually, I got:

[root@freepbx dbdump]# /usr/bin/mysql --host localhost --port 3306 --user root asteriskcdrdb < cdr.sql
ERROR 1136 (21S01) at line 1: Column count doesn't match value count at row 1

So something is weird when just trying to import the cdr table, but not the whole database. Running:

describe cdr;

from MySQL shows the columns as identical, so that doesn’t appear to be the issue.

After exporting the CDR table directly using:

mysqldump -u root asteriskcdrdb cdr > cdr.sql

and importing that on the new system using the same command as in the fwconsole restore, it restored properly with no errors. So it definitely seems like an issue with the way that backup and restore created the cdr.sql file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.