[Release] MySQL AutoBackup

03/29/2014 14:44 €clips3#1
[Only registered and activated users can see links. Click Here To Register...]


Hallo,
nochmal ein kleines Release von mir.
Da hier einige Leute nicht wissen wie man die einfachsten Programme zur Datensicherung nutzt oder einfach zu faul sind sich damit zu beschäftigen hab ich mal rausgesucht was ich irgendwann mal geschrieben habe, damit evlt. die Spieler des Server's davon provitieren.

Es sichert alle Datenbanken im per Configfile festgelegten Intervall.
Angaben unter cycle sind in Minuten.
Für die jenigen die Probleme haben mit der Zeit -> [Only registered and activated users can see links. Click Here To Register...]

Ein Verkauf des Tools ist untersagt!
Updates werden hier nicht kommen.
03/29/2014 15:02 Solution.?#2
Läuft, saubere Arbeit.
03/29/2014 15:11 €clips3#3
Quote:
Originally Posted by Solution.? View Post
Läuft, saubere Arbeit.
Danke
03/29/2014 15:42 PizzaGuy#4
Easier to setup a cron job in my opinion.

Edit "/etc/crontab"
Code:
30 2 * * * root mysqldump -u root -pPASSWORD --databases newproject_data newproject_db newproject_db_auth newproject_post | gzip > /home/user/database_`date +\%m-\%d-\%Y`.sql.gz
Make sure you change the database names and output directory to match yours.

Then restart your cron
Code:
/etc/init.d/cron restart
Now the OS will backup the database at 2:30 AM every day.
03/29/2014 15:59 €clips3#5
Quote:
Originally Posted by PizzaGuy View Post
Easier to setup a cron job in my opinion.
Sure.
03/29/2014 16:04 Wizatek#6
Warmonger is right.
And on windows you can do the exact same thing with Window Task Scheduler, using almost the same command.
Don't need a special program for that
03/29/2014 18:58 Chicken.ShooT#7
Yes, easier for people who know how to set a cronjob. :D
We're using a script with LZMA(7zip)-Compression and SCP-Transfer to another server... backups are a lil bit useless on the same server.^^ Than you dont need a backup xD

For the "beginners" is [Only registered and activated users can see links. Click Here To Register...] good... don't forget to set a htaccess-File.
03/30/2014 00:46 Wizatek#8
In case of a hack attack, a SCP transfer might also nog be the right choice since you have your password, or private keys right there. I personally use a FTP server with only write access from that user, so not overwrite or delete. Like this u make sure that if someone entered your server that he can't reach the database backups.
03/30/2014 01:14 Chicken.ShooT#9
We have set a password on the archives AES-256.. but nothing is secure. FTP for example is unencrpted..
03/30/2014 11:59 PizzaGuy#10
Quote:
Originally Posted by Chicken.ShooT View Post
We have set a password on the archives AES-256.. but nothing is secure. FTP for example is unencrpted..
Encrypting the backups serves no benefit, as the hacker would have root privileges on your server which already grants full database rights. I was able to take AIO database without even having access to the server. Short and sweet, backups are only intended so you don't lose anything. Otherwise there is no special/fancy way of keeping them. As long as you know they are somewhere you cannot lose them. The simplest way to do so is create a Cubby or Dropbox account solely for the server. And have it dump the databases to the synced folder. So the databases are automatically stored on the cloud the second they are dumped. And even better you can download the client to your home computer so it syncs to both the cloud and your personal computer.
03/30/2014 12:02 MrTherzon#11
Nice Danke.
03/31/2014 17:10 Chicken.ShooT#12
Quote:
Originally Posted by PizzaGuy View Post
Encrypting the backups serves no benefit, as the hacker would have root privileges on your server which already grants full database rights. I was able to take AIO database without even having access to the server. Short and sweet, backups are only intended so you don't lose anything. Otherwise there is no special/fancy way of keeping them. As long as you know they are somewhere you cannot lose them. The simplest way to do so is create a Cubby or Dropbox account solely for the server. And have it dump the databases to the synced folder. So the databases are automatically stored on the cloud the second they are dumped. And even better you can download the client to your home computer so it syncs to both the cloud and your personal computer.
Yes thats right, but when your server is hacked, than are the backups the least problem.^^ When the hacker have only access to the backupserver, than he must crack the archives, before he get the databases and other files, heavy task. The private key from backupserver is stored on the mainserver, not the other way.
Yes a cloud is better...^^ good argument.:D
04/01/2014 08:45 PetraPokers#13
Hi,

