国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

rsync 數(shù)據(jù)同步使用詳解

2019-11-02 16:39:02
字體:
供稿:網(wǎng)友
rsync(d)服務(wù)端啟動兩種方式
1.daemon 2.xinetd inetd
啟動后綁在 TCP/873 端口

% cat /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it /
# allows crc checksumming etc.
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}

配置 注意設(shè)置讀寫權(quán)限屬主
% cat /etc/rsyncd.conf

motd file = /var/log/rsync/welcome.msg
pid file = /var/log/rsync/rsyncd.pid
lock file = /var/log/rsync/rsync.lock
log file = /var/log/rsync/rsyncd.log

[rsyncwww]
comment = rsync www
path = /var/www/
use chroot = no
max connections = 4
read only = false
list = true
uid = nobody
gid = nobody
auth users = wwwuser
secrets file = /etc/rsyncd.secrets
hosts allow = 1.1.1.1,2.2.2.2
hosts deny = 0.0.0.0/0
ignore errors = yes
transfer logging = yes
log format = "%a %f %l"
#log format = "%o %h [%a] %m (%u) %f %l"

[rsyncroot]
comment = rsync root
path = /
use chroot = no
max connections = 4
read only = true
#read only = false
list = true
uid = root
gid = root
auth users = rootuser
secrets file = /etc/rsyncd.secrets
hosts allow = 1.1.1.1,2.2.2.2
hosts deny = 0.0.0.0/0
ignore errors = yes
transfer logging = yes
log format = "%a %f %l"


rsyncd.secrets 一行一個用戶 用戶名:密碼 格式

使用
rsync -auvPz --progress dir1 dir2
rsync -ztruvoglpD --progress dir1 dir2
rsync -ztruvoglpD --progress dir1/ dir2
rsync -ztruvoglpD --progress dir1/file1 dir2
如果不想包含某個目錄/文件可以設(shè)置--exclude

遠(yuǎn)程使用
rsync 1.1.1.1:: 只列l(wèi)ist
rsync user@1.1.1.1::
rsync user@1.1.1.1::module
rsync user@1.1.1.1::module/path
如果沒有配置rsync server 可以通過 ssh 方式使用
rsync -e ssh -auvPz 1.1.1.1:/etc ./

同步時注意注意 / 最后的問題
不放/ 則目錄名也包含mirror
放 / 則只有目錄里面的東西mirror了

rsync -ztruvoglp --progress user@1.1.1.1::module/path ./
為了腳本調(diào)用方便 還可以調(diào)用 --password-file 同樣注意屬主權(quán)限
也可以設(shè)置環(huán)境變量RSYNC_PASSWORD=訪問含用戶認(rèn)證的rsync
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 广宁县| 晋州市| 绥宁县| 霍林郭勒市| 桐乡市| 丹巴县| 嵩明县| 鲁甸县| 南昌县| 南岸区| 青海省| 柳江县| 甘孜县| 大邑县| 永嘉县| 怀仁县| 洪湖市| 茂名市| 大城县| 扎赉特旗| 长春市| 汕头市| 铜陵市| 玛多县| 阿克陶县| 石景山区| 晋州市| 莎车县| 垦利县| 彭州市| 三穗县| 当阳市| 仁寿县| 富锦市| 广平县| 南郑县| 嘉善县| 丹阳市| 公安县| 光泽县| 龙南县|