(Solved) Remote CDRDBHOST Exclusion from Backup

Im attempting to backup a HA system to a standalone. It keeps populating the CDRDBHOST (Remote CDR DB Host, in advanced settings) with the IP of the HA, which of course is not in the standalone backup. I tried putting CDRDBHOST in the mysql exclusion in the backup, but it still copies over. Im out of guesses.

Can anyone assist here?

Iā€™m not sure where you are trying to do this.

CDRDBHOST is a setting in the configuration, so backups of the files from the HA server should include that setting.

Try providing us with a little more information and we might be able to figure out what you are talking about.

I am trying to backup to a tertiary backup, which is not an HA system, only a standalone server. Backup will not run from the tertiary server connecting to the HA as it cannot locate the internal IP of the cdr remote host specified in the HA settings. I figured excluding it, if I could figure out how, would be the easiest workaround.

Iā€™m sorry that Iā€™m not sharp enough to understand what you are trying to do.

Let me explain.

You keep talking about backing up CDRDBHOST. That is a setting. You back it up when you back up the /etc/amportal.conf file (IIRC). It might also be a couple other places - it depends on the specific version of your system and how youā€™ve managed your servers in the past.

If you are using a CDR database, chances are itā€™s being stored in the database ā€œasteriskcdrdbā€ in a table called ā€œcdrā€. There are a couple of possible hosts for this: 127.0.0.1 (the localhost) or the ā€œroutable privateā€ address of your database server.

If CDRDBHOST is set to 127.0.0.1, it will do you precisely no good if you are trying to do something from a remote computer. Itā€™s 127.0.0.1 is itself - this is always true.

To confound the process even more, the CDR database login is probably limited to ā€œlocalhostā€ for connections, so you wonā€™t be able to back it up from outside the server the program is actually running on.

Next, there is no guarantee that you are using a CDR Database. If your HA server set is configured to write all of the CDR data to a database, it is already in that database. Backing up the CDR database should be a simple matter of backing up the data.

If you are using CDR CSV files as your backup medium (not unusual, but I donā€™t know enough about the internal workings of HA to know for sure) then those files (the CSVs) will get backed up with the normal backups of /var/spool/asterisk.

So, if you are using a host-based CDR database to store your CDR data, you only want to backup the data, not the database files. Backing up the data can be accomplished one of several ways, but a blunt-force file copy is the least effective of these, especially if your CDR database is an INNODB database.

So, there are a few things that you need to look at. Note that we donā€™t need to know the answers to these questions - just that youā€™ve looked at them.

  1. Are you using a database for your CDR database, or are you using CDV files?
  2. If you ARE using a SQL database for CDR, do you have a user that can connect from the tertiary server to the SQL port and open the CDR database table?
  3. Are you capable of setting up a ā€œdata onlyā€ backup and restore of the data in the SQL database on the primary and secondary servers to your tertiary server.

The request is simple, OP doesnā€™t want the CDRDBHOST setting included in the backup, or alternatively, does not want that setting restored to the destination. There is no supported way to do this (that I can think of), but there is an option to run a script post restore on the destination machine to correct the CDRDBHOST setting.

Ah - I think I understand that.

With the post-run script option, a quick ā€œsed ā€˜s/CDRDBHOST.*//ā€™ < infile >outfileā€ would work then.

No, post restoreā€¦ so it would be fwconsole setting CDRDBHOST ""

1 Like

Thanks all for the replies. Thanks Rob, verified working.

1 Like