安装

yum install rsync

mkdir /etc/rsyncd

cd /etc/rsyncd

vi rsyncd.conf

 

pid file = /var/run/rsyncd.pid
uid = root
gid = root use chroot = no
read only = yes #limit access to private LANs
hosts allow=192.168.1.2/32,127.0.0.1/32
hosts deny=* max connections = 5
motd file = /etc/rsyncd/rsyncd.motd #This will give you a separate log file
log file = /var/log/rsync.log #This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes log format = %t %a %m %f %b
syslog facility = local3
timeout = 300 [ftp_home]
path = /ftp_data/ftp_dir
list=yes
ignore errors
auth users = ftpuser
#secrets file = /etc/rsyncd/rsyncd.secrets
comment = This is test data

  启动服务

/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf

  关闭服务

kill `cat /var/run/rsyncd.pid`

   

查看服务

tail /var/log/rsync.log
ps aux|grep rsync
netstat -apn|grep 873

  加入开机启动

echo "/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf" >> /etc/rc.local

  同步数据

rsync --list-only ftpuser@127.0.0.1::ftp_home

rsync -ave ssh root@127.0.0.1:/ftp_data/test1 .

  

注意server密码文件是"用户名:密码",客户端那边只用"密码"。两边都需要chmod 600 rsyncd.secrets

rsync -rtvzPL --include-from=rsync_include.lst  --password-file=/etc/rsyncd.secrets /source_rsync/ gameserverlog@192.168.0.1::game_server_log_rsync

vi rsync_include.lst
+ itemdata*.txt
+ data*.txt
- *

查看服务器列表

rsync --list-only --password-file=rsyncd.secrets  gameserverlog@192.168.0.1::gmweb_log_rsync

 服务器配置文件

vi /etc/rsyncd.conf

[gmweb_log_rsync]
comment = public archive
path = /data/log/test1_vn
lock file = /var/lock/log_rsyncd
read only = no
list = yes
uid = jslog
gid = jslog
auth users =gameserverlog
secrets file = /etc/rsyncd.secrets
hosts allow=192.168.1.1
hosts deny =*
timeout =
refuse options = checksum dry-run

最新文章

  1. Android 延时执行任务的三种简单方法
  2. Android成长日记-APP的签名和打包
  3. IK分词算法设计总结
  4. WPF MediaElement.Position属性
  5. Hadoop32位和64位的查询
  6. #能力开放平台系列-Fiddler访问Rest服务
  7. Lowest Common Ancestor of a Binary Tree leetcode
  8. 开涛spring3(3.1) - DI的配置使用
  9. set集合(一)
  10. JavaScript基础1——基本概念
  11. 我的Qt历程1:第一个Qt程序
  12. [Swift]LeetCode818. 赛车 | Race Car
  13. iOS UIPrintInteractionController在iPad的 iOS10 和 11上的奇怪bug
  14. 《Python量化交易教程》第一部分新手入门 第1天:谁来给我讲讲Python?
  15. C#动态系统托盘图标
  16. 解决编译安装php时报错:Please reinstall the iconv library
  17. 面包屑 CSS
  18. 位图bitbucket
  19. springboot结合jwt实现基于restful接口的身份认证
  20. 【LOJ】#2052. 「HNOI2016」矿区

热门文章

  1. Linux中文件描述符fd和文件指针flip的理解
  2. 黄聪:wp-setting.php文件详解
  3. 1.scala语法
  4. import了sun开头的类,虽然它在代码里压根就没派上用处!但是必须得引用!
  5. Well, let's start everything from the very beginning.
  6. GL_GL系列 - 日记账处理管理分析(案例)
  7. Report_报表中Ref Cursor数据源的概念和用法(案例)
  8. ylbtech-Unitity-CS:Hello world
  9. 并发工具类(三)控制并发线程数的Semaphore
  10. Python标准库09 当前进程信息 (os包)