期中架构介绍 scp Rsync远程同步 本地方式 远程方式 守护进程方式

期中架构

名词介绍

1.项目:针对游戏公司,每一个游戏就是一个项目
2.架构:维护一个项目的所有组件组成的一个整体
3.集群:多台服务器组成的一个集合,实现同样的工作,当一台服务器出现问题,其他服务器可以正常提供服务
4.负载均衡:将前端的用户请求,平均的分配到后端服务器
5.高可用:当一台服务器不可用时,另一台服务器自动接管工作,保证业务的可用性


 lnmp:linux nginx mysql php
 lamp:linux Apache MySQL php
 lnmt:linux nginx MySQL Tomcat
 lamt:linux Apache MySQL Tomcat

在这里插入图片描述

架构中的服务

在这里插入图片描述
在这里插入图片描述

架构访问流程

1.用户访问流程
1.用户在浏览器输入域名
2.浏览器拿着域名取DNS解析
3.DNS服务器将解析后的IP返回给浏览器
4.浏览器根据IP去访问真实服务器
5.访问真实服务器的防火墙
6.防火墙将请求通过内网交换机传给负载均衡
7.负载均衡将请求平均的分配给后端的web服务器
8.web服务器去判断是静态还是动态请求
9.如果是静态请求,web服务器会去文件服务器获取数据
10.如果是动态请求,web服务器会通过程序去数据库或者缓存获取数据
11.数据从数据库或者NFS服务器返回给web服务器,web服务器将数据返回给负载均衡,负载均衡通过防火墙将数据传给浏览器
2.运维访问流程
1.管理人员连接跳板机或者VPN
2.通过跳板机或者vIN连接内网服务器
3.通过zabbix监控查看服务器状态
4.如果有问题则连接相应的机器解决问题
5.日常巡检,查看服务器配置
6.管理备份和备份数据
7.日志收集和整理展示

系统优化准备机器

[root@localhost ~]# cat >> /etc/hosts <<EOF
192.168.15.5  172.16.1.5 lb01
192.168.15.6  172.16.1.6 lb02
192.168.15.7  172.16.1.7 web01
192.168.15.8  172.16.1.8 web02
192.168.15.9  172.16.1.9 web03
192.168.15.31 172.16.1.31 nfs
192.168.15.41 172.16.1.41 backup
192.168.15.51 172.16.1.51 db01
192.168.15.61 172.16.1.61 m01
192.168.15.71 172.16.1.71 zabbix  prometheus
EOF


