Create a backup server for multiple application systems in Linux

Source: Internet
Author: User
Use Linux to create a multi-application system backup server-Linux Enterprise Application-Linux server application information. The following is a detailed description. This article aims to establish a remote backup policy for a multi-system backup server by using the LinuxFTP server based on your actual work.

1. Create a LinuxFTP Server
Red Hat Enterprise Linux 5 Update1 is used. All Linux commands in the following instances are completed in this operating system. To enhance the security of data backup and the high availability and throughput of server network connections, the Raid technology can be used on servers to enhance data security and integrity, and the dual Nic binding technology can be used to improve the performance required for network connections. The specific implementation of Raid can be implemented by using Raid cards or software Raid provided by Linux based on your own hardware environment. The following is a specific instance for implementing software Raid in Linux.
1.1 The configuration process of creating a soft Raid in Linux uses Raids as an example. In Linux, three cheap IDE Hard Disks are used to build a Raid 5 device to ensure data security. The file names of the three IDE hard disks that constitute the RAID 5 device in Linux are:/dev/hdb (2nd IDE hard disks) And/dev/hdc (3rd IDE hard disks) /dev/hdd (4th IDE hard disks ). (1) Use the root user to execute the command # fdisk/dev/hdb to create a new disk partition and format 2nd IDE hard disks.

In Command (m for help): Enter n at the prompt to create a new disk partition.

In Command action
E extended
P primary partition (1-4): Enter p to create the primary partition.
In Partition number (1-4): Enter 1 as the Partition number.
In First cylinder (1-522, default 1): Press enter to specify the start cylinder (note: the number of the ending cylinder in the brackets depends on the specific hard disk model ).

In Last cylinder or + size or + sizeM or + sizeK (1-522, default 522), press enter to specify the tail cylinder. Run Command (m for help): Enter p at the prompt to view the partition status. If/dev/sdb1 is displayed, the partition is successful.

In Command (m for help): Enter t at the prompt to convert the partition type.
In Hex code (type L list codes): Enter L to display the list of partition codes.
In Hex code (type L list codes): Enter fd, that is, LinuxRaid partition encoding.
In Command (m for help): Enter w at the prompt to save and exit.

Repeat the preceding steps to create a Linux-Raid partition on the remaining two hard disks. After that, you need to restart the Linux host to make the settings take effect.

(2) create a Raid device
Run the command # mdadm-Cv/dev/md0-l5-n3-c128/dev/hd [B, c, d] 1 to specify the following parameters: "-C": Create a new array; "/dev/md0": indicates the name of the array device; "-l5" indicates setting the array mode, you can select 0, 1, 4, 5, and 6, which correspond to Raid0, Raid1, Raid4, Raid5, and Raid6, respectively. Here the mode is set to Raid5; "-n3" indicates the number of active devices in the array. The number of active devices plus the number of standby devices should be equal to the total number of devices in the array. "-c128" indicates the number of active devices in the array.

The size is 128 kb. The default value is 64 kb. "/dev/hd [B, c, d,] 1" indicates all device identifiers contained in the current array. It can also be written separately, separate them with spaces. When creating a new array or restructuring the array, the device must perform synchronization. This process takes some time. You can view the/proc/mdstat file to display the current status of the array

And synchronization progress, time required, and other information.
# More/proc/mdstat
Personalities: [raid5]
Md0: active raid5 hdd1 [2] hdc1 [1] hdb1 [0]
75469842 blocks level 5,128 k chunk, algorithm 2
[1, 3/2] [UU _]
[> ................] Recovery = 4.3% (1622601/
37734912) finish = 1.0 min speed = 15146 K/sec
Unused devices:

After the creation or reconstruction is complete, view the/proc/mdstat file again:
# More/proc/mdstat
Personalities: [raid5]
Md0: active raid5 hdd1 [2] hdc1 [1] hdb1 [0]
75469842 blocks level 5,128 k chunk, algorithm 2 [3/
3] [UUU]
Unused devices:

The status of the current array is clearly displayed. The meaning of each part is as follows: The 3/3 bits in "[1st]" indicate the number of devices contained in the array, the 2nd-digit number indicates the number of active devices. If one device is damaged, the 2nd-digit number is reduced by 1. "[UUU]" indicates the devices that can be normally used by the current array, if/dev/hdb1 fails, the mark will be changed to [_ UU]. Then the array runs in degraded mode, that is, the array is still available, but there is no redundancy; "sdd1 [2]" indicates that the number of devices contained in the array is n. If the value in square brackets is less than n, it indicates that the device is active. If the value is greater than or equal to n, the device is a backup device. When a device fails, the square brackets of the corresponding device are marked as (F ).

