Rsync full network backup
===========Operation and maintenance Road
-The environment is as follows
# Server IP: 10.0.0.100
# Client IP: 10.0.0.101
[root@Centos ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@Centos ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@Centos ~]# getenforce
Disabled
Rsync server deployment
- Check whether the software is installed
[root@Centos ~]# rpm -qa|grep rsync
rsync-3.1.2-4.el7.x86_64
- Write service profile
[root@Centos ~]# vi /etc/rsyncd.conf
#rsync_config
##rsyncd.conf start##
uid = rsync
gid = rsync
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 10.0.0.101
hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password
[backup]
path = /backup
- Add process management user
[root@Centos ~]# useradd rsync -s /sbin/nologin -M
- Create the directory required by the program
# Create data backup directory
[root@Centos ~]# mkdir -p /backup
# Authorized data backup directory
[root@Centos ~]# chown -R rsync.rsync /backup/
[root@Centos ~]# ll -d /backup/
drwxr-xr-x 2 rsync rsync 6 Sep 11 18:21 /backup/
- Conduct safety related configuration
# Create document authentication information
[root@Centos ~]# echo "rsync_backup:123456" >/etc/rsync.password
# Authority to modify authentication file
[root@Centos ~]# chmod 600 /etc/rsync.password
[root@Centos ~]# ll -d /etc/rsync.password
-rw------- 1 root root 20 Sep 11 18:26 /etc/rsync.password
- Run program service process
# Start the rsync program Daemons
[root@Centos ~]# rsync --daemon
# Stop the rsync program Daemons
[root@Centos ~]# killall rsync
- Check whether the service is started
[root@Centos ~]# ps -ef|grep rsync
root 16632 1 0 18:55 ? 00:00:00 rsync --daemon
root 16634 1176 0 18:56 pts/0 00:00:00 grep --color=auto rsync
[root@Centos ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 16632/rsync
Rsync Client Deployment
- Check whether the software is installed
[root@Centos ~]# rpm -qa|grep rsync
rsync-3.1.2-4.el7.x86_64
- Conduct safety related configuration
# Create document authentication information
[root@Centos ~]# echo "123456" >/etc/rsync.password
# Authority to modify authentication file
[root@Centos ~]# chmod 600 /etc/rsync.password
[root@Centos ~]# ll -d /etc/rsync.password
-rw------- 1 root root 20 Sep 11 18:26 /etc/rsync.password
- Set up service application
# Confirm backup data transfer
[root@Centos ~]# rsync -avzP /etc/hosts rsync_backup@10.0.0.100::backup
# Confirm the backup data transmission and use the keyless transmission
[root@Centos ~]# rsync -avzP /etc/hosts rsync_backup@10.0.0.100::backup --password-file=/etc/rsync.password