Rsync 基础配置

rsync 部署/同步

cat /etc/rsyncd.conf

# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:

uid = nobody
gid = nobody
port = 873
use chroot = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

max connections = 20
#hosts allow = 10.200.0.0/255.255.0.0
log file = /var/log/rsync.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
lock file = /var/run/rsyncd.lock
pid file = /var/run/rsyncd.pid
#secrets file = /etc/rsyncd/rsyncd.secrets
#motd file = /etc/rsyncd/rsyncd.motd

[indexdata]
path = /indexdata
comment = base data diretory
list = yes
ignore errors
read only = false
transfer logging = yes
 

  

针对有账号,密码认证的方式,只查看,不同步

【注意点:关于密码文件的权限,必须是 600 ,chmod 600 /tmp/pass ,服务端的制定密码文件也是】


# 需要手动输入用户名和密码
rsync -azv --list-only jeck@10.200.0.24::jeck /indexdata/

# 通过文件方式,避免手动输入用户名和密码
rsync -azv --delete --port 1873 --password-file=/tmp/pass jeck@10.200.0.24::jeck /indexdata/

同步所有文件

rsync -azv --delete jeck@10.200.0.24::jeck /indexdata/

匿名方式
rsync -azv --delete rsync://10.200.0.24/indexdata/jeck /indexdata/

指定端口连接
rsync -azv --delete --port 1873 jeck@10.200.0.24::jeck /indexdata/

 

 

cat /etc/rsyncd.conf

# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
#
# global options
#
#address = 10.200.0.24
uid = nobody
gid = nobody
port = 1873
log file = /var/log/rsync.log
lock file = /var/run/rsyncd.lock
pid file = /var/run/rsyncd.pid
secrets file = /etc/rsyncd/rsyncd.secrets
motd file = /etc/rsyncd/rsyncd.motd

transfer logging = yes
#log format = %t %a %m %f %b
log format = "%o [ %a ] %m (%u) %f %b %l %b"
syslog facility = local3


use chroot = yes
timeout = 900
ignore nonreadable = yes
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

max connections = 20
#hosts allow = 10.200.0.0/255.255.0.0
timeout = 300

#hosts allow = 10.200.0.56
#hosts deny = 10.200.0.33

[indexdata]
path = /indexdata
comment = base data diretory
list = false 
ignore errors
read only = false
transfer logging = yes
#exclude = mac/

[jeck]
path = /indexdata/jeck
comment = jeck data
list = yes
ignore errors
ignore nonreadable
read only = false
transfer logging = yes
auth users = jeck
secrets file = /etc/rsyncd/rsyncd.secrets

[mac]
path = /indexdata/mac
comment = mac data
list = false
ignore errors
ignore nonreadable
read only = false
transfer logging = yes


  

posted @ 2016-08-11 11:28  schangech  阅读(634)  评论(0编辑  收藏  举报