[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1775    0  1775    0     0   5637      0 --:--:-- --:--:-- --:--:--  5652

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
[root@localhost yum.repos.d]# yum makecache

# 创建自动化修改IP、主机名脚本
[root@template opt]# cat changeIp 
#!/bin/bash
sed -i "s#.100#.$1#g" /etc/sysconfig/network-scripts/ifcfg-eth[01]
hostnamectl set-hostname $2
systemctl restart network
----------------------------------------------------------------------------------
#!/bin/bash
sed -i "s/\.123/\.$1/g" /etc/sysconfig/network-scripts/ifcfg-eth[01]
hostnamectl set-hostname $2
systemctl restart network

执行脚本
cd /opt
./changeIp 100 template


# 安装基础软件包
[root@template opt]# yum install net-tools vim tree htop iftop \
iotop lrzsz sl wget unzip telnet nmap nc psmisc \
dos2unix bash-completion bash-completion-extra sysstat \
rsync nfs-utils httpd-tools -y


# 3.关闭防⽕墙firewalld
[root@template opt]# systemctl disable --now firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

# 关闭Selinux
[root@template opt]# sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config

# 5.调整单个进程最⼤能打开⽂件的数量
[root@template opt]# echo '* - nofile 65535' >> /etc/security/limits.conf

备份

#运维人员的三大职责
1、7*24*7不间断服务
2、数据的安全,主要是备份
3、提升用户体验,即系统优化

#什么是备份?
备份就是把重要的数据或文件再次复制一份保存起来(给源文件增加一个副本)

#为什么要备份?
数据很重要!!!
出现故障之后,需要恢复数据(软件服务出现问题几率很小,80%都是人为故障)

备份思想:全量 差异 增量

全量

备份数据:
	每次都把原数据完整copy一份

恢复数据:
	只需要找到对应时间点的那一份备份数据覆盖回来就即可

差异

备份数据:
	每次备份都是用当前数据跟第一次全量备份比较,找出差异,然后备份
	
恢复数据:
	第一次的全量备份+对应时间节点的那一个差异备份即可

增量

备份数据:
	每次备份都是用当前数据跟上一次的数据进行比较,找出差异,然后备份
	
	
恢复数据:
	全量备份+增量1+增量2+增量3..

备份位置

本地备份

异地备份:备份应该备份在异地   当本地机器蹦了,异地拿来恢复

三种备份的对比

备份数据的过程,从占用资源的角度对比 : 全量备份占用的资源 > 差异备份占用的资源 > 增量备份占用的资源

恢复数据的过程,从恢复效率的角度对比 : 全量备份恢复数据的效率 > 差异备份恢复数据的效率 > 增量备份恢复是数据的效率

scp

基于ssh验证

scp -r 源路径 目标路径

上传/推
scp -r /aaa/* root@192.168.15.41:/bbb
下载/拉
scp -r root@192.168.15.41:/bbb/* /aaa

传输模式

推:
客户端将需要的数据上传到服务端
拉:
客户端讲需要的数据下载下来



1、本地方式(类似于cp,不支持推送和拉取,只是单纯的复制)
2、远程方式(类似于scp,又不同于scp)
3、守护进程方式(客户端和服务端)

本地方式

#语法
rsync [参数] 源文件(可多个) 目标地址 本地路径

#类似于cp,但是cp是全量复制并且会修改文件属性,rsync是增量复制,会保证文件属性不变

远程方式

#拉取
rsync [参数] 源文件(可多个)  目标地址 本地路径

#实例
[root@web1 ~]# rsync -avz root@192.168.15.100:/tmp/ ./

#推送
rsync [参数] 要推送的文件  远程主机路径

#实例
rsync -avz ./back/ root@192.168.15.102:/root/

Rsync远程同步

rsync简称远程同步,可以实现不同主机之间的同步(本地和远程). 同时支持增量和全量的备份.

不同主机: windows --> linux  linux --> linux  mac --> linux  mac --> windows
rsync监听的端口:873
rsync运行模式:C/S模式   client/server

Rsync 既能本地拷贝也能远程传输

rsync -av 源路径 目标路径

mkdir /src
mkdir /dst

echo 111 > /src/1.txt
echo 222 > /src/2.txt

# rsync -a /src /dst  # 代表把源文件夹拷贝到/dst下
rsync -a /src/ /dst   # 代表把源文件夹下的子文件全拷贝过去/dst
stat /dst/*

rsync -a /src/ /dst 
stat /dst/*  # 时间不变

echo 666 >> /src/1.txt
rsync -a /src/ /dst 
stat /dst/*

选项

rsync命令有上百个选项,主要分为两大类 :
一类是检测  增加数据校验的可靠性
一类是传输  算法计算拼接出新的完整数据,覆盖到原文件
-a           #归档模式传输  表示以递归方式传输文件,并保持所有文件属性  
-z           #传输时进行压缩以提高效率
-v           #详细模式输出
-n           #执行一个没有实际更改的试运行,只会显示文件会被如何操作
-c           #让自动跳过基于校验和而非默认的修改时间以及文件大小
--delete     # 目标多出来的文件会删掉
--exclude    # 排除
--include    # 包含

rsync -a --include="*.txt" --exclude="*" /111/ /222/
-R           # 相对路径
--backup  #备份不会覆盖原文件 原文件后面会加上~  
--backup-dir# 备份不会覆盖原文件   原文件会存在mkdir/222/bak

--link-dest  #增量备份上一天的目录



参数解析

[root@backup ~]# mkdir /a/b/c/d/e -p
[root@backup ~]# mkdir /dst
[root@backup ~]# 
[root@backup ~]# echo 123 > /a/b/c/d/e/1.txt
[root@backup ~]# rsync -a /a/b/c/d/e/ /dst/
[root@backup ~]# ls /dst/
1.txt
[root@backup ~]# rm -rf /dst/*
[root@backup ~]# rsync -a /a/b/c/d/e /dst/
[root@backup ~]# ls /dst/
e
[root@backup ~]# ls /dst/e/
1.txt
[root@backup ~]

[root@backup ~]# ls /dst/e/
1.txt
[root@backup ~]# rsync -a -R /a/b/c/d/e /dst/
[root@backup ~]# ls /dst/
a  e
[root@backup ~]# rm -rf /dst/*

[root@backup ~]# rsync -a -R /a/b/c/./d/e /dst/
[root@backup ~]# ls /dst/
d
[root@backup ~]# mkdir /111
[root@backup ~]# mkdir /222
[root@backup ~]# 
[root@backup ~]# echo 11111 > /111/1.txt
[root@backup ~]# echo 22222 > /111/2.txt
[root@backup ~]# 
[root@backup ~]# echo 33333 > /111/3.txt
[root@backup ~]# 
[root@backup ~]# 
[root@backup ~]# echo 666 > /222/1.txt
[root@backup ~]# echo 999 > /222/2.txt
[root@backup ~]# 
[root@backup ~]# cat /222/1.txt
666
[root@backup ~]# cat /222/2.txt
999
[root@backup ~]# rsync -a --backup /111/ /222/
[root@backup ~]# ll /222/
total 20
-rw-r--r-- 1 root root 6 Apr 17 16:26 1.txt
-rw-r--r-- 1 root root 4 Apr 17 16:27 1.txt~
-rw-r--r-- 1 root root 6 Apr 17 16:27 2.txt
-rw-r--r-- 1 root root 4 Apr 17 16:27 2.txt~
-rw-r--r-- 1 root root 6 Apr 17 16:27 3.txt
[root@backup ~]# cat /222/1.txt~
666
[root@backup ~]# cat /222/2.txt~
999
[root@backup ~]# ls /111/
1.txt  2.txt  3.txt
[root@backup ~]# rm -rf /222/*
[root@backup ~]# echo 666 > /222/1.txt
[root@backup ~]# echo 999 > /222/2.txt
[root@backup ~]# 
[root@backup ~]# rsync -a --backup --suffix=".bak" /111/ /222/
[root@backup ~]# ls /222/
1.txt  1.txt.bak  2.txt  2.txt.bak  3.txt
[root@backup ~]# ls /111/
1.txt  2.txt  3.txt
[root@backup ~]# rm -rf /222/*
[root@backup ~]# echo 666 > /222/1.txt
[root@backup ~]# echo 999 > /222/2.txt
[root@backup ~]# 
[root@backup ~]# mkdir /222/bak
[root@backup ~]# 
[root@backup ~]# rsync -a --backup --backup-dir=/222/bak /111/ /222/
[root@backup ~]# ll /222/
total 12
-rw-r--r-- 1 root root  6 Apr 17 16:26 1.txt
-rw-r--r-- 1 root root  6 Apr 17 16:27 2.txt
-rw-r--r-- 1 root root  6 Apr 17 16:27 3.txt
drwxr-xr-x 2 root root 32 Apr 17 16:36 bak
[root@backup ~]# ll /222/bak/
total 8
-rw-r--r-- 1 root root 4 Apr 17 16:34 1.txt
-rw-r--r-- 1 root root 4 Apr 17 16:35 2.txt
[root@backup ~]# cat /222/bak/1.txt 
666
[root@backup ~]# 
[root@backup ~]# mkdir /222
[root@backup ~]# cd /111/
[root@backup 111]# touch {1..3}.txt 
[root@backup 111]# cd 
[root@backup ~]# echo 666 > /222/1.txt
[root@backup ~]# echo 999 > /222/2.txt
[root@backup ~]# 
[root@backup ~]# mkdir /222/bb
[root@backup ~]# ll /222/
total 8
-rw-r--r-- 1 root root 4 Apr 16 16:21 1.txt
-rw-r--r-- 1 root root 4 Apr 16 16:21 2.txt
drwxr-xr-x 2 root root 6 Apr 16 16:22 bb
[root@backup ~]# rsync -a --backup --backup-dir=/222/bb /111/ /222/
[root@backup ~]# ll /222/
total 0
-rw-r--r-- 1 root root  0 Apr 16 16:21 1.txt
-rw-r--r-- 1 root root  0 Apr 16 16:21 2.txt
-rw-r--r-- 1 root root  0 Apr 16 16:21 3.txt
drwxr-xr-x 2 root root 32 Apr 16 16:23 bb
[root@backup ~]# ll /222/bb/
total 8
-rw-r--r-- 1 root root 4 Apr 16 16:21 1.txt
-rw-r--r-- 1 root root 4 Apr 16 16:21 2.txt

root@backup ~]# 
[root@backup ~]# mkdir /data
[root@backup ~]# echo 111 > /data/1.txt 
[root@backup ~]# echo 222 > /data/2.txt 
[root@backup ~]# ls /data/*
/data/1.txt  /data/2.txt
[root@backup ~]# mkdir /bak
[root@backup ~]# ls /bak/
[root@backup ~]# rsync -a /data/ /bak/111
[root@backup ~]# echo 333 > /data/3.txt
[root@backup ~]# rsync -a --delete --link-dest /bak/111 /data/ /bak/222
[root@backup ~]# ls /bak/222/
1.txt  2.txt  3.txt
[root@backup ~]# 
[root@backup ~]# echo 2222 > /data/1.txt 
[root@backup ~]# rsync -a --delete --link-dest /bak/222 /data/ /bak/333
[root@backup ~]# ls /bak/333/
1.txt  2.txt  3.txt
[root@backup ~]# echo 111 > /data/1.txt 
[root@backup ~]# echo 222 > /data/2.txt 
[root@backup ~]# cat /data/1.txt 
111
[root@backup ~]# cat /data/2.txt 
222
[root@backup ~]# ls -i /data/*
102317903 /data/1.txt  102317904 /data/2.txt

[root@backup ~]# mkdir /bak/
[root@backup ~]# ls /bak/
[root@backup ~]# rsync -a --delete /data/ /bak/111
[root@backup ~]# cat /bak/111/1.txt 
111
[root@backup ~]# cat /bak/111/2.txt 
222
[root@backup ~]# ls -i /bak/*
33559004 1.txt  33562196 2.txt
[root@backup ~]# 

软硬连接

注:ls -i 查看inote号有没有改变
若是inote号改变 说明数据改变生成新文件 做硬链接产生新的inote号
若是inote号没改变 说明数据没改变 只需要做软连接指向上个文件 不占用inote号
在这里插入图片描述

ln 创建硬链接


```echo 111 > a.txt
ln a.txt b.txt 						创建一个硬连接b.txt
echo 222 >> a.txt			
cat b.txt
# 111
# 222

ls -i a.txt							查看a.txt的inode号
# 33575024 a.txt
ls -i b.txt							查看b.txt的inode号
# 33575024 b.txt

rm -rf a.txt				
ls 
# b.txt

ln -s 创建软连接

echo 666 > 1.txt
ls -i 1.txt
# 33575032 1.txt
ln -s 1.txt 2.txt				创建一个软链接2.txt
ll 2.txt						软连接2.txt指向文件1.txt
# lrwxrwxrwx 1 root root 5 Apr 18 20:51 2.txt -> 1.txt
echo 777 >> 1.txt
cat 2.txt
# 666
# 777
ls -i 2.txt						1.txt与2.txt的inode号不一样
# 33754330 2.txt
rm -rf 1.txt					删除1.txt文件
cat 2.txt						无法查看2.txt的内容
# cat: 2.txt: No such file or directory

rsync的远程模式

远程传输需要经过验证才可以,验证方式有两种((ssh、rsync --daemon)

1、ssh协议
(1)本地与远程都需要安装rsync软件
(2)远程主机需要开启sshd服务
(3)需要用到的账号是远程主机的系统账号密码---》不安全
(4)不受文件夹的限制---》不安全


2、rsync协议
基于rsync-daemon(即快又安全)
(1)本地与远程都需要安装rsync软件
(2)远程主机不需要开启sshd服务,但是远程主机需要开启rsync守护进程
    rsync --daemon
	systemctl start rsyncd
(3)用到的虚拟账号
注意:
- 1、当前登录用户是谁,进程的权限就是谁
- 2、配置中的uid控制远程链接过来的客户端的身份

(4)用的是模块名-》具体的目录

查看sshd服务是否开启(服务端)
[root@yeg ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon

在这里插入图片描述

rsync原理

#既能在本地同步也能远程同步
rsync远程传数据可以简单总结为三步
1、先验证用户身份
2、检查源路径到底需要传哪些文件,默认quick check算法
3、传输

守护进程方式

主机IP主机角色
yeg192.168.15.100客户端
backup192.168.15.41服务端
#为什么使用守护进程模式
1、rsync传输时,使用的是系统用户和系统用户的密码,非常的不安全
2、使用普通用户又会出现权限问题

强调

#1、服务端进程的用户身份,与当前登录用户有关
以什么用户提交的命令,该进程的身份就是该用户
即当前登录的用户是谁,进程的用户身份就是谁

#2、配置文件中的uid与gid是为了控制客户端的权限

首先

本地与远程均需要安装rsync
yum install rsync -y

远程与本地
setenfore 0 
systemctl stop firewalld

语法
rsync 选项  源路径   目标路径

服务端

#配置rsync
#查找配置文件
[root@backup ~]# rpm -qc rsync
/etc/rsyncd.conf
/etc/sysconfig/rsyncd

#编辑配置文件
uid = rsync							#启动服务的用户id---->控制的是客户端的权限
gid = rsync							#启动服务的用户组id
port = 873							#服务默认监听端口
fake super = yes					#无需使用root启动
use chroot = no						#安全机制
max connections = 200				#最大连接数
timeout = 600						#超时时间
ignore errors						#错误忽略
read only = false					#只读
list = false						#查看模块列表
auth users = yeg			#定义虚拟用户
secrets file = /etc/rsync.passwd		#定义虚拟用户密码
log file = /var/log/rsyncd.log			#日志文件

[backup]							#模块
comment = welcome to my backup!			#模块的备注
path = /backup						#服务器真实的路径


#根据配置文件操作
1、创建用户
[root@backup ~]# useradd rsync -s /sbin/nologin -M	#不登录,不创建家目录

2、创建密码文件
[root@backup ~]# echo "yeg:123456" > /etc/rsync.passwd			#密码是用户名 : 密码格式 
rsync_backup:123456
chmod 600 /etc/rsync.passwd		#切记要授权!!!!!

3、创建备份目录
[root@backup ~]# mkdir backup	#创建文件夹
[root@backup ~]# chown -R rsync.rsync /backup/		#授权目录


#启动服务
[root@backup ~]# systemctl start rsyncd
[root@backup ~]# rsync --daemon

#验证启动
[root@backup ~]# netstat -lntp | grep 873
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      1707/rsync          
tcp6       0      0 :::873                  :::*                    LISTEN      1707/rsync          
[root@backup ~]# ps -ef | grep rsync
root       1707      1  0 21:21 ?        00:00:00 /usr/bin/rsync --daemon --no-detach
root       1714   1619  0 21:23 pts/0    00:00:00 grep --color=auto rsync

配置文件

uid = rsync
gid = rsync
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
list = false
auth users = yeg
secrets file = /etc/rsync.passwd
log file = /var/log/rsyncd.log

[backup]
comment = welcome to my backup!
path = /backup

客户端推拉操作

#推送
[root@web1 ~]# rsync -avz /111 yeg@192.168.15.41::backup
#双冒号后面跟的是模块名,配置文件中模块的路径为存储路径
Password: 
sending incremental file list
gaiwangka.sh

sent 206 bytes  received 43 bytes  71.14 bytes/sec
total size is 194  speedup is 0.78

#拉取
[root@web1 ~]# rsync -avz yeg@192.168.15.41::backup /111/
Password: 
receiving incremental file list./
gaiwangka.sh
sent 50 bytes  received 253 bytes  67.33 bytes/sec
total size is 194  speedup is 0.64

启用rsync协议的第二种方式

客户端
[root@yeg ~]# rsync -az /111/ rsync://yeg@192.168.15.41:900/backup

服务端查看
[root@backup ~]# ll /backup/
total 4
-rw-r--r-- 1 rsync rsync 315 Apr 16 10:15 111
-rw-r--r-- 1 rsync rsync   0 Apr 16 10:14 a.jpg
-rw-r--r-- 1 rsync rsync   0 Apr 16 10:14 b.jpg
-rw-r--r-- 1 rsync rsync   0 Apr 16 10:14 c.jpg

传输免交互(不需要密码验证)

[root@yeg ~]# export RSYNC_PASSWORD=1
[root@yeg ~]# rsync -avz /222/ yeg@192.168.15.41::backup

#加入配置文件永久生效
[root@yeg ~]# vim /etc/profile
export RSYNC_PASSWORRD=1
#重启配置文件
[root@yum01 ~]# source /etc/profile
[root@yum01 ~]# rsync -avz rsync@192.168.15.50::bak test/

传输大文件到服务器限速

#  dd if=/dev/zero of=/test/xxx.bak bs=100M count=5

[root@yeg ~]# mkdir /test
[root@yeg ~]# touch /test/xxx.bak
[root@yeg ~]# dd if=/dev/zero of=/test/xxx.bak bs=100M count=5
5+0 records in
5+0 records out
524288000 bytes (524 MB) copied, 2.69809 s, 194 MB/s
[root@yeg ~]# cd /test
[root@yeg test]# ll
total 512000
-rw-r--r-- 1 root root 524288000 Apr 16 21:50 xxx.bak

root@yeg ~]# rsync -avzP --bwlimit=100 /test/ yeg@192.168.15.41::backup
sending incremental file list
./
xxx.bak
    524,288,000 100%  100.66MB/s    0:00:04 (xfr#1, to-chk=0/2)

sent 509,994 bytes  received 46 bytes  78,467.69 bytes/sec
total size is 524,288,000  speedup is 1,027.94

rsync常见报错

#1.报错内容:
[root@web01 ~]# rsync -avz rsync_backup@172.16.1.41::backup ./backup
@ERROR: Unknown module 'backup'
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
#原因:模块名字配置错误

#2.报错内容:
[root@web01 ~]# rsync -avz rsync_backup@172.16.1.41::backup ./backup
@ERROR: auth failed on module backup
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
#原因:
1.服务端密码文件不存在(名字写错了/没有创建/配置文件错了)
2.密码文件权限不是600
3.服务端密码文件用户名或密码错误
4.客户端密码输入错误或密码文件内容与服务端不一致

#3.报错内容
[root@web01 ~]# rsync -avz rsync_backup@172.16.1.41::backup ./backup
rsync: failed to connect to 172.16.1.41 (172.16.1.41): No route to host (113)
rsync error: error in socket IO (code 10) at clientserver.c(125) [Receiver=3.1.2]
#原因:服务端防火墙开启

#4.报错内容:
[root@web01 ~]# rsync -avz rsync_backup@172.16.1.41::/backup ./backup
ERROR: The remote path must start with a module name not a /
rsync error: error starting client-server protocol (code 5) at main.c(1648) [Receiver=3.1.2]
#原因:“::”守护进程模式双冒号后面为模块名,不能使用目录

#5.报错内容:
[root@web01 ~]# rsync -avz ./backup rsync_backup@172.16.1.41::backup
sending incremental file list
rsync: failed to write xattr user.rsync.%stat for "backup" (in backup): Permission denied (13)
rsync: failed to write xattr user.rsync.%stat for "backup/file1" (in backup): Permission denied (13)
backup/

sent 215 bytes  received 1,099 bytes  2,628.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
[root@web01 ~]#
#原因:服务端推送文件的目录权限不足

#6.报错内容:
[root@web01 ~]# rsync -avz ./backup rsync_backup@172.16.1.41::backup
rsync: failed to connect to 172.16.1.41 (172.16.1.41): Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(125) [sender=3.1.2]
#原因:服务端rsyncd服务没有启动

#7.报错内容:
[root@web01 ~]# rsync -avz ./backup rsync_backup@172.16.1.41::backup
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1648) [sender=3.1.2]
#原因:服务端模块对应的目录不存在

#8.报错内容:
[root@nfs ~]# rsync -avz /data/ rsync_backup@172.16.1.41::data
Password: 
sending incremental file list
rsync: failed to read xattr user.rsync.%stat for "." (in data): Permission denied (13)
rsync: failed to read xattr user.rsync.%stat for "." (in data): Permission denied (13)
rsync: failed to read xattr user.rsync.%stat for "." (in data): Permission denied (13)
rsync: recv_generator: failed to stat "11_class.xlsx" (in data): Permission denied (13)
rsync: failed to read xattr user.rsync.%stat for "." (in data): Permission denied (13)

sent 81 bytes  received 476 bytes  222.80 bytes/sec
total size is 12,437  speedup is 22.33
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
#原因:selinux没有关闭

rsync总结

1、耗费cpu资源
2、源路径下如果是频繁改动的,rsync不适合,比如数据库文件
3、不适合同步大文件
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

琴声浮或沉__听懂只一人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值