Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Linux troubleshooting bible - Negus C

Negus C Linux troubleshooting bible - Wiley publishing , 2004 . - 644 p.
ISBN:076456997
Download (direct link): linuxtroubleshootingbible2004.pdf
Previous << 1 .. 52 53 54 55 56 57 < 58 > 59 60 61 62 63 64 .. 272 >> Next

# mysqldump --opt -all-databases -user=root >
/root/all-databases_$( date +%Y-%m-%d).sql
This will freeze and copy all of the databases out to a time-stamped flat file under /root/In newer MySQL database Freeze and Copy option is another included tool called mysqlhotcopy. This does a table level or all-database read-only lock effectively, clones everything in the mysql data directory (/var/lib/mysql/for most
RPM-based systems) out to a directory of your liking, and then unlocks the databases when done. This is what the shell usage looks like:
# mysqlhotcopy ~user=root --allowold ~regexp=".’" /root/mysql-backup
Your regular system backups will now get the static database files in /root/mysql-backup/ and you'll be good to go.
mysqlhotcopy is great if you're running MylSAM storage engine table types. But if you're running innodb table tapes, you really do need to shut down the whole service and do a cp-a /var/lib/mysql/*/root/mysql-backup/, otherwise you will not get your innodb database content. If you're not sure which engine/table type you're running, then you're probably running the default MylSAM type and you have nothing to worry about.
For more info, do a mysqlhotcopy-h or perldoc/usr/bin/mysqlhotcopy.
Note As of the Fedora Core RPM of mysql-3.23.58-4, there is a known bug with Red Flat's copy of mysqlhotcopy that creates an error when trying to use the program. As this book goes to press, there seems to be a patch file for this on bugzilla that should be released in MySQL 3.23.58-8 along with Fedora Core 2. See Red Flat bugzilla and mysql for the latest info on this: https://buqzilla.redhat.com/buqzilla/show_buq.cqi7icM 12693.
Setting up Tape Drive Devices
Commands from dump, restore, mt, and tar will all want to see the device file called /dev/ tape in place to backup and restore from. For example, mt rewind and mt-f /dev/stO rewind should do the same thing if you have a symlink set up from /dev/tape to /dev/stO. But with some of these commands, if no device file is given /dev/tape is the default, so you should have this link set up. If you don't and you are using a SCSI tape drive (/dev/stO) set that up now, using the following commands:
# In -s /dev/stO /dev/tape
# Is -la /dev/tape Irwxrwxrwx Iroot root 8 Mar 14 15:17 /dev/tape->/dev/stO
Note When working with tape devices, you have two device names (besides /dev/tape) that signify two different tape drive behaviors. The device name/dev/stO will be your first auto-rewinding SCSI tape device, and the device /dev/nstO will be the same device but it will not auto-rewind at the end of a backup. This is significant in that multiple backups to stO will overwrite each other (what most backup software expects).NstO will not overwrite, but will continue to append backups to the end of the previous backup. In this chapter, we will be assuming that /dev/tape is always pointing tc/dev/stO and rewinding after each backup.
Shutting Off Services
As previously mentioned, you don't want to back up a system with a bunch of actively changing files on it. You get around this by shutting down these services or using the Stop and Copy method.
One of the most orderly ways of doing this is via runlevel 4. In most Linux distributions, runlevel 3 is the command line or headless mode in which you might run a web or e-mail server: you don't need a GUI/X11 display (as you would on a desktop). Desktops and workstations, on the other hand, need to run in a default runlevel of 5 (at least for Red Flat-based systems).
Using Runlevel 4
If you want good system backups, you will probably want to turn off your "disk chatty" services in runlevel 4, and then use this runlevel as your system backup runlevel to run your backups.
Flere's a list of some services that you might want to shut down on a server for backups:
® sendmail
■ mysqld
® apache
■ vsftpd ® syslog
® Ipd or CUPS (printing services)
■ rhnsd (Red Hat Network daemon)
® autofs
® sshd (to keep others off, but only if you're feeling confident in your backup's stability)
■ xinetd
You can quickly get a listing of your services running in runlevel 4 with the following command:
# chkconfig --list | grep -e 4:on -e on$
This will show you everything running in runlevel 4 plus the services running under xinetd. These problem services can be configured to be off in runlevel 4 individually with the command syntax:
# chkconfig -level 4 syslog off
# chkconfig -level 4 sendmail off
# chkconfig -level 4 xinetd off
# chkconfig -level 4 mysqld off
Then runlevel 4 will be ready to be used as a backup runlevel that you toggle to just before backups, and back out of when they're complete.
Tip If you're not sure which services are which, or what each one in /etc/init.d/ actually does, then on Red Hat
Fedora systems you can simple run the command ntsysv from the command line and flip through all the service names, hitting FI for the ones that you would like a description of.
The command runlevel will tell you what runlevel you are currently in, and the init 4 command will put you in whatever runlevel you want to go to (runlevel 4 in this usage).
Previous << 1 .. 52 53 54 55 56 57 < 58 > 59 60 61 62 63 64 .. 272 >> Next