& Nbsp; I am the administrator of a small and medium-sized Linux website. The system architecture is RHEL4.0 + PHP4.3 + Mysql4.03 + Apache1.23. The average daily IP access volume is 200, a typical small Linux website. Because it is a small website, there is no cost to use a tape drive for system backup, using a DVD disc recorder + network hard disk. With the increasing application of Linux, especially in terms of network applications, there are a large number of network services. I am the administrator of a small and medium-sized Linux website. The system architecture is as follows: RHEL 4.0 + PHP 4.3 + Mysql 4.03 + Apache 1.23. The average daily IP access volume is 200, a typical small Linux website. Because it is a small website, there is no cost to use a tape drive for system backup, using a DVD disc recorder + network hard disk. As Linux is widely used, especially in network applications, a large number of network servers use Linux operating systems. Because there are still some differences between Linux desktop applications and Windows, in enterprise applications, Linux and Windows operating systems often coexist to form a heterogeneous network. Most servers use Linux and Unix, while Windows 9X/2000/XP is used on PC.
I. local backup
Using mysqldump for backup is very simple. if you want to back up the database "phpbb_db_backup", run the command: # mysqldump-u-p phpbb_db_backup>/usr/backups/mysql/phpbb_db_backup.2005.6
You can also use the gzip command to compress the backup file:
# Mysqldump phpbb_db_backup | gzip>/usr/backups/mysql/phpbb_db_backup.2005.5.6. Gz
Run the following command to restore data:
# Mysql-u-p phpbb_db_backup
II. back up data to a DVD disk
With the increase of MYSQL data volume, the use of traditional CD-R to back up the hard disk is not realistic, using CD-RW volume production is too much trouble, tape drive for small and medium enterprises and too expensive. In addition, the complexity of each application is increasing daily and dramatically, and the amount of data processed is also quite large. Linux users often encounter the problem of: is there any way to back up and store data economically and quickly. As the prices of the DVD recorder and disc quickly decrease, it is wise to use the DVD recorder to back up the Linux operating system.
1. Installation
The following describes how to use a DVD recorder in a Linux environment by taking the built-in burning device of the IDE interface as an example. In Linux, you need to virtualize the burning device of the IDE interface to a SCSI device to burn a DVD. Linux versions later than 2.4 contain SCSI simulation compiled into the kernel, so you only need to make some minor changes to the startup file; USB or 1394 (FireWire) the external recorder of the interface is much simpler.
Connect the DVD recorder device to the second IDE interface (dev/hdc) of the computer and turn on the power. Assume that the system starts with Grub and opens/boot/grub in a text editor. conf, locate the line starting with "kernel" and add "hdc = ide-scsi" to the end of the line, for example: "kernel/vmlinuz-2.4.20-8 ro root = LABEL =/hdc = ide-scsi ".
2. install the recording software
DVD + RW-Tools: a software toolkit containing a DVD and an image, including Growisofs and dvd + rw-format. Official site: linux/DVD + RW/"> http://fy.chalmers.se /~ Appro/linux/DVD + RW/, CDRDAO: DAO is Disk-At-Once (real-time burning ), it is a two-second buffering method without audio tracks during the burning process. It can completely control the disk layout and track. This function is quite helpful in burning multiple source disks.
Cdrtools: includes a set of tools for CD and DVD burning. Growisofs uses the mkisofs tool in this package when creating an image. you can use readcd to create an ISO image from an existing DVD. In addition, the Cdrecord application can be used to scan the CD/DVD recorder on the connection system and use it to burn an ISO image to a CD-R (W) disc. Usually most Linux versions include this software, you can also download the use: http://freshmeat.net/redir/cdrecord/35795/url_homepage/cdrecord.html dvdrecord: command line under the DVD recorder software. The DVD burning in the command line can be used in many cases. for example, when we remotely access the host, the GUI on the machine cannot be started, or the machine cannot start the GUI for some reason. In addition, you also need to use the command line tool to complete automatic backup and other repeated functions.
The above describes the necessary software and related download URLs. the installation process is relatively simple and will not be repeated here.
3. command line burning
Use a DVD + RW-Tools to burn data
Growisofs is a DVD + RW-Tools tool. Growlsofs uses different methods to access its burning devices. It uses the Unix path under/dev to connect to the recorder. Different systems and releases use different paths for the recorder, so the best way is to view the help in the release. In some systems, a soft link named/dev/dvd is set to point to an available DVD recorder. in this article, use/dev/dvd to specify the recorder, if the path settings in the system are different, replace them with the appropriate path.
(1) format a DVD disc that can be read and written
You can use the DVD 10 RW-format command provided in the dvd + rw-Tools toolkit. There are two ways to format a DVD: quick mode and full mode. Quick mode:
# Dvd + rw-format-blank/dev/dvd
Full mode:
# Dvd + rw-format-blank = full/dev/dvd
(2) store files on a DVD dial:
Similar to a general CD, a DVD uses an ISO file system and the same general extensions (Joliet and RockRidge ). Growlsofs provides a simple method to store files or directories to a DVD dial. Use the mkisofs tool to create an image without burning the image before it is stored on the hard disk. The basic command format is as follows:
# Growisofs-dvd-compat-Z/dev/dvd-J-R/path/to/home/cao
This command is used to create an image and burn the file in the/path/to/home/cao directory to a DVD.
III. Network Backup
It is insecure to store MYSQL data on one computer. Therefore, you should back up the data to other computers in the LAN. Assume that the IP address of the Mysql server is 192.168.1.3. The IP address of the remote computer in Linux is 192.168.1.17, and the IP address of the remote computer in Windows is 192.168.1.18. For more information about the network topology, see.
1. NFS network backup is similar to windows network sharing. The UNIX (Linux) system also has its own network sharing, that is, NFS (Network File System), which is mounted on the linux client) before NFS disk sharing, you must configure the NFS server. In linux, the NFS server is configured as follows: (1) modify/etc/exports and add the shared directory/export/home/sunky 192.168.1.17 (rw)
/Export/home/sunky1 * (rw)
/Export/home/sunky2 linux-client (rw)
Note: sunky, sunky1, and sunky2 under the/export/home/directory are the shared directories, 10.140.133.23, *, and linux-client are IP addresses or host names allowed to connect to the shared linux client. If you want to use the host name linux-client, you must add the linux-client host ip definition in the server host/etc/hosts file. The format is as follows: 192.168.1.17 linux-client if a new share is added to the/etc/export file, stop the NFS service and then start the NFS service to make the new share take effect. The command exportfs-rv can also achieve the same effect. Mount the NFS share of other linux or UNIX systems on the linux client. Here we suppose 192.168.1.17 is the ip address of the NFS server host. of course, the host name can also be used here, but the server ip definition must be added to the local/etc/hosts file. /Export/home/sunky is the directory shared by the server. In this way, you can use/mnt/nfs on the linux client to access files shared by NFS on other linux or UNIX systems.
To back up MYSQL data to a remote computer using Linux, you must install the Network File System on both ends. after installing the NFS protocol on the remote NFS computer, you must modify the configuration File:/etc/exports, add/usr/backups/mysql/192.168.1.17 (rw, no_root_squash) to share the/usr/backups/mysql/directory. This directory has the read and write permissions of the remote root user. Save the NFS configuration file and run the following command:
# Exportfs-a-r
Then restart the NFS service:
# Service nfsd start
After the remote computer is set, create a backup_share directory under the MYSQL server/mnt Directory:
# Mkdir/mnt/backup_share
Mount the/usr/backups/mysql/directory of the remote Linux computer to the/mnt/backup_share Directory of the MYSQL server:
# Mount-t nfs 192.168.1.17:/usr/backups/mysql/mnt/backup_share after mounting the directory, as long as you enter the/mnt/backup_share directory, it is equal to the IP address: 192.168.1.7 is in the/usr/backups/mysql Directory of the NFS computer. The following uses mysqldump to back up "phpbb_db_backup" to a remote computer: # mysqldump phpbb_db_backup>/mnt/backup_share/phpbb_db_backup.2009-5-6 2. the core of Windows network sharing backup through Samba is SMB/CIFS. to mount windows Disk sharing in linux, you must install and use the samba software package. Currently, most popular linux distributions already contain samba packages. if samba is not installed on linux, install samba first. You can also download the samba package at www.samba.org. The latest version is 3.0.10. Create a directory (/arc) on a Windows computer and share it with you to grant it read and write permissions. Create a backup_share1 directory under the MYSQL server/mnt directory and mount it: # mount-t smbfs-o username = cstrap, password = XXXX/192.168.1.18/arc/mnt/backup_share
Run the following command to back up the data:
# Mysqldump phpbb_db_backup>/mnt/backup_share/phpbb_db_backup.2009-5-6