티스토리 뷰

Infra/Linux

rsync 설정하기

Tomining 2015. 3. 6. 15:47

1. rsync 서버 측 설정 (원본서버)

- rsync 활성화 : 아래 파일의 disable 되어 있는 부분을 yes에서 no 으로 변경

root@localhost# vi /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
}

- rsync 설정 파일 : rsyncd.conf 파일을 새로 생성

root@localhost# vi /etc/rsyncd.conf

[home]                ### 이름 지정 - rsync 수행시 Key로 사용됨.
path = /home       ### 경로 지정
comment = home ### 설명 지정
uid = irteam
gid = irteam
use chroot = yes
read only = yes
hosts allow = 127.0.0.1 192.168.1.0/24      ### 허용 IP 설정
max connections = 3
timeout 600

- rsync 서비스 실행

root@localhost# /etc/init.d/xinetd restart

2. rsync 클라이언트 측 데이터 복사 설정

rsync -avz --delete 192.168.1.1::home /home

서버측IP :: 이름 /복사될경로

[option]
-r recursive (하위 디렉토리까지 포함)
-a : 아카이브 모드. 심볼릭 링크, 속성, 퍼미션, 소유권 등 보존
-v : 상세하게 보여움(목록)
-z : 전송시 압축을 함
-l : 심볼릭 링크 재생성
-p : 퍼미션 업데이트
-t : 변경시간 전송 (이것이 없으면 전송한 시간으로 바뀜)
-g : 그룹이름 변경
--delete : 서버에 없는 파일을 클라이언트에서도 삭제함
--exclude : 제외할 디렉토리, 파일명
--stats : 전송결과 표시

'Infra > Linux' 카테고리의 다른 글

Linux 파일 구조  (0) 2015.12.31
find exec 사용시 주의사항  (0) 2015.03.31
Find 명령어  (0) 2015.03.16
crontab 사용법  (0) 2015.03.06
Linux Shell  (0) 2015.03.06
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
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
글 보관함