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

乐清手机网站设计蜂蜜网络营销推广方案

乐清手机网站设计,蜂蜜网络营销推广方案,现在建网站赚钱吗,新公司网站怎么做推广版权声明:原创作品,请勿转载! 文章目录 版权声明:原创作品,请勿转载! 实验环境介绍: 1.工具介绍 2.详细介绍 2.1 本地模式(用得少) 2.2 远程模式 2.3 守护进程模式…

版权声明:原创作品,请勿转载!

文章目录

版权声明:原创作品,请勿转载!

实验环境介绍:

1.工具介绍

2.详细介绍

2.1 本地模式(用得少)

2.2 远程模式

2.3 守护进程模式(企业常用)


实验环境介绍:

主机名IP角色
backup

10.0.0.41/24

172.16.1.41/24

rsync服务端
web0110.0.0.7/24rsync客户端

1.工具介绍

    Rsync(Remote Synchronization)是Linux/Unix系统下的一款增量备份与文件同步工具,仅同步变化的文件部分,支持本地或远程数据同步。

2.详细介绍

2.1 本地模式(用得少)

语法结构

rsync    [OPTION...]  SRC...   [DEST]
命令     选项参数     源文件   目标位置

实战演示

[root@backup ~]# touch a.txt
[root@backup ~]# ll a.txt
-rw-r--r-- 1 root root 0 May 15 11:19 a.txt###将a.txt拷贝到/opt目录下
[root@backup ~]# ll /opt
total 0
[root@backup ~]# rsync -avz a.txt /opt
sending incremental file list
a.txtsent 84 bytes  received 35 bytes  238.00 bytes/sec
total size is 0  speedup is 0.00
[root@backup ~]# ll /opt
total 0
-rw-r--r-- 1 root root 0 May 15 11:19 a.txt
##再次拷贝则默认的为增量拷贝,不会再进行拷贝
[root@backup ~]# rsync -avz a.txt /opt
sending incremental file listsent 44 bytes  received 12 bytes  112.00 bytes/sec
total size is 0  speedup is 0.00注意:只拷贝目录下的内容不拷贝目录本身需要在目录的后面加/
[root@backup ~]# rsync -avz test/ /opt/
sending incremental file list
./
1.txt
2.txt
3.txtsent 247 bytes  received 76 bytes  646.00 bytes/sec
total size is 43  speedup is 0.13
[root@backup ~]# ll /opt
total 12
-rw-r--r-- 1 root root 29 Mar 29  2024 1.txt
-rw-r--r-- 1 root root  8 Mar 31  2024 2.txt
-rw-r--r-- 1 root root  6 Mar 31  2024 3.txt
-rw-r--r-- 1 root root  0 May 15 11:19 a.txt不加/就会拷贝目录及目录下的内容
[root@backup ~]# rsync -avz test /opt/
sending incremental file list
test/
test/1.txt
test/2.txt
test/3.txtsent 262 bytes  received 77 bytes  678.00 bytes/sec
total size is 43  speedup is 0.13
[root@backup ~]# ll /opt
total 0
-rw-r--r-- 1 root root  0 May 15 11:19 a.txt
drwxr-xr-x 2 root root 45 Mar 31  2024 test
[root@backup ~]# ll /opt/test
total 12
-rw-r--r-- 1 root root 29 Mar 29  2024 1.txt
-rw-r--r-- 1 root root  8 Mar 31  2024 2.txt
-rw-r--r-- 1 root root  6 Mar 31  2024 3.txt

2.2 远程模式

远程模式分为两种,支持push(推送)pull(拉取)两种同步方式

①pull:rsync [OPTION...] [USER@]HOST:SRC... [DEST]
     -avz:参数
     USER@:用户
     HOST:主机IP地址 域名 主机名称
     SRC: 源文件
     DEST:目标位置/ 下载到本地的哪个目录

实战演示

###10.0.0.41拉取10.0.0.7上的/root/nginx-1.26.0.tar.gz到本地的当前目录
[root@backup ~]# rsync -avz root@10.0.0.7:/root/nginx-1.26.0.tar.gz ./
The authenticity of host '10.0.0.7 (10.0.0.7)' can't be established.
ECDSA key fingerprint is SHA256:leUKz+MjwtcFXELjOcmzH4STQrbY83DuaRU6LTWLP9c.
ECDSA key fingerprint is MD5:b0:c5:2d:b4:60:68:2e:f2:b5:36:a8:b0:06:97:67:c8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.7' (ECDSA) to the list of known hosts.
root@10.0.0.7's password: 
receiving incremental file list
nginx-1.26.0.tar.gzsent 43 bytes  received 1,243,731 bytes  276,394.22 bytes/sec
total size is 1,244,118  speedup is 1.00
[root@backup ~]# ll nginx-1.26.0.tar.gz
-rw-r--r-- 1 root root 1244118 Apr 23  2024 nginx-1.26.0.tar.gz

PUSH:rsync [OPTION...] SRC... [USER@]HOST:DEST
     -avz:参数选项
     SRC:文件/文件的位置/目录
     USER@ :用户名
     HOST:ip地址主机名称 域名
     DEST:目标位置

实战演示

###10.0.0.41将test目录推送到10.0.0.7的/opt目录下
[root@backup ~]# rsync -avz test root@172.16.1.7:/opt/
The authenticity of host '172.16.1.7 (172.16.1.7)' can't be established.
ECDSA key fingerprint is SHA256:leUKz+MjwtcFXELjOcmzH4STQrbY83DuaRU6LTWLP9c.
ECDSA key fingerprint is MD5:b0:c5:2d:b4:60:68:2e:f2:b5:36:a8:b0:06:97:67:c8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.1.7' (ECDSA) to the list of known hosts.
root@172.16.1.7's password: 
sending incremental file list
test/
test/1.txt
test/2.txt
test/3.txtsent 262 bytes  received 77 bytes  96.86 bytes/sec
total size is 43  speedup is 0.13
[root@web01 ~]# ll -R /opt
/opt:
total 0
drwxr-xr-x 2 root root 45 Mar 31  2024 test/opt/test:
total 12
-rw-r--r-- 1 root root 29 Mar 29  2024 1.txt
-rw-r--r-- 1 root root  8 Mar 31  2024 2.txt
-rw-r--r-- 1 root root  6 Mar 31  2024 3.txt

