GET How to automatically back up MySQL database and Web server in FTP repository / Sudo Null IT News FREE
This article contains uncomparable of the oldest methods proposed away Nothing Craft in 2006. The clause, in my though, is valuable in this it contains, equally it were, a canonical line of thought, in which a novice or "random" (unscheduled to mete out databases in addition to other tasks) system administrator can follow.
In my opinion, an reason of the basic principles part in that article is consanguineous to sympathy the principles of making pilau. You can experimentation with pilaf in a fairly panoptic wander; the main thing is not to churn Elmer Reizenstein into sticky porridge and not stick it into pilaf instead of fatty soft meat, it is non guiltless what. Likewise , the MySQL database backup strategycan vary within a rattling wide chain of mountains, but the basics - a combination of a full backup with incremental backups, establishing the frequence of individual tasks and dominant their correct execution - remain unchanged regardless of the tools misused.
The original article is taken here: http://www.cyberciti.biz/tips/how-to-computer backup-mysql-databases-net-server-files-to-a-ftp-host-automatically.hypertext markup language . Next comes the translation text itself.
* * *
This is a simple patronage root for administrators who run their own MySQL WWW host and database management systems happening devoted surgery VPS servers. Nearly specialized hosting providers bring home the bacon the user with backup services to a ordained network memory board (NAS) or FTP server. These providers bind the substance abuser to their overly operable reposition arrays through a private virtual network. Since I managed to negociate many server projects, I am prompt to offer my own machine-controlled resolution alternatively. If you just want a beat out script, go here (you just need to provided appropriate input signal and it will generate FTP backup playscript for you on fly, you give notice also grab my php script author code).
Incremental backup man using tar utility
You can produce backups on magnetic tape or transport (or work with whatsoever file as with a tape get operating theatre tape recording). But nowadays this solution is losing functionality. The Wildebeest gob utility allows you to create incremental backups using the -g option. In the following illustration, the seafarer command will create incremental copies of the / volt-ampere / www / html, / home, and / etc directories. Ravel it in the console:
# gob -g /volt-ampere/log up/tar-incremental.log -zcvf /backup/now.gob.gz / var / WWW / html / home / etc
Here, the -g switch creates / displays / retrieves a new unrivaled ( additive) information from the substitute and places IT in the /var/log/tar-incremental.log charge.
Creating MySQL Database Backups
The mysqldump client application is for dumping or financial backing leading databases, tables, and individual MySQL information. E.g., the following control will show the list of databases in a specific DBMS:
$ mysql -u root -h localhost -p -Bse 'she databases'
Output (shown as an example):
brutelog
cake
faqs
mysql
phpads
snews
test
tmp
van
wp
Now you can create a reliever a copy of to each one of the databases using the mysqldump command; for instance, for a faqs database, the command might look suchlike this:
$ mysqldump -u root -h localhost -pmypassword faqs | gzip -9> faqs-db.sql.gz
Produce a unlobed backup outline for your undertaking
The principal advantage of exploitation remote meshing storage (FTP or NAS) for storing backups is additional protection against data loss. You can use several protocols to transfer backups:
- File transfer protocol
- Ssh
- RSYNC
- A kind of mercenary solutions
I want to identify here only a solution designed for FTP backup. The idea behind the patronage strategy underlying this solvent is this:
- Creating a full backup of our database or so midnight every Sunday (that is, on Sundays, a backup simulate of the entire contents of the DBMS is recreated);
- During the week, entirely the changed information is backed up (incremental backup).
- The backup bike is repeated every 7 days.
Parameters of our test configuration
Our host ===> file transfer protocol / nas server
Information science: 202.54.1.10 ===> 208.111.2.5
Speculate for the test the following careful information roughly our FTP invoice:
- FTP host IP address: 208.111.2.5
- FTP Account Name: nixcraft
- FTP account password: somepassword
- File transfer protocol directory: / dwelling house / nixcraft (or /)
Places where we will place the backups:
=> / home / nixcraft / full / DD-mm-yy / files - full;
=> / home / nixcraft / incremental / dd-mm-yy / files - incremental.
Here dd-mm-yy are the backup dates.
Machine-driven backup using tar public utility
Now you bang how to back down MySQL files and databases victimisation the tar and mysqldump commands. It's time to automatize the entire procedure conclusively by linking these commands into a single hand.
- To get started, our script collects all the information from both the MySQL server and the file system into a temporary directory called / backup. To do this, use the tar command.
- Incoming, the script connects to your storage server via File transfer protocol and creates the directory structure, which was described to a higher place.
- The script flushes files from the / backup directory to the FTP server.
- The temporary files are removed from the / backup directory.
- If the backup to FTP is fitful for some reason or is unsuccessful, the script will advise you by electronic mail.
To economic consumption the script correctly, you must bear the following packages installed (the ncftp utility is victimised as the FTP client):
- ncftp
- mysqldump
- Wildebeest mariner
A list of our example, called ftpbackup.sh, is shown downstairs:
#! / Bin / sh
# System + MySQL backup handwriting
# Rumbling backup daylight - Sun (pillow of the day coiffure incremental accompaniment)
# Copyright © 2005-2006 nixCraft < World Wide Web.cyberciti .biz / fb >
# This script is accredited under GNU GPL version 2.0 or above
# Automatically generated by bash.cyberciti.biz/reliever/wizard-file transfer protocol-script.php
### System Setup ###
DIRS = "/ home / etc / var / www "
BACKUP = / tmp / backup. $$
NOW = $ (date +"% d-% m-% Y ")
INCFILE =" / root / tar-inc-backup.dat "
DAY = $ ( date + "% a")
FULLBACKUP = "Solarise"
### MySQL Setup ###
MUSER = "admin"
MPASS = "mysqladminpassword"
MHOST = "localhost"
MYSQL = "$ (which mysql)"
MYSQLDUMP = "$ (which mysqldump)"
GZIP = "$ (which gzip)"
### FTP server Setup ###
FTPD = "/ home / vivek / additive "
FTPU =" vivek "
FTPP =" ftppassword "
FTPS =" 208.111.11.2 "
NCFTP =" $ (which ncftpput) "
### Other stuff ###
EMAILID =" admin@theos.in "
### Kickoff Fill-in for file system ###
[! -d $ Stand-in] && mkdir -p $ BACKUP ||:
### See if we privation to make a full backup ###
if ["$ DAY" == "$ FULLBACKUP"]; then
FTPD = "/ home / vivek / full"
File away = "fs-full- $ Immediately.tar.
tar -g $ INCFILE -zcvf $ BACKUP / $ FILE $ DIRS
fi
### Start MySQL Backup ###
# Get all databases name
DBS = "$ ($ MYSQL -u $ Muller -h $ MHOST -p $ MPASS -Bse 'show databases') "
for db in $ DBS
do
File out = $ BACKUP / mysql- $ dubnium. $ In real time - $ (date +"% T "). gz
$ MYSQLDUMP -u $ MUSER -h $ MHOST -p $ MPASS $ db | $ GZIP -9> $ FILE
done
### Trash dump backup using FTP ###
#Start FTP reliever using ncftp
ncftp -u "$ FTPU" -p "$ FTPP" $ FTPS <
mkdir $ FTPD / $ NOW
candela $ FTPD / $ NOW
lcd $ Relief
mput *
quit
EOF
### Recover out if FTP backup failed or not ###
if ["$?" == "0"]; and so
rm -f $ BACKUP / *
other
T = / tmp / backup.run out
echo "See: $ (engagement)"> $ T
echo "Hostname: $ (hostname)" >> $ T
echo "Championship failing" >> $ T
get off -s "BACKUP Unsuccessful" "$ EMAILID" <$ T
rm -f $ T
fi
How to fructify automatic periodic backup book execution using cron utility?
Only add the cron labor with the required time and absolute frequency parameters:
13 0 * * * /home plate/admin/bin/ftpbackup.sh> / dev / goose egg 2> & 1
As a short afterword from the translator.
Since data backup tasks are among the most ofttimes worrying problems for the system of rules executive, the applicability of a successful playscript in this country, even without alterations and changes, can turn around out to be very high for 5, 10, or 20 years. In particular, a script similar to that described in the clause, only made initially under Windows, worked for several years on one of the servers of our institute, until we replaced it with a more modern and advanced Graphical user interface program.
It is clear that sobering administrators are able to create such scripts happening their have, without much effort. My goal was to show the system of logic on which we, scientists, who, due to familiar economic reasons, were forced to work with electronic computer databases, educated how to build tasks for interacting with the OS and DBMS at the command oral communicatio level. Such users who are only mastering scripts and database administration, so much examples can be extremely useful.
These are ideological considerations, so to speak. A foreign script can be quite an accurately compared with a chess sketch, which exponentially solves a particular proposition trouble. Classical solutions, equivalent the one bestowed above, can suit a time-tried field for independent experiments, show the logic and commission of thought for those who are not satisfied with the functionality of products with a GUI and want to sample to bring to life the full power of pile commands. Thence, for Pine Tree State, it's epoch-making not so some ago, or, conversely, the effectiveness of the proposed solution, how much its internal logic and explainability of each of the points. Taking it every bit a base, you lav easily make over your ain "chalk out" for another DBMS or a different range of tasks; the general logic of thinking, set once, testament in the future become a valuable addition to the armoury of the administrator or developer.
The ease of understanding, the fulfillment of the stated basic conditions (which were discussed at the beginning of the clause) and the small size of this handwriting take into account me to recommend it as a foot for various experiments with financial backing up MySQL information. Well, and if this "cogitation" is completely tabu of particular date - asymptomatic, maybe that is. IT bequeath be interesting to comparison it with the solutions that modern programmers and system administrators are now offering for the same project. Welcome to the comments with your possess scripts that can put the above product on your belt.
DOWNLOAD HERE
GET How to automatically back up MySQL database and Web server in FTP repository / Sudo Null IT News FREE
Posted by: wilsonconfor45.blogspot.com
0 Response to "GET How to automatically back up MySQL database and Web server in FTP repository / Sudo Null IT News FREE"
Post a Comment