Page 2 of 2

Re: Plesk backup killing the server

Posted: Tue Apr 24, 2012 7:59 am
by breun
nobody wrote:
breun wrote:I recommend not trying to be smart about what directories to backup, but just backing up all regular partitions.

I don't recommend backing up the files in /var/lib/mysql though, at least not as your primary way to back up MySQL databases, as they are not guaranteed to be in a consistent state when you back them up. I recommend doing SQL dumps and backing up those.
I am not trying to be smart.

Code: Select all

http://kb.parallels.com/en/819
It is pointless to backup the OS. The point of backup is in case of a disaster such as hardware failure or in the event a site was hacked to be able to restore recent data and in the fastest possible time.
I don't think it's pointless to backup the OS. You might not need those files when you need to rebuild a server, but in case something goes wrong (an RPM install for instance), a file gets corrupted, a file's contents look weird, you suspect permissions have gotten modified somehow, etc. it's always great to be able to go back to the backup of any file on the server. BackupPC's hardlinking and compression features allow us to store full backups for lots of servers on a single BackupPC server, so we default to backing up everything.

Re: Plesk backup killing the server

Posted: Tue Apr 24, 2012 4:51 pm
by faris
Um.....mounted volume disk snapshot: http://www.r1soft.com/tools/linux-hot-copy/

Re: Plesk backup killing the server

Posted: Wed Apr 25, 2012 2:06 am
by paulie
And for the databases : http://www.percona.com/doc/percona-xtrabackup/

(Which sounds like how r1soft do their MySQL backups).

Re: Plesk backup killing the server

Posted: Fri Aug 17, 2012 9:20 am
by cmpreshn
Hi all. I'm running Plesk 9.5.4, and am having issues with Plesk not removing old backups. Troubleshooting this, I deleted some of the backup data files from the command line (just the .tgz files), and I think now things are out of sync between the backup data files and their related info.xml files.

Is it possible to just delete everything in var/lib/psa/dumps/ and start over?

I've looked in the psa database for records corresponding to individual backups, but I can't find one. So I think the only info in the database is the backup schedule and currently executing backups - not a record for each individual backup. My assumption is that if I wipe it all out, Plesk will recreate directories for clients/domains/.discovered, etc. as necessary when I run new backups. Anyone ever tried this? If so, please post back if there are any problems.

Just to be clear, I'm thinking about running rm -R * from the /var/lib/psa/dumps/ directory.

Thanks in advance!
Scott

Re: Plesk backup killing the server

Posted: Sat Aug 18, 2012 8:01 am
by nobody
I have the solution for you ! You see plesk backups are not stored in any way in the plesk datrabase. Plesk "reads" backups from the xml files it generates. There is only one clean way to delete them.

Code: Select all

find /var/lib/psa/dumps -type f -mtime +7 -delete -print
This command will delete all files which are older than 7 days in the /var/lib/psa/dumps folder. YOu may adjust the number as you wish.

Hope I've helped.

Take care
cmpreshn wrote:Hi all. I'm running Plesk 9.5.4, and am having issues with Plesk not removing old backups. Troubleshooting this, I deleted some of the backup data files from the command line (just the .tgz files), and I think now things are out of sync between the backup data files and their related info.xml files.

Is it possible to just delete everything in var/lib/psa/dumps/ and start over?

I've looked in the psa database for records corresponding to individual backups, but I can't find one. So I think the only info in the database is the backup schedule and currently executing backups - not a record for each individual backup. My assumption is that if I wipe it all out, Plesk will recreate directories for clients/domains/.discovered, etc. as necessary when I run new backups. Anyone ever tried this? If so, please post back if there are any problems.

Just to be clear, I'm thinking about running rm -R * from the /var/lib/psa/dumps/ directory.

Thanks in advance!
Scott

Re: Plesk backup killing the server

Posted: Tue Aug 21, 2012 3:45 pm
by cmpreshn
Thanks! That worked well.

I'm still trying to find out how I can get Plesk to enforce the backup limits that I have listed in the Backup Settings. Some domains I would like to keep longer than others, so if the "Limit backups" setting worked, that would be much better. So far I can't find out where it is failing.

Does anyone know the location of the script that should be removing the old backups? Everything else is working fine for me. Plesk backs up on schedule as expected to local repository. It just doesn't remove the out of date backups. If I knew where the script was I could probably track this down...

