Recent Post»

Recent Comment»

« 2024/5 »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
05-10 04:48

rsync 설치 및 설정 방법 (centos)

Linux | 2016. 12. 23. 16:38 | Posted by 짱아
반응형

Source에서 backup으로 보내기




[Backup Server]

  1. rsync 설치
    yum -y install rsync

  2. rsyncd.conf 설정
    vi /etc/rsyncd.conf

[192_168_0_6]

path = /backup/192.168.0.6

hosts allow = 192.168.0.6

hosts deny = *

list = true

uid = root

gid = root

read only = false

  1. rsyncd 데몬 시작
    systemctl restart rsyncd
    systemctl enable rsyncd

  2. 백업용 디렉토리 생성
    mkdir /backup/192.168.0.6


[Source Server]

  1. rsyncd 설치
    yum -y install rsync

  2. 백업 수행
    rsync -avrz --delete /root/parse 192.168.0.85::192_168_0_6

  3. crontab 추가 (10분마다 수행)
    crontab -e
    */10 * * * * rsync -avrz --delete /root 192.168.0.85::192_168_0_6 2>&1



※ crontab log 확인

  • /var/log/cron


Backup에서 Source를 가져오기

[Source Server]

  1. 백업 대상 디렉토리 : /data_std

  2. rsync 설치
    yum -y install rsync

  3. rsyncd.conf 설정
    vi /etc/rsyncd.conf

[data]

path = /data_std

comment = data

uid = root

gid = root

use chroot = yes

read only = yes

hosts allow = 192.168.0.85

max connections = 10

timeout 600

  1. rsyncd 데몬 시작
    systemctl restart rsyncd
    systemctl enable rsyncd


[Backup Server]

  1. rysnc 설치

  2. rsync 수행
    rsync -avrz --delete 192.168.0.6::data /data


rsync option

-a : 아카이브모드

-v : 백업 진행과정 보기

-r : 지정한 디렉토리의 하위 디렉토리까지 재귀적으로 실행

-z : 데이터 압축전송

delete : 원본에서 삭제된 파일은 백업측에도 삭제(동기화)

ignore-errors : 에러무시

-T, temp-dir=/Tmp : 임시파일 저장소

exclude=*.mp4 : 확장자 mp4 파일을 제외하고 동기화

existing : 추가된 파일은 전송하지 않고 갱신된 파일만 전송

stats : 결과를 보고


반응형
: