-
Get a monthly update on best practices for delivering successful software.
If you're a DBA or a Sysadmin, your flock is probably larger than you think it is. By this, I mean, your organization, or your department, probably has more database servers than you think it does. Probably a LOT more.
Today's post aims to help you locate these "lost lambs" and bring them back into the fold. I am using the example of MySQL, but many of these strategies apply to other database software.
Like any company that manages infrastructure for clients, we often run into emergency cases where a client database needs to be restored. Sometimes we're not sure how they are being backed up, or even IF they are being backed up at all. Why? Sometimes databases magically drift from experimental to production. This points to governance issues of how and when applications and environments should be promoted to production, but it still leaves the practical question of "what do I do now with all of my lost databases?"
In many cases we end up auditing ALL of the databases at a client's sites. What we find often surprises the client. In one case we found more than 12 undocumented instances of MySQL! Many of these had sprung up in the past few months.
MySQL is a very capable, free, open source database server. These qualities make it very easy to bring up new instances of MySQL quickly. The downside of this is that they are often not tracked, managed, secured, or backed up as carefully as they should be.
If you find yourself in a similar situation, the first thing you should do is audit your database servers. Count them, but also determine the following information about them. (It may be helpful to use a table or spreadsheet.)
hostname
type (standalone, replicated, cluster)
IP address(es)
purpose(s)
criticality of the database server (impact if this server goes down)
criticality of the data (impact if amount x of this data is lost)
applications it depends on
applications that depend on it
security policy regarding the data and the server
privacy policy regarding the data
table engines in use (InnoDB, MyISAM, etc.)
current primary MySQL backup method
any changes proposed for primary MySQL backup method
proposed supplemental MySQL backup method
filesystem backup method
bare-metal (disaster recovery) backup/restore method
date of last MySQL restore test
date of last filesystem backup test
date of last bare-metal restore test
Please notice that we list filesystem and bare-metal backups and MySQL backups separately. All are important, but in this post we will focus on MySQL backups.
Effective MySQL backup methods vary depending on the structure of the server, and the table engines in use. Here are some suggestions:
standalone, MyISAM: mysqldump & binary logging
standalone, innodb: innodb Hot Backup & innobackup Perl script (automates a "sharp" backup of MyISAM & InnoDB tables)
replicated, innodb: stop replication on one slave server, back up that slave server using innobackup and/or mysqldump, re-syncrhronize the slave server
clustered, ndbcluster: "online backup", which is a "hot" or "live" backup initiated using the MySQL cluster management server
Also, some open source and commercial filesystem backup solutions can provide agents or plug-ins that allow "hot" backups of MySQL. One solution we often use is Arkeia. From Arkeia's home page:
"The Arkeia MySQL plug-in is easy to install and configure: databases and table backup/restore can be selected via the convenient navigator in the Arkeia GUI. Backup can be defined up to the table level. Binary logs are also backed up, enabling the restore of databases at an exact state between two backups."
"Arkeia has a distinct advantage over other database backup solutions: a multifl ow system that enables faster backup than other software. This allows back up of multiple tables at the same time."
Some people advocate LVM2 snapshots as a way to backup live MySQL databases. However, this approach can be problematic. That is because the very databases that probably need backups most (large, high traffic databases), are the ones for which the snapshot or the number of locked tables may quickly grow too large to make snapshots practical.
Mike Kruckenberg has an excellent post discussing these issues. He concludes that IF you are using the innodb engine, and IF you prefer not to purchase the innodb hot backup program from Innobase Oy (now owned by Oracle), LVM2 snapshots may be a good choice.
We hope we have given you some food for thought. Happy Shepherding!
Technorati Tags: database administration, system administration
When you are satisfied with your rules, you can deny the traffic by changing the default action to this: