Operation and maintenance Backup Service

 

To learn to understand roughly architecture

1) complete the rsync daemon mode to build
2) rsync backup data transmission principle
3) rsync commands commonly used parameters
4) enterprise applications rsync skills
5) rsync common errors
6) enterprise project: the whole network backup program (script)

review of previously learned :
part 1) integrated architecture
Front: firewall load balancing web server
backend: database storage service cache service backup service
expansion: batch management springboard machine monitoring service vpn service
2 integrated architecture planning)
IP address planning
hostname planning
optimization system part
3) Hosting cloning part
a template organ machine cloning - a linked clone
b clone host needs a good one is in order to configure
mac address 1. Do not adjust freely modify virtual host
2. NetworkManager network management services technical manager nmtui closed
network operation and maintenance director of network services-eth0 the ifcfg
4) backup service
rsync software: software full volume and incremental backups
5) rsync command to use 1V4
6) rsync command syntax man rsync
local backup
remote backup
daemons way back up

 

rsync daemon server-side deployment --------

First course: download and install software

rpm -qa|grep rsync
yum install -y rsync

Second course: write configuration file

rsyncd.conf man
vim /etc/rsyncd.conf
## the Created by AT HQ 2017
### Start rsyncd.conf ##

users uid = rsync --- designated to manage backup directory
gid = rsync --- specify the backup directory management user group
port = 873 --- defined rsync backup service network port number of the
fake super = yes --- rsync virtual users will pretend to be a super user
use chroot = no --- and security-related configuration
max connections = 200 --- the maximum number of simultaneous connections can only have 200 clients to connect to the backup server
timeout = 300 --- timeout (in seconds)
pid = /var/run/rsyncd.pid --- File information recording process number 1. 2. the program to quickly stop the process to determine whether a service is running
lock file = /var/run/rsync.lock --- lock file
log file = /var/log/rsyncd.log --- rsync log files for service troubleshooting analyze problems
ignore simple errors in transmission errors --- ignore the
read only = false --- specify a backup directory is readable and writable
list = false --- so that the client can see the side of the module information service
hosts allow = 172.16.1.0/24 --- allows the host to transfer backup data (white list)
the hosts the deny = 0.0.0.0/32 --- host backup data transmission is prohibited (blacklist)
the auth = rsync_backup Users specify --- user authentication
secrets file = /etc/rsync.password --- Specifies the user password file authentication user name: password information
[backup] --- module information
the Comment = "Backup dir by Oldboy"
path = / Backup configuration module --- parameter specifies the backup directory

Third course: create virtual user rsync services

useradd rsync -M -s /sbin/nologin

The fourth course; create a backup service authentication password file

echo "rsync_backup:oldboy123" >/etc/rsync.password
chmod 600 /etc/rsync.password

Fifth course: create a backup directory and modify the owner is a group of information

mkdir /backup
chown rsync.rsync /backup/

Sixth course: Start the backup service
systemctl Start rsyncd
systemctl enable rsyncd
systemctl Status rsyncd

Daemon operating principle

 

 Daemon exception:

 

 

rsync daemon -------- client deployment process

First course: create a secret file
echo "oldboy123"> /etc/rsync.password
chmod 600 /etc/rsync.password

second course: be free interactive data transmission test
rsync -avz / etc / hosts [email protected]. 1.41 :: backup --password-file = / etc / rsync.password

 

rsync command parameters detailed description
-v, --verbose display detailed information transmitted
-a, archiving parameters --archive command comprising: rtopgDl
-R & lt, --recursive recursive parameter
-t, --times the file attribute information holding time information is not change (modification time)
-o, --owner keep the file owner information unchanged
-g, --group keep the file belongs to the same group information
PS: how to make -o and -g parameters to take effect, the configuration file uid and gid changed to root, fake super parameters need to annotate
-p, --perms to keep file permissions information unchanged
-D, remain unchanged device file information
-l, --links remain linked file attributes unchanged
-L, remain linked files data unchanged
-P, data transmission progress information display
--exclude = PATTERN exclude the specified data can not be transmitted
--exclude-from = file exclude specified data is not transmitted (bulk excluded)
--bwlimit display the rATE = rate of transmission 100Mb / 8 = 12.5MB
business case: the road (Bandwidth - half) Renren place
--delete no difference in synchronization parameter (caution)
I also have some of you, I do not have you can not have