für einige sicher nützlich aber man braucht für Backups eigentlich kein Tool oder sonstiges...
Ein einfaches Script reicht da völlig aus, welches man im Screen laufen lässt...
(Beispiel: screen -a -S backup)...

Einfaches Beispiel für ein 30 Minuten Backup das sich jede Stunde überschreibt (backup.sh):

#!/bin/sh

mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/auth1.sql newproject_db_auth;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/user1.sql newproject_db_user;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/post1.sql newproject_post;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/db1.sql newproject_db;
sleep 1800;

mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/auth2.sql newproject_db_auth;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/user2.sql newproject_db_user;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/post2.sql newproject_post;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/db2.sql newproject_db;
sleep 1800;


mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/auth1.sql newproject_db_auth;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/user1.sql newproject_db_user;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/post1.sql newproject_post;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/db1.sql newproject_db;
sleep 1800;

mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/auth2.sql newproject_db_auth;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/user2.sql newproject_db_user;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/post2.sql newproject_post;
mysqldump -u root -pxxxxx -r /pfad/zielverzeichnis/db2.sql newproject_db;
sleep 1800;

usw.

User, PW, Zielverzeichnis usw. kann jeder selbst anpassen, das dient nur als Beispiel...
Das kann man solange erweitern (auth3/auth4 usw.) und wiederholen oder als cronjob laufen lassen wie man will und man braucht kein "extra" Tool oder Software für sowas...
Die Backups werden in Folge angelegt und überschreiben sich auch wenn man es will...
Je nachdem, wie man es haben möchte...

Das nur nen einfaches dummes Beispiel von mir, wie jederman simple Autobackups anlegen könnte auch ohne "Tool" oder sonstiges...

Backups können bei Bedarf via SSH täglich vom Root runtergeladen werden...


04/01/2014 15:19 VisionEP1#14
??
Warum den code x mal?
Entweder schleife oder besser per cronjob
04/01/2014 19:24 PetraPokers#15
Quote:
Originally Posted by VisionEP1 View Post
??
Warum den code x mal?
Entweder schleife oder besser per cronjob
Das war als Beispiel damit es jeder sieht und versteht wie einfach sowas ist und man kein Tool benötigt...
Natürlich braucht man die Dumps nur 1x wenn man das Scipt Endlos laufen lässt :)
Mein Beispiel zeigt nur, wie simple 4 Backups angelegt werden, wovon die letzten 2 die ersten 2 überschreiben...
Hätte ich es nur 1x gemacht, dann würden sich 90% fragen wie kommt der auf überschreiben oder was überhaupt ist ein cronjob...
Meisten haben nichtmal screen installiert oder wissen was das alles ist oO
Hätte auch noch hinzufügen können das man es mit killall backup.sh beenden muss...

Ich habe es auch oben geschrieben:
Einfaches Beispiel für ein 30 Minuten Backup das sich jede Stunde überschreibt (backup.sh):
"Das kann man solange erweitern (auth3/auth4 usw.) und wiederholen oder als cronjob laufen lassen wie man will"

Für solch Larifarikram und nem 4 Zeilenscript braucht man eigentlich kein Tool...
Aber ich verstehe den TE voll und ganz und finde es gut das er sowas für alle anbietet^^
Nicht jeder weiss wie man sowas macht...
Ich wollte nur hilfreich sein und zeigen wie einfach es ist um es selbst zu machen :)
Ein einfaches Textdokument reicht da völlig aus und nach oben ist noch sehr viel Luft, auch was packen der backups angeht usw...
Man braucht nur eine stumpfe Textdatei für alles und kein Tool... (so wie eigentlich immer)
Aber es ist ein positives Tool für LC und nicht eins was LC schadet, deshalb ist das eine super Sache mit dem Tool in meinen Augen und Danke an den TE...