当前位置: 首页 > news >正文

网站开发费用鉴定百度文库官网登录入口

网站开发费用鉴定,百度文库官网登录入口,那个网站可以做攻略,网站建设实例分析rsync是什么? rsync 是一个远程同步工具 下载 你的集群每一台都需要下载!(也就是你需要同步的机器) yum install -y xsync如果其他不下载就是报错的这样(使用脚本的情况下,注意这里是提示 rsync没有找到…

rsync是什么?

rsync 是一个远程同步工具

下载

你的集群每一台都需要下载!(也就是你需要同步的机器)

yum install -y xsync

如果其他不下载就是报错的这样(使用脚本的情况下,注意这里是提示 rsync没有找到,不是xsync)

[root@master bin]# xsync /opt/test/
==================== master ====================
sending incremental file listsent 97 bytes  received 17 bytes  76.00 bytes/sec
total size is 10  speedup is 0.09
==================== slave1 ====================
bash: rsync: 未找到命令
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]
==================== slave2 ====================
bash: rsync: 未找到命令
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]

优点与scp对比

优点:rsync主要用于备份和镜像。具有速度快、避免复制相同内容和支持符号链接的优点。
与scp对比:rsync 要比scp复制速度快,因为 rsync 是复制有差异性的文件(它会自己检查),而scp 则是把所有的文件统一复制过去,达到的是一个 统统覆盖的意义

纯命令 Chat- GPT-3.5 演示:

rsync 是一个用于文件同步和备份的工具,可以在本地或远程系统之间高效地进行文件的复制和同步。以下是 rsync 命令的基本用法示例以及一些常用选项:

rsync [options] source destination
其中 source 表示源文件或目录的路径,destination 表示目标文件或目录的路径。

常用的选项包括:

-a:归档模式,用于保持文件的属性、权限和时间等。
-v:详细输出模式,显示正在复制的文件和目录。
-r:递归复制目录及其内容。
-z:传输时压缩数据,可以减少传输时间。
--delete:删除目标中不存在于源的文件。
--exclude:排除指定的文件或目录。
-e:指定远程 shell 的路径,通常用于远程传输。

以下是一些示例:

本地文件同步:

rsync -av /path/to/source /path/to/destination

本地目录同步:

rsync -av /path/to/source/ /path/to/destination/

从本地到远程服务器同步:

rsync -av /path/to/source username@remote_server:/path/to/destination

从远程服务器到本地同步:

rsync -av username@remote_server:/path/to/source /path/to/destination

同步时排除特定文件或目录:

rsync -av --exclude='*.log' /path/to/source /path/to/destination

使用压缩传输:

rsync -avz /path/to/source /path/to/destination

请注意,rsync 的选项和用法非常丰富,你可以根据需要进行组合和定制。在使用之前,建议查阅相关文档或执行 man rsync 命令来获取更详细的信息和帮助。

脚本

脚本来自这位仁兄: https://blog.csdn.net/qq_63756815/article/details/127016471
1、在 /bin 目录下创建 xsync文件脚本
2、需要修改的是在 第二步,修改为自己的主机名
3、修改 文件权限为 777,也可以单加一个可执行权限(x):
chmod 777 xsync
4、

#!/bin/bash#1. 判断参数个数
if [ $# -lt 1 ]
thenecho Not Enough Arguement!exit;
fi#2. 遍历集群所有机器,这里记得修改为自己的集群主机名
for host in hadoop102 hadoop103 hadoop104
doecho ====================  $host  ====================#3. 遍历所有目录,挨个发送for file in $@do#4. 判断文件是否存在if [ -e $file ]then#5. 获取父目录pdir=$(cd -P $(dirname $file); pwd)#6. 获取当前文件的名称fname=$(basename $file)ssh $host "mkdir -p $pdir"rsync -av $pdir/$fname $host:$pdirelseecho $file does not exists!fidone
done

演示:
脚本:

[root@master bin]# xsync /opt/test/
==================== master ====================
sending incremental file listsent 97 bytes  received 17 bytes  76.00 bytes/sec
total size is 10  speedup is 0.09
==================== slave1 ====================
sending incremental file list
test/
test/a1.txt
test/a2.txtsent 200 bytes  received 58 bytes  172.00 bytes/sec
total size is 10  speedup is 0.04
==================== slave2 ====================
sending incremental file list
test/
test/a1.txt
test/a2.txtsent 200 bytes  received 58 bytes  516.00 bytes/sec
total size is 10  speedup is 0.04

纯命令:

[root@master bin]# echo 2222 > /opt/test/a2.txt 
[root@master bin]# rsync -av /opt/test/ slave1:/opt/test/
sending incremental file list
a2.txtsent 137 bytes  received 41 bytes  118.67 bytes/sec
total size is 10  speedup is 0.06

这里 我专门试了试会不会自动给我创建目录(因为我没学过脚本),发现是会的
但是 如果是纯命令的话,你必须和scp命令相同的语法,就是绝对路径,且只会复制文件

http://www.ds6.com.cn/news/81555.html

相关文章:

  • 佛山网络优化推广公司天津seo培训机构
  • 网站维护服务百度竞价排名推广
  • 可以用css3做响应式网站吗软文推广平台排名
  • 上海商城网站建设网站平台有哪些
  • 有什么网上做c 的网站百度app下载最新版
  • 首先确定网站建设的功能定位整站优化代理
  • 政务网站建设工作计划结尾海外域名
  • 绍兴网站建设公司今日新闻摘抄十条
  • 男女一夜做受视频最新网站seo站长网
  • 网站开发网站制作网站营销方案模板
  • 响应式网站方案站长之家域名查询排行
  • nas搭建网站专业网站推广软件
  • 平度推广网站建设seo网络推广员招聘
  • ASP网站开发技术期末考试凡科建站客服电话
  • 天蝎网站建设seo关键词排名点击工具
  • 找网络公司做网站传媒公司
  • 网站免费域名申请有哪些网络推广平台
  • 山东企业网站备案沧州网站建设公司
  • 成品短视频app的优势抖音seo什么意思
  • 中山电商网站制作站长工具怎么关掉
  • 怎么利用网站做兼职引流推广的句子
  • 常州网站建设软件搜索指数在线查询
  • 海南澄迈网站建设兰州网站seo服务
  • 零基础学习网站开发优化大师最新版下载
  • 网络培训ppt长沙网站seo收费
  • 58网页版登录打开数字营销服务商seo
  • 制作网站的步骤百度seo排名帝搜软件
  • 响应式网页需要什么技术优化资源配置
  • 典型的b2b网站有论坛推广平台有哪些
  • 商场设计案例宁波关键词优化排名工具