Re: Plesk backup killing the server

Posted: Wed Aug 22, 2012 1:27 pm
by nobody
cmpreshn wrote:Thanks! That worked well.

I'm still trying to find out how I can get Plesk to enforce the backup limits that I have listed in the Backup Settings. Some domains I would like to keep longer than others, so if the "Limit backups" setting worked, that would be much better. So far I can't find out where it is failing.

Does anyone know the location of the script that should be removing the old backups? Everything else is working fine for me. Plesk backs up on schedule as expected to local repository. It just doesn't remove the out of date backups. If I knew where the script was I could probably track this down...
Plesk backup is a pain in the *** ... I've tried many things. Didn't find a solution. The only solutions are the following.

1. Take backups with custom scripts and rsync them somewhere. But its not guranteed that when you bring back the backups it will work ... Maybe you can take backups in the local repository and then rsync this whole folder somewhere ... I've done this as well.

2. There are also some commercial solutions but cost a lot and they require that you have another server just for taking the backups.

Generally I've always had problems with plesk backup. I still have. If you have a server with approximately 50GB backup you have a real problem. The plesk backup utility was not built for large backups and servers with many domains.

Cpanel has a nice backup utility. Has its own issues but it works better and smoother for the server. I haven't come across any other solutions to be easy, cheap and work better. If you find any solution though please share it with us. We are all looking for a better solution I believe.

Re: Plesk backup killing the server

Posted: Thu Aug 23, 2012 12:28 pm
by cmpreshn
Yeah. I've been RSYNC-ing /var/lib/psa/dumps to our local fileserver here - when that started taking longer than it should was when I noticed older backups were not deleting as they should. Thanks a ton for your help though. I'll post back if I find any answers. My only guess at this point is that there is a permission problem preventing the PSA backup manager from deleting old backups. I'm going to try and hunt that down...

Re: Plesk backup killing the server

Posted: Thu Aug 23, 2012 2:37 pm
by nobody
cmpreshn wrote:Yeah. I've been RSYNC-ing /var/lib/psa/dumps to our local fileserver here - when that started taking longer than it should was when I noticed older backups were not deleting as they should. Thanks a ton for your help though. I'll post back if I find any answers. My only guess at this point is that there is a permission problem preventing the PSA backup manager from deleting old backups. I'm going to try and hunt that down...

Put in your crontab script first the command that deletes old backups and you should be fine !

Yes if you find a better solution please let us know :)

Re: Plesk backup killing the server

Posted: Thu Oct 04, 2012 1:58 pm
by ikkk
We use rsnapshot to do pull style backups from servers - it has a nice feature where it can trigger a script before a backup - as such we use a script to trigger mysqldumps on a per table basis to avoid locking tables too much just before we do the backup.

Simple script that will work on most plesk servers to backup databases on a per table level:

Code: Select all

#!/bin/bash
export savepath='/usr/mysqlbackups'
export usr='admin'
export pwd=`cat /etc/psa/.psa.shadow`
if [ ! -d $savepath ]; then
    mkdir -p $savepath
fi
echo 'mySQL Backup Script'
echo 'Dumping individual tables..'
for a in `echo 'show databases' | mysql -u$usr -p$pwd | grep -v Database`;
do
  mkdir -p $savepath/$a
  echo "Dumping database: $a"
  for i in `echo 'show tables' | mysql -u$usr -p$pwd $a| grep -v Tables_in_ |sed -e 's/ /_/g'`;
  do
   echo " * Dumping table: $i"
   mysqldump --compact --skip-opt --add-drop-table --allow-keywords -q -a -c -u$usr -p$pwd $a $i > $savepath/$a/$i.sql
  done
done
So rsnapshot triggers this, and then its next command is to backup the directory /usr/mysqldumps or such

rsnapshot does incremental backups by using hardlinks between the folders so you only use space for changed files rather than storing the same file over and over again. still uses rsync under the bonnet to do transfers.

Another method ive played with very lightly is csync2 and lsyncd - csync2 can send files to more than one location at once - offsite and local backups for example - combined with lsyncd it can monitor and do this as soon as any files change. theres a good article on this at https://www.axivo.com/community/threads ... syncd.121/