centos下rsync同步資料

來源:互聯網
上載者:User

標籤:設定檔   密碼服務   用戶端   使用者   

1、 安裝rsync

yum -y installrsync

2、 無密碼命令列同步

用戶端操作

ssh-keygen -trsa

    ssh-copy-id -i /root/.ssh/[email protected]

ssh [email protected]

 

mkdir -pv/data/shell

rsync -az--delete [email protected]:/data/rsyncdata/ /data/shell/

3、 用密碼服務方式同步

由於rsync屬於xinetd的服務,因為需要先安裝xinetd

yum -y installxinetd

vi/etc/xinetd.d/rsync

把distable 改為 no

 

啟動服務

/etc/init.d/xinetdstart

netstat -tunpl |grep 873

建立使用者

useraddrsyncuser

echo ‘123456‘ |passwd --stdin rsyncuser

 

建立備份目錄

mkdir -pv/data/rsyncdata

建立設定檔

vi/etc/rsyncd.conf

uid=nobody

gid=nobody

address=192.168.1.181

port=873

hostsallow=192.168.1.186

use chroot=yes

maxconnections=5

pidfile=/var/run/rsyncd.pid

lockfile=/var/run/rsync.lock

log file=/var/log/rsyncd.log

motdfile=/etc/rsyncd.motd

 

[backdata]

path=/data/rsyncdata

comment=rsyncbackup

read only=yes

list=yes

authusers=rsyncuser

secretsfile=/etc/rsyncd.passwd

 

建立提醒檔案和密碼檔案

echo ‘welcome tobackup server‘ > /etc/rsyncd.motd

vi/etc/rsyncd.passwd

rsyncuser:123456

chmod 600/etc/rsyncd.passwd

service xinetdrestart

 

用戶端無密碼同步化

exportRSYNC_PASSWORD=123456

rsync [email protected]::backdata /data/shell/


本文出自 “記錄工作學習的軌跡” 部落格,請務必保留此出處http://stephenliu.blog.51cto.com/6470474/1676556

centos下rsync同步資料

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.