日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux rsync

發(fā)布時間:2025/7/14 linux 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux rsync 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

開源 ?快速 多功能 全量及增量 ? 本地遠程

已守護進程(socket)的方式傳輸數(shù)據(jù)

rsync ? ?參數(shù) ? 源 ? 目的

SYNOPSIS

? ? ? ?Local:? rsync [OPTION...] SRC... [DEST] ? ? ? ? ? ? ?? ????source 源 ? ? dest目的

? ? ? ?Access via remote shell:

? ? ? ? ?Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST] ? ? ? ? ? ? ? ?

? ? ? ? ?Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

? ? ? ?Access via?rsync daemon:

? ? ? ? ?Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]

? ? ? ? ? ? ? ?rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]

? ? ? ? ?Push: rsync [OPTION...] SRC... [USER@]HOST::DEST

? ? ? ? ? ? ? ?rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

直接本地同步 ?cp

# rsync??-avz? ?/etc/hosts? /tmp/

刪除文件

# rsync -r? --delete? /null/? ?/hequan/ ? ? ? ? ? 讓/null/(空文件) ?和/hequan/下一樣

推送push

$ rsync ?-avz ??-e?'ssh' ?/etc/hosts ? hequan@192.168.10.11:~ ? ? ? ? ? ? -e指定通道

拉pull

$ rsync ?-avz ??-e?'ssh' ?? hequan@192.168.10.11:~/hosts ? ?/home/hequan/

-v 詳細輸出

-z 壓縮傳輸

-a歸檔模式 ? = ?-rtopgDl?? ?遞歸 ? 保持文件時間 ? 屬主 ? 權(quán)限 ?屬組信息 ? 設(shè)備文件信息 ? 軟連接

-e?使用信道協(xié)議

daeman 模式

# rsync --version

rsync? version 3.0.6? protocol version 30

# yum install rsync -y

服務(wù)器端

# vim /etc/rsyncd.conf ?配置文件

##rsyncd.conf start##

uid = rsync

gid = rsync

use chroot = no

max connections = 200

timeout = 300

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

log file = /var/log/rsyncd.log

[hequan]

path = /hequan/

ignore errors

read only = false

list = false

hosts allow = 192.168.10.0/24

hosts deny = 0.0.0.0/32

auth users = rsync_backup

secrets file = /etc/rsync.password

#rsync_config_______________end

#?rsync --daemon??已守護進程的方式啟動

# netstat -lntup | grep?873

tcp? ? ? ? 0? ? ? 0 0.0.0.0:873? ? ? ? ? ? ? ? ?0.0.0.0:*? ? ? ? ? ? ? ? ? ?LISTEN? ? ? 1768/rsync

# cat /var/log/rsyncd.log

2016/03/29 22:53:45 [1768] rsyncd version 3.0.6 starting, listening on port 873

創(chuàng)建用戶,授權(quán) ? ? 寫入用戶名密碼

# useradd rsync? -s /sbin/nologin

# chown? -R? rsync.rsync? /hequan/

# echo "rsync_backup:hequan" > /etc/rsync.password

# cat /etc/rsyncd.password

rsync_backup:hequan

用戶名:密碼

# chmod 600 /etc/rsync.password ?降低權(quán)限

客戶端

# echo "hequan" > /etc/rsync.password ? ? ? ? ? ?只有密碼

# chmod 600 /etc/rsync.password

#rsync -avz ? ?rsync_backup@192.168.10.10::hequan?? ? ? ?/data/ ? ? ? ? ? ? ? ? ? hequan 是模塊

Password:

receiving incremental file list

./

test1

# rsync -avz? ? rsync_backup@192.168.10.10::hequan? ? ?--password-file=/etc/rsync.password? /data/

# rsync -avz ? ?/data/ ? ? rsync_backup@192.168.10.10::hequan? ? ?--password-file=/etc/rsync.password?

vi /etc/rsyncd.conf ? ?用戶 ?目錄 模塊 ? 虛擬用戶 及密碼文件

共享目錄 /hequan ? ?

創(chuàng)建rsync用戶 ? ? ?授權(quán)

創(chuàng)建密碼文件, ? 復(fù)制配置文件里的路徑,然后添加密碼內(nèi)容

? ? ?內(nèi)容虛擬用戶名:密碼

密碼文件的權(quán)限

rsync ?--daemon ?

密碼文件和服務(wù)端沒有關(guān)系

? --password-file=/etc/rsync.password ? ? ?密碼

/etc/rsync.password ? 600

同步

? ? ?推 ?拉?










本文轉(zhuǎn)自 295631788 51CTO博客,原文鏈接:http://blog.51cto.com/hequan/1763780,如需轉(zhuǎn)載請自行聯(lián)系原作者

總結(jié)

以上是生活随笔為你收集整理的linux rsync的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。