QmailtoasterMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Talk:User Tips & Tricks

From Qmailtoaster

Automated Backup and restore

How to Backup your qmailtoster server to an other server. Through necessity, I have created a Backup server ( server2 ) to act as a copy of my main qmailserver ( server1 ) and automated the process.

Note this is not the only method , and I give no guarantees it will work for you. I installed two server identically using QMT.iso Centos 5 version from our great friend Jake Vickers. I also purchased and installed qcontrol for ease , and it is great.

Login to server 1 (your IP address ) cd /root

Create the Key file ssh-keygen -t dsa ( this will be called id_dsa_pub ) in the /root/.ssh/ folder

Check the file exists cd .ssh/ ls

Copy file to Server 2 ( your IP address ) scp id_dsa.pub root@ enter root password on server 2

SSH to server 2 ssh root@ enter root password again

Check the file came across cd /root/.ssh ls

Add the key to the authorized_keys files cat id_dsa.pub >> /root/.ssh/authorized_keys

Your server 2 is now setup to allow root to login from server1. Exit and login again, it should not ask for a password if all went well.

ssh root@ exit, back to server 1.

Your back up should be in the /backup/ Called something like 200904280102-backup.tar.gz

 ( year, month, date, time-backup.tar.gz )

Depending on your system, it can take hours. So I created a script, to backup then SCP the backup to server 2

Here is mine: /root/backup.sh

mkdir /saved ( for older backup tar files )

# run backup command
# Copy file to server 2 using SCP to the /root folder
cd /backup
scp *-backup.tar.gz root@

save the file , and make it executable: chmod +x backup.sh

On server 1 make a cron job to run the backup (mine is at 02:00 ) crontab -e

* 2 * * * /root/backup.sh

The scrip will copy all *-backup.tar.gz, so make sure there is only the current, move older backups to other folder. On server2

Thanks to Erik, modify the qtp-restore script. Change: read -p "Please enter your MySQL Root password: " mysqlrootpass

to read -p "Please enter your MySQL Root password: " mysqlrootpass mysqlrootpass=your_password

Save it ..

create a cron job for the restore : i run mine at 04:00

* 4 * * * /usr/sbin/qtp-restore

Login to server2 and double check everything restored, you may have to reboot , not sure yet.

Hope this helps someone, as it was to late for me. All my tests worked, this is a true working environment, not a Lab test.


Retrieved from "http://wiki.qmailtoaster.com/index.php/Talk:User_Tips_%26_Tricks"

This page has been accessed 2,554 times. This page was last modified on 28 April 2009, at 21:28. Content is available under GNU Free Documentation License 1.2.


Main page
Community portal
Current events
Recent changes
Random page
View source
Editing help
This page
View content page
New section
Printable version
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list