但是这种传输你可能会发现一个问题,那就是需要输入root的密码,这是十分危险的。那怎么解决这个问题呢?我们看下面的这种方式。 

2.3 守护进程模式(企业常用)

1.客户端需要执行的命令格式
Push(往服务端上传文件): rsync [OPTION...] SRC... [USER@]HOST::DEST   # 冒号后边必须是模块名称
Pull(从服务端下载文件): rsync [OPTION...] [USER@]HOST::SRC... [DEST]   

2.配置rsync服务

[root@backup ~]# vim /etc/rsyncd.conf 
[root@backup ~]# cat /etc/rsyncd.conf 
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 = rsync_backup 
secrets file = /etc/rsync.passwd 
log file = /var/log/rsyncd.log
##################################### 
[backup] 
comment = this is backup show! 
path = /backup
[root@backup ~]# id rsync
id: rsync: no such user
[root@backup ~]# useradd -M -s /sbin/nologin rsync
[root@backup ~]# id rsync
uid=1001(rsync) gid=1001(rsync) groups=1001(rsync)
[root@backup ~]# vim /etc/rsync.passwd 
[root@backup ~]# cat /etc/rsync.passwd 
rsync_backup:123456
[root@backup ~]# chmod 600 /etc/rsync.passwd 
[root@backup ~]# ll /etc/rsync.passwd 
-rw------- 1 root root 20 May  9  2024 /etc/rsync.passwd

3.创建备份目录并授权

[root@backup ~]# mkdir /backup
[root@backup ~]# chown rsync.rsync /backup
[root@backup ~]# ll -d /backup
drwxr-xr-x 2 rsync rsync 19 May  9  2024 /backup

4.重启服务并加入开机自启

[root@backup ~]# systemctl restart rsyncd
[root@backup ~]# systemctl enable rsyncd

5.查看端口启动情况,可以看到服务成功部署启动

[root@backup ~]# netstat -tnulp | grep 873
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      2358/rsync          
tcp6       0      0 :::873                  :::*                    LISTEN      2358/rsync 

6.实战演练:

###将10.0.0.7 家目录下的rsync_test目录推送到10.0.0.41服务端的backup模块
[root@web01 ~]# rsync -avz rsync_test rsync_backup@10.0.0.41::backup
Password: 
sending incremental file list
rsync_test/
rsync_test/1.txtsent 126 bytes  received 47 bytes  69.20 bytes/sec
total size is 0  speedup is 0.00
[root@backup ~]# ll -d /backup/rsync_test/
drwxr-xr-x 2 rsync rsync 19 May 15  2025 /backup/rsync_test/

从上面的实战演练案例中可以看到这种是需要交互的,需要手动输入密码,但往往在生产环境中rsync会搭配定时任务在凌晨执行,我们总不能在凌晨去手动输入密码吧,所以我们需要采用非交互式的方法来往服务器推送文件,那怎么做呢,请看下文

7.配置免交互,可以看到不再需要手动输入密码

1.将密码写入到一个文件中
[root@web01 ~]# echo 123456 > /etc/rsync.pass
[root@web01 ~]# chmod 600 /etc/rsync.pass
2.再次往服务端推送文件
[root@web01 ~]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.pass
sending incremental file listsent 48 bytes  received 20 bytes  136.00 bytes/sec
total size is 327  speedup is 4.81

好了,rsync服务暂时就先介绍到这里啦~

http://www.cadmedia.cn/news/12908.html

相关文章:

  • 中山制作网站的公司吗北京搜索引擎优化seo专员
  • 网站方案策划书网站如何进行优化
  • 微信二次开发淄博seo公司
  • 2016企业网站建设合同互动营销案例
  • 汽车网站建设方案十大广告公司
  • 展示型网站建设的标准桂林seo
  • 北京网站改版查域名备案
  • 昆山专业网站建设公司哪家好1688如何搜索关键词排名
  • 个人网站设计结构图友情链接怎么添加
  • 网站内容编写方法正规seo多少钱
  • 滑县网站建设哪家专业百度推广运营工作是什么
  • 手机免费网站制作网站制作工具有哪些
  • 企业网站建设规划的基本原则是什么2023新闻热点摘抄
  • 涪陵区小城镇建设管理处网站新闻网站软文平台
  • 政府网站建设费用太原seo公司
  • 网站建设对电子商务的作用seo专员的工作内容
  • 个人网站备案需要哪些百度推广代理商加盟
  • 广西建设执业资格注册中心网站太原竞价托管公司推荐
  • 网站建设用图片重庆百度推广开户
  • 网站建设域名是什么互联网营销推广渠道
  • 做外链的网站快速排名生客seo
  • 千图网官网素材seo引擎优化专员
  • 免备案自助建站网站windows优化大师怎么使用
  • 上海短期网站建设培训腾讯推广一次广告多少钱
  • 大连做网站哪家服务好百度搜索风云榜下载
  • 网站建设报价流程网络营销的五个发展阶段
  • 网站建设流程哪家好长沙百度推广开户
  • 东莞网站开发营销国外网站设计
  • 河南省建设教育协会网站人力资源培训网
  • 旅游网站建设实训报告创建网站平台