3) configure the Raid device
Next, generate a configuration file for mdadm. The default configuration file for mdadm is/etc/mdadm. conf, which is set to facilitate routine management of arrays. To reduce unnecessary troubles in future management, we should stick to this step.

In the mdadm. the conf file must contain two types of rows: one is the row starting with DEVICE, which indicates the list of devices in the ARRAY; the other is the row starting with ARRAY, it details the name, mode, number of active devices in the array, and UUID of the device.

(4) generate a File System
Create a file system and mount it. Raid5 is started and running. Now you have to create a file system on it and run the mkfs command. The file system type is ext3. The command is as follows:

# Mkfs-t ext3/dev/md0 // format the Raid5 device in the ext3 File System
After the new file system is generated, you can mount/dev/md0 to the specified directory. The command is as follows:
# Mount/dev/md0/ftp // mount/dev/md0 to/ftp directory
To enable the system to automatically mount/dev/md0 to/ftp at startup, you also need to modify the/etc/fstab file and add the following content:
/Dev/md0/ftp ext3 defaults 0 0
After the system is restarted, The RAID 5 device/dev/md0 will be automatically mounted to the/ftp directory, our operations on the directory/ftp are actually performed on the Raid5 device/dev/md0.

After completing the configuration process of creating software Raid in Linux, you can use the vsftpd server provided by Linux to create an FTP server user with different functional permissions, create a directory structure for the backup system in the/ftp directory to implement all the functions that the backup server should possess.

1.2 setting of FTP server and backup directory structure
Set three different user permissions: upload user, used to upload data; download user, used to download data; admin user, as administrator. To effectively protect system security, these users are not allowed to log on to the system, and cannot access the system folder in their root directory when they are locked for FTP connection. The command to create an FTP user is as follows:

(1) vi logins.txt
1> upload
2> upload (Note: The "upload" in this line is the "upload" user's password)
3> download
4> download
5> admin
6> admin
This text file is in the format of singular behavior username and even behavior password.
(2) db_load-T-t hash-f logins.txt/etc/vsftpd_log-
In. db
(3) chmod 600/etc/vsftpd_login.db
(4) useradd-d/ftp virtual; chmod 700/ftp
(5) modify the FTP configuration file:
Insert the following configuration statement in the/etc/vsftpd. conf file
Anonymous_enable = NO (anonymous users are prohibited)
Guest_enable = YES (enable virtual user)
Write_enable = NO
Anon_upload_enable = NO
Anon_mkdir_write_enable = NO
Anon_other_write_enable = NO
Chroot_local_user = YES
Guest_username = virtual (ing virtual users to local virtual users)
Pam_service_name = vsftpd. pam (specify the PAM Configuration File as vsftpd under/etc/pam. d)
User_config_dir =/etc/vsftpd_user_conf (specify the storage path for different virtual user configuration files)
Save and exit
(6) cp/usr/share/doc/vsftpd-2.0.1/EXAMPLE/
VIRTUAL_USRES/vsftpd. pam/etc/pam. d/
(7) mkdir/etc/vsftpd_user_conf
(8) grant different permissions to different users
Echo "anon_world_readable_only = NO">/etc/
Vsftpd_user_conf/download)
Cp/etc/vsftpd_user_conf/download/etc/
Vsftpd_user_conf/upload
Vi/etc/vsftpd_user_conf/upload, add the following lines
Write_enable = YES (add write permission)
Anon_upload_enable = YES (Added upload permission)
Anon_world_readable_only = YES (do not list files and directories)
Anno_other_write_enable = YES (adds the permission to delete/rename a user)
Cp/etc/vsftpd_user_conf/upload/etc/vsftpd_user_conf/admin
Modify a row:
Anon_world_readable_only = NO

By restarting the vsftpd server, you can use the three features created above to implement different functions. Create a tree structure of the backup system directory in the/ftp directory. In the/ftp directory, the station telegraph code will be used as the first-level directory for data backup of each station, and the backup directories of relevant systems will be created in sequence under the first-level directory, in this way, the data in the room will be backed up remotely to the relevant Backup directory on the vsftpd server, with the directory structure.

2. Backup policies for deploying various application systems

This article uses the FTP server provided by Linux and the soft Raid technology provided by Linux to deploy remote disaster data backup applications and remote backup of real-time data of the first-line application system, this effectively ensures the effective recovery of real-time data after the production system computer crashes completely.

Author: Li chengguang

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.