Reputation: 3
On a CentOS machine we have mediaWiki + bugZilla installed for internal uses. I'd like to use the EMC Networker that there is in our network to backup the databases.
Is it enough to backup the /var/lib/mysql/ directory ? And if yes, do i need to backup the whole directory (ibdata1, mysql, mysql.sock...) or only the mediawiki DB and bugzilla DB. I saw in this post Backup Mysql Databases that
Blockquote For innodb, you'll need to backup using mysqldump Blockquote
Thanks Sam
Upvotes: 0
Views: 3073
Reputation: 161
Nothing to add to the mysqldump portion of the answer above.
WRT to NetWorker there are two ways to make the dump script work automatically before every backup.
In NetWorker versions 8.1 or greater, you can specify a backup "Pre Command" in the client resource that is a script file containing the dump commands along with any other commands you wish to include(sync
for example). The command should begin with the letters nsr
(for example nsrmysqldumpscript.sh
) and reside in the same directory as the other NetWorker binaries (usually /bin
, but can be /usr/bin
, /opt/bin
or others)
In 8.0.x NetWorker and prior, you will need to enter the savepnpc
command in the "Backup Command" attribute of the client resource.
You will then need to create a resource file named for the Savegroup running the client in the client's /nsr/res
directory. For example, if your savegroup is called MySQLFull, you would create /nsr/res/MySQLFull.res
. You can run the group once as a test and savepnpc
will create the file for you.
The resource file will look like this:
type: savepnpc;
precmd: "mysqldumpscript.sh";
pstcmd: "echo noop";
timeout: "5:00am";
abort precmd with group: No;
Using the post 8.1 "Pre Command" is much easier to set up.
If you are backing up a dump, you may want to only specify the the dump directory as yoru saveset.
Upvotes: 1
Reputation: 3193
If you want to use a file based backup solution for backup MySQL databases it is best to create a dump of the database and backup the dump. You can create a backup by mysqldump -u root -p --all-databases > dump.sql
you might also backup you /etc/my.cnf
. Having the configuration makes restoring easier.
Upvotes: 0