Program/Linux

rsync를 통한 원격 파일 동기화

하랑파파♡ 2011. 11. 7. 14:10
728x90
반응형
SMALL

1. 백업 할 컴퓨터에서

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
}

disable의 default 값이 disable = yes 로되어 있는데 이를 no 로 변경 후 저장(vi 에디터에서 :wq)

그 후에 xinetd를 재시작해준다.

service xinetd restart

nmap을 실행해 정상적으로 873번 포트가 떠있는지 확인한다.

nmap localhost

/etc/rsyncd.conf 파일을 만들어 줍시다.

vi /etc/rsyncd.conf

[file]
path
= /home/www
comment
= www backup

uid = userid
gid
= userid
use chroot = yes
read only
= yes
host allow
= ip번호

max connection = 1
timeout
300

첫번째 줄의 []로 감싸여 있는 값은 해당 설정의 이름임.
path : 공유할 디렉토리
comment : 설명
uid : 접근할 user id
gid : 접근할 group id
use chroot : chroot를 사용할지 여부, 특별한 이유가 없는 이상 꼭 사용할 것
read only : 읽기만 가능할 것인지, 백업의 피 대상이므로 yes로 설정
host allow : 접근 가능한 호스트 설정. 백업서버만 접근 가능하도록 설정
max connection : 최대 몇개의 커넥션을 연결할 수 있는지 설정
timeout : 타임아웃 시간 설정

백업을 받을 컴에서 아래 명령어를 실행한다.

rsync -avz 백업 할 컴 ip::file /home/backup/file1

728x90
반응형
LIST

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

crontab 사용법  (0) 2013.08.22
리눅스 + 오라클 인스턴스클라리언트(리스너클라이언트) 연동  (0) 2011.11.07
리눅스 기본 명령어  (0) 2011.11.07
RPM의 개념과 활용  (0) 2011.11.07
심볼릭 링크 만들기  (0) 2011.11.07