Automatic Backup of specific deployment of rsync in centos

Source: Internet
Author: User

There are many servers and databases in our production system, and daily backup is especially important. However, it is often the easiest way to ignore a disaster-free backup. However, when a disaster occurs, backup is the most direct and useful solution, although some data losses are inevitable.

Rsync is a secure backup software with simple configuration and comprehensive functions. For more information, see the manual. Here we will share with you the deployment of rsync in centos.

1. Install rsync and manage rsync through xinetd

Yum install rsync xinetd-y


2. Modify the/etc/xinetd. d/rsync file to start with xinetd.

Vim/etc/xinetd. d/rsync
... Change disable = yes to disable = no

Disable = no

3. Modify the firewall policy to allow port 873 (tcp/udp)

# Directly modify/etc/sysconfig/iptables and restart the firewall.

-A RH-Firewall-1-INPUT-p tcp-m state -- state NEW-m tcp -- dport 873-j ACCEPT

-A RH-Firewall-1-INPUT-p udp-m state -- state NEW-m udp -- dport 873-j ACCEPT

/Etc/init. d/iptables restart

# Or use the iptables command

Iptables-a input-p tcp-m state -- state NEW-m tcp -- dport 873-j ACCEPT

Iptables-a input-p udp-m state -- state NEW-m udp -- dport 873-j ACCEPT

4. Create a configuration file for rsync

# If vim/etc/rsyncd. conf does not have this file, create it directly.

......

Secretsfile =/etc/rsyncd. secrets specify the allowed user and User Password

Motdfile =/etc/rsyncd. storage file of the welcome information displayed when the motd client is connected

Readonly = no read-only or not

List = yes whether the client can list files on the backup server

Uid = root specify uid

Gid = Specify gid

Hosts allow = 192.168.1.100 192.168.1.200 allows you to use the list of backup server clients, which are listed according to the actual environment.

Maxconnections = 100 Max connections at the same time

Logfile =/var/log/rsyncd. log file location

Pidfile =/var/run/rsyncd. pid: the location where the pid of the pid process is stored.

Lockfile =/var/run/rsync. lock file location

#### The configuration above is global, and the following sections inherit the attributes set above ####

[Mongobak] creates a backup name through which the client specifies a specific backup location

Path =/mongobak specifies the directory where the backup file is stored

Authusers = test allows those users. The user test information is stored in/etc/rsyncd. secrets.

This is a simple and practical configuration.

5. Create the/etc/rsyncd. secrets file.

# Vim/etc/rsyncd. secrets


......

Test: rsync-7-elevEn format User name: Password this user is not a system user

Set the rsyncd. secrets File Permission to 600.
.....
# Chmod 600/etc/rsyncd. secrets

6. Create the welcome information file/etc/rsyncd. motd displayed on the Client Connected to the server.

# Vim/etc/rsyncd. motd

......

Welcome to Window Server 2003 IIS
......

# Enter the information here based on the actual situation

7. Start rsync

# Start


/Etc/init. d/xinetd restart

# Check whether port 873 is enabled

Netstat-an | grep 873

If rsync is successfully started, you can see that port 873 is already listening.

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.