SQLdump to/via windows to NAS

Hi,

I’ve got another question.
I was wondering how I could setup a backup system using windows and a NAS.
I know how to perform an SQL dump via the linux terminal itself as mysqldump but I would like to find a way to use windows or maybe even via Linux if possible to create an sqldump of all databases and save that backup not on the FreePBX machine but directly to a windows server or NAS solution.
Could anyone help me out how I could do this?
Do I need to use rsync or SAMBA or can I just run a task from windows which connects to the FreePBX mysql database with, for example, user = root and password = passw0rd?
Or do I create a cronjob which just moves the file to the NAS?

Thx in advance

Use the backup module in 2.10. You can also have it backup with SSH or FTP to a different machine.

You could look at cygwin that will get you a posix shell in windows that you can script with. Or could mount a NAS directory on your system.

Thx for the info.
But I’d prefer to not use a backup module and use a script instead.
As like dumping an sql file simply to a folder on the FreePBX and then maybe have it placed to a NAS.
This is more of a SAMBA thing right?

Or what would be even more nifty, having a windows server accessing the mysql database, creating it and moving it to the correct location.
Would I require samba then? Or can I use a windows sql application which allows me to connect to the FreePBX mysql database by using the user and password for mysql from FreePbx?

Regards

Your best bet would be to make a connection to the DB from the windows box.

Just add an account to MySQL for that purpose.

Could you please elaborate on that SkykingOH?
I know I’m asking a lot and you could say “google it” but a step by step guid would be nice.
As in what to put in the windows script, opening ports if needed… etc etc, the full works :).

Thx

I don’t know how to write “windows script” as if there is any such thing. You would have to write it in a programming language that supports sql connections.

I can’t teach you all of that in forum posts. Get a book on SQL and start reading if you are interested.

If you don’t understand how to do what you are trying why not use the perfectly functional backup module?

Besides, if backup is your goal you do realize the DB is just part of the puzzle? You have to backup the astdb (that is in Berkeley format) along with provisioning directories, voice mail and recordings (flat files) and the system files.

Just realised I could probably run MySQL workbench on the windows machine, have it connected through the manager and run mysqldump from the workbench.

The only thing thats holding me back now is creating an automated backup schedule, but I think I can get to that :D.

Thx for all your help.

Good luck.

How will you be backing up the Asterisk parts that are not in the MySQL database like the ASTDB and the files in the various directories?

Well I have an rsync script I created a while back that I could use to create a backup of the database AND any other required files but the people here want me to ONLY backup the database to windows or a NAS.

Have you informed these “people” that the database alone will not be sufficient to restore the PBX?

Yes I have, about 4 times but it does not seem to matter.
Though I have been kind enough to create manual backups of astdb, voicemail and audio files. :slight_smile:

You need a new boss. Have him call me.

We give you a perfectly working backup tool and he wants to “roll his own”

It will take you so much longer and tinkering to restore.

Yes, do you know how to restore the astdb?

Correct me if I’m wrong but all I need to backup is the sql database, astdb, the /etc/asterisk folder, /tftpboot/ and that’s it, right?

But, maybe no, there are usually important files to the state of your machine also in:-

/var/lib/asterisk/

(asterisk’s home directory) and

/var/spool/asterisk

asterisk puts your vmails and monitor files (and a few things more), be careful there are symlinks there!!

@Skyking: I can just copy it over?

@dicko: The only important file I know of in /var/lib/asterisk/ is the astdb file, as for /var/spool/asterisk, I don’t think I need anything from there.

I’ve tested restoring Freepbx by re-importing the database, copying over astdb, /etc/asterisk and /tftpboot and I think I had everything back as it was.
Am I missing something?