rsync 同步
来源:互联网 发布:广州楼盘成交数据 编辑:程序博客网 时间:2024/04/27 19:59
依上图所示,架构分为Server端和客户端
实现目的:Server 端A 放置tomcat应用,Client 端B 为备份端,要实现把A端指定目录下的内容同步到B端
Server 端配置如下:
1.安装rsync
[root@localhost ~]# yum -y install rsync
2.编辑配置文件
[root@localhost ~]# vim /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 10
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[tomcat1]
uid = root
gid = root
path = /www/webapp/RedHorse
comment = test
ignore errors
read only = no
write only = no
list = yes
hosts allow = 192.168.0.2/24
hosts dengy = *
auth users = backup
secrets file = /etc/server.pass
3.创建server.pass
[root@localhost ~]# vim /etc/server.pass
backup:123456
4.启动rsync
[root@localhost ~]# rsync --daemon --config=/etc/rsyncd.conf
5.检查rsync是否启动
[root@localhost ~]# ps -ef | grep rsync
root 8086 1 0 15:05 ? 00:00:00 rsync --daemon --config=/etc/rsyncd.conf
root 9583 6224 0 15:58 pts/3 00:00:00 grep rsync
Client 端配置
1.创建客户端验证文件
[root@localhost ~]# more/etc/rsync.client.pass
123456
2.创建同步脚本
[root@localhost ~]# more sync.sh
#!/bin/bash
/usr/bin/rsync -vzrtopg --delete --exclude=index.do --exclude "content" --exclude "META-INF" --exclude "static" --exclude "upload" --exclude "WEB-INF" --password-file=/etc/rsync.client.pass backup
@192.168.0.1::tomcat1 /www/webapp/RedHorse
3.验证
目的实现
注意:
过滤目录的时候 目录名双引号引起来便可
例如: --exclude "content"
- rsync同步
- rsync 同步
- rsync同步
- rsync同步
- rsync同步
- rsync同步
- rsync同步
- rsync同步
- lsyncd+rsync实时同步rsync同步
- rsync 同步使用详解
- rsync搭建同步策略
- Rsync+ssh同步服务器
- rsync同步专题
- rsync数据同步备份
- rsync同步软件
- Rsync实现文件夹同步
- rsync 同步使用详解
- rsync文件同步配置
- 直接调用Webservice返回XML时需要配置web.config
- ODPS 下map / reduce 的编写
- Android中常用的工具类02
- 自定义tld 标签
- artDialog 插件试用
- rsync 同步
- android 下载流文件的部分数据及断点续传的关键点header Range
- 我是昆明理工大学的大二学生这是我的第一篇blog
- Connection is read-only. Queries leading to data modification are not allowed
- memcached内存数据库安装配置
- 人生自古谁无死,你接下一句
- Linux下的压缩解压缩命令详解
- 黑马程序员-交通灯(自己写的)
- jenkins调整jdk版本不生效的解决办法