Daemon service enterprise application:
A daemon multi-module configuration function.
SA sa_data.txt
dev dev_data.txt
dba dba_data.txt


[backup]
comment = "backup dir by oldboy"
path = /backup
[dba]
comment = "backup dir by oldboy"
path = /dba
[dev]
comment = "backup dir by oldboy"
path = /devdata

 

. b exclusions practice daemon
prepare the environment:
[root @ nfs01 /] # mkdir -p / Oldboy
[root @ nfs01 /] # mkdir -p /oldboy/{a..c}
[root @ nfs01 /] # Touch /oldboy/{a..c}/{1..3}.txt
[@ nfs01 the root /] Tree # / Oldboy
/ Oldboy
├── 01.txt
├── 02.txt
├── A
│ ├ ?? 1.txt - the
│ ?? ├── 2.txt
│ ?? └── 3.txt
├── B
│ ?? ├── 1.txt
│ ?? ├── 2.txt
│ └─ ?? 3.txt ─
└── c
├── 1.txt
├── 2.txt
└── 3.txt

Demand 01: A / oldboy directory a full backup catalog data directory b c Do not back up files 1.txt do not do an entire directory backup
--exclude = PATTERN
absolute path way:
[root @ nfs01 /] # rsync -avz / oldboy - = the exclude / Oldboy / B / 1.txt --exclude = / Oldboy / C / [email protected] --password-Backup File :: = / etc / rsync.password
sending the incremental File List
Oldboy /
Oldboy / 01.txt
Oldboy / 02.txt
Oldboy / A /
Oldboy / A / 1.txt
Oldboy / A / 2.txt
Oldboy / A / 3.txt
Oldboy / B /
Oldboy / B / 2.txt
Oldboy / B / 3.txt

relative path mode:
[@ nfs01 the root /] # -avz the rsync / Oldboy --exclude = B / C = 1.txt --exclude / [email protected] --password-Backup File :: = / etc / rsync.password
sending File List with the incremental
Oldboy /
Oldboy / 01.txt
oldboy/02.txt
oldboy/a/
oldboy/a/1.txt
oldboy/a/2.txt
oldboy/a/3.txt
oldboy/b/
oldboy/b/2.txt
oldboy/b/3.txt

sent 502 bytes received 177 bytes 1,358.00 bytes/sec
total size is 0 speedup is 0.00

Demand 02: A / oldboy directory a full backup catalog data directory b c Do not back up an entire directory file 1.txt 1.txt 3.txt Do not back up files
--exclude-from = file --- batch exclusion

The first course: a good editor to exclude file
[root @ nfs01 /] # CAT /oldboy/exclude.txt
b / 1.txt
c / 1.txt
c / 3.txt
exclude.txt

Second course: to achieve volume exclusion
[root @ nfs01 /] # rsync -avz / oldboy --exclude-from = / oldboy / exclude.txt [email protected] :: backup --password-file = / etc / rsync.password
sending the incremental File List
Oldboy /
Oldboy / 01.txt
Oldboy / 02.txt
Oldboy / A /
Oldboy / A / 1.txt
Oldboy / A / 2.txt
Oldboy / A / 3.txt
Oldboy / B /
Oldboy / B / 2.txt
Oldboy / B / 3.txt
Oldboy / C /
Oldboy / C / 2.txt

c. daemon to create a backup directory
[root @ nfs01 /] # rsync -avz / etc / hosts [email protected] :: Backup / 10.0.0.31 / --password-File = / etc / rsync.password
sending with the incremental File list
the created directory 10.0.0.31
hosts

Sent Received 226 bytes 75 bytes 602.00 bytes / sec
Total size iS iS 371 Speedup 1.23
PS: clients can not create multi-level directory on the server

d daemon access control configuration.
daemon black and white list list of features
PS: recommend the use of only one list of

e list of features daemon configuration.
[root @ nfs01 /] # rsync [email protected] ::
Backup "Backup dir by Oldboy"
dba "Backup dir by Oldboy"
dev "Backup dir by oldboy "

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/dongxu2019/p/11939269.html