rsync的搭建方法
来源:互联网 发布:上海新房成交数据 编辑:程序博客网 时间:2024/05/29 07:25
rsync 服务器安装比较简单,但是安装好rsync后,我们并没有发现配置文件,以及rsync服务器启动程序,不要着急,那是因为每个管理员可能对rsync 用途不一样,所以发行版只是让安装好软件就可以了,配置文件都是让管理员来根据自己的用途和方向来自己设置的。
1、rsync的安装
rsync的安装可以使用yum直接安装:yum install rsync
不过我是编译安装的,官网下载地址:https://download.samba.org/pub/rsync/
[root@linux-web soft]# wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz
[root@linux-web soft]# tar -zxvf rsync-3.1.2.tar.gz[root@linux-web rsync-3.1.2]# cd rsync-3.1.2
[root@linux-web rsync-3.1.2]# ./configure --prefix=/www/wdlinux/rsync
rsync 3.1.2 configuration successful //表示编译成功
[root@linux-web rsync-3.1.2]# make && make install
2、rsync的配置
[root@linux-web rsync-3.1.2]# mkdir /etc/rsyncd //创建一个目录存放rsyncd.motd和rsyncd.pwd文件
[root@linux-web rsync-3.1.2]# touch /etc/rsyncd/rsyncd.pwd //创建rsyncd.pwd文件存放用户名:密码
[root@linux-web rsync-3.1.2]# chmod 600 /etc/rsyncd/rsyncd.pwd //为了密码的安全性,将rsyncd.pwd文件的权限设为600
[root@linux-web rsync-3.1.2]# ls -lh /etc/rsyncd/rsyncd.pwd //查看文件信息,权限是否修改成功
-rw------- 1 root root 0 Sep 7 10:40 /etc/rsyncd/rsyncd.pwd
[root@linux-web rsync-3.1.2]# touch /etc/rsyncd/rsyncd.motd //创建登录成功欢迎页面
[root@linux-web rsync-3.1.2]# vi /etc/rsyncd/rsyncd.motd //编辑欢迎信息
[root@linux-web rsync-3.1.2]# find / -name rsyncd.conf //找到配置文件所在的目录
/etc/rsyncd.conf
[root@linux-web rsync-3.1.2]# vi /etc/rsyncd.conf //编辑配置文件
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
uid = root #设置用户
gid = root #设置用户组
use chroot = yes
max connections = 4 #客户端最多连接数
pid file = /var/run/rsyncd.pid #设置将进程写入文件
motd file = /etc/rsyncd/rsyncd.motd #登录成功欢迎页面
host allow = ***.***.***.*** #允许连接的IP,IP段用空格隔开
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
# [ftp]
# path = /home/ftp
# comment = ftp export area
[uploadfile] #模块名
path = /data #本模块指定的文件目录
list = no #是否列出服务器提供的同步目录,设置为no较为安全
ignore errors #忽略IO错误
auth users = user1 #认证用户,在rsyncd.pwd设置了该用户的密码
secrets file = /etc/rsyncd/rsyncd.pwd #指定用户:密码文件
comment = module loading success! #该模块的说明文字
exclude = a/ b/ #排除本模块下指定目录中的个别文件目录
3、rsync服务的启动+防火墙配置
[root@linux-web rsync-3.1.2]# /www/wdlinux/rsync/bin/rsync --daemon --config=/etc/rsyncd.conf //启动rsync服务
[root@linux-web rsync-3.1.2]# iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT //设置873端口通过服务器
[root@linux-web rsync-3.1.2]# iptables -L //查看防火墙是否打开了873端口
[root@linux-web rsync-3.1.2]# ps -ef | grep rsync //查看rsync进程是否开启
4、在客户端实现同步
[root@VM_11_204_centos image]# rsync --list-only user1@***.***.***.***::uploadfile //查看rsync服务器上提供出来的同步文件列表(用户名@rsync服务器IP::模块名)
[root@VM_11_204_centos image]# rsync -avzP user1@***.***.***.***::uploadfile /data/test //将rsync服务器上uploadfile模块下的代码同步到本地/data/test下
- rsync的搭建方法
- Rsync 搭建
- 最簡單的rsync配置方法
- Rsync同步镜像服务的搭建
- Rsync 同步镜像服务的搭建
- linux下rsync服务的搭建
- Rsync 建立多目录模块的方法
- rsync搭建同步策略
- Rsync 服务器搭建
- rsync 服务器搭建
- rsync服务搭建配置
- rsync服务器搭建
- Rsync服务搭建小结
- rsync服务端搭建记录
- Rsync 服务器搭建
- rsync服务器搭建全过程
- rsync 服务器搭建
- [转]Rsync同步镜像服务的搭建
- Hadoop installation on windows
- Vim常用命令汇总
- Web前端面试题目汇总
- UDP传输long类型的数
- pjsip 在vs2015中使用时提示无法找到符号
- rsync的搭建方法
- 如何用JS设置cookie
- 通用的ViewHolder
- 分布式一致性算法Raft详解
- MySQL字符串函数substring:字符串截取
- 希尔排序
- Spring 各个包的作用
- oracle常用连接 left join vs right join vs inner join
- 136. Single Number