Rsync 基礎配置

rsync 部署/同步bash

cat /etc/rsyncd.confui

# /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
 

  

針對有帳號,密碼認證的方式,只查看,不一樣步orm

【注意點:關於密碼文件的權限,必須是 600 ,chmod 600 /tmp/pass ,服務端的制定密碼文件也是】blog


# 須要手動輸入用戶名和密碼
rsync -azv --list-only jeck@10.200.0.24::jeck /indexdata/ip

# 經過文件方式,避免手動輸入用戶名和密碼
rsync -azv --delete --port 1873 --password-file=/tmp/pass jeck@10.200.0.24::jeck /indexdata/ci

同步全部文件部署

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

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

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

 

 

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


相關文章
相關標籤/搜索