1. rsync
여러대 서버를 분산하여 서버 데이터 동기화하는데 많이 사용될 수 있다. root권한없이 서버로부터 데이터를 빠르게 전송 받을 수 있으며, 원격서버와 미러서버와 전송 데이타를 비교하여 변화된 데이터를 저장 할 수 있다. 또한 ssh를 이용하면 rsync 서버가 구축되어 있지 않아도 미러링을 할 수 있는 이점이 있다.
rsync는 rcp와 비슷한 동작을 하는 프로그램으로 rcp보다 더 다양한 옵션이 있고, 더 효율적으로 데이터를 전송합니다. (출발지와 목적지 사이에 다른 부분만을 전송) 파일크기의 변화나 시간의 변화등을 이용 동기화를 합니다.
주요 특징은 다음과 같습니다.
ㅇ 링크, device, 소유자, 그룹, 허가권 복사 지원
ㅇ GNU tar와 비슷한 exclude, exclude-from 옵션 지원
ㅇ rsh 또는 ssh 등 사용가능
ㅇ root 권한이 필요없음
ㅇ anonymous 또는 인증 rsync 서버 지원(미러링에 유용함)
2. rsync 특징
- rsync 는 전체 디렉토리 트리와 파일 시스템을 업데이트 할 수 있습니다.
- 선택적으로 심볼릭 링크, 하드 링크, 파일 소유권, 권한, 장치와 시간을 유지할 수 있습니다.
- 설치하기 위해서 특별한 권한을 요구하지 않습니다.
- 국제적인 정보루트로 다양한 파일들의 대기시간을 단축합니다.
- rsh, ssh 또는 전송(transport) 과 같은 직접소켓(direct sockets)을 사용할 수 있습니다.
- 이상적인 미러링(mirroring)을 위한 익명의(anonymous) rsync 를 지원합니다.
======================================================
rsync 서버 설정
1. 파일을 생성하자
vi /etc/rsyncd.conf
#아래와 같이 입력하자.
[leopard] #서비스 이름
comment = leopart mirror # 설명
path = /nfsroot # 백업할 디렉
uid = nobody #익명접근 허용
gid = nobody #익명접근 허용
use chroot = yes #/nfsroot 를 최상위 디렉으로 지정하여 다른 디렉으로 이동 못하게 한다.
read only = yes # 데이터만 다운로드 되게
host allow = 119.xxx.xxx.xxx # 접속 허용할 클라이언트
max connections = 5 # 동시접속자 수 0은 무제한
timeout = 120 # 유휴시간이후 접속 끊기
2. 데몬 파일을 수정하자
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 <==이부분을 yes에서 no로 변경후 저장
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
3. 슈퍼 데몬 재시작하기
/etc/init.d/xinetd restart
4. 확인해 보기
rsync는 독립실행형으로 실행되지 않기 때문에 ps -ax 로 볼수 없다.
아래와 같이 실행해보고 결과가 아래와 같으면 OK..
[root@linux /]# telnet localhost 873
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
@RSYNCD: 29
5. 클라이언트에서 접근하여 백업하기
[사용방법]
# rsync [option] [rsync 서버]:[서비스명] [다운로드할 위치]
- rsync : rsync 명령어
- [option] : 각종옵션들 아래 참조
- [rsync 서버] : rsync가 구축되어 구동되고 있는 서버도메인 혹은 IP
- [서비스명] : 서비스 되고 있는 디렉토리명(NFS로 치면 서버측의 서비스되는 디렉토리)
- [다운로드할 위치] : 클라이언트(당신)의 디렉토리(NFS로 치면 마운트될 디렉토리)
option
-a : archive mode (심볼릭 링크, 속성, 퍼미션, 소유권 등 보존)
-r : 하위 디렉토리 포함
--delete : 서버 동기화 후 rsync 서버에서 파일이 삭제되었으면, 클라이언트도 대상 파일을 삭제하는 옵션
-v : verbose mode (자세한 정보 출력)
-z : compress (전송시 압축)
-e ssh : ssh를 이용한 rsync 동기화
실예제]
[root@orasrv /] #rsync -avzr --delete 121.xxx.xxx.xxx::leopard /ftproot
receiving file list ... done
./
fromhome
gotobed
gotobed1
test
sent 173 bytes received 297 bytes 940.00 bytes/sec
total size is 0 speedup is 0.00
====================================================================
참고]
rsync 서버 없이 사용하기
[root@orasrv /ftproot] #rsync -avzr --delete -e ssh 121.xxx.xxx.xxx:/stage/sqldeveloper* /ftproot/
root@121.xxx.xxx.xxx's password:
receiving file list ... done
sqldeveloper-2.1.1.64.39-1.noarch.rpm
sent 42 bytes received 98161656 bytes 2157399.96 bytes/sec
total size is 98128552 speedup is 1.00
여러대 서버를 분산하여 서버 데이터 동기화하는데 많이 사용될 수 있다. root권한없이 서버로부터 데이터를 빠르게 전송 받을 수 있으며, 원격서버와 미러서버와 전송 데이타를 비교하여 변화된 데이터를 저장 할 수 있다. 또한 ssh를 이용하면 rsync 서버가 구축되어 있지 않아도 미러링을 할 수 있는 이점이 있다.
rsync는 rcp와 비슷한 동작을 하는 프로그램으로 rcp보다 더 다양한 옵션이 있고, 더 효율적으로 데이터를 전송합니다. (출발지와 목적지 사이에 다른 부분만을 전송) 파일크기의 변화나 시간의 변화등을 이용 동기화를 합니다.
주요 특징은 다음과 같습니다.
ㅇ 링크, device, 소유자, 그룹, 허가권 복사 지원
ㅇ GNU tar와 비슷한 exclude, exclude-from 옵션 지원
ㅇ rsh 또는 ssh 등 사용가능
ㅇ root 권한이 필요없음
ㅇ anonymous 또는 인증 rsync 서버 지원(미러링에 유용함)
2. rsync 특징
- rsync 는 전체 디렉토리 트리와 파일 시스템을 업데이트 할 수 있습니다.
- 선택적으로 심볼릭 링크, 하드 링크, 파일 소유권, 권한, 장치와 시간을 유지할 수 있습니다.
- 설치하기 위해서 특별한 권한을 요구하지 않습니다.
- 국제적인 정보루트로 다양한 파일들의 대기시간을 단축합니다.
- rsh, ssh 또는 전송(transport) 과 같은 직접소켓(direct sockets)을 사용할 수 있습니다.
- 이상적인 미러링(mirroring)을 위한 익명의(anonymous) rsync 를 지원합니다.
======================================================
rsync 서버 설정
1. 파일을 생성하자
vi /etc/rsyncd.conf
#아래와 같이 입력하자.
[leopard] #서비스 이름
comment = leopart mirror # 설명
path = /nfsroot # 백업할 디렉
uid = nobody #익명접근 허용
gid = nobody #익명접근 허용
use chroot = yes #/nfsroot 를 최상위 디렉으로 지정하여 다른 디렉으로 이동 못하게 한다.
read only = yes # 데이터만 다운로드 되게
host allow = 119.xxx.xxx.xxx # 접속 허용할 클라이언트
max connections = 5 # 동시접속자 수 0은 무제한
timeout = 120 # 유휴시간이후 접속 끊기
2. 데몬 파일을 수정하자
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 <==이부분을 yes에서 no로 변경후 저장
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
3. 슈퍼 데몬 재시작하기
/etc/init.d/xinetd restart
4. 확인해 보기
rsync는 독립실행형으로 실행되지 않기 때문에 ps -ax 로 볼수 없다.
아래와 같이 실행해보고 결과가 아래와 같으면 OK..
[root@linux /]# telnet localhost 873
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
@RSYNCD: 29
5. 클라이언트에서 접근하여 백업하기
[사용방법]
# rsync [option] [rsync 서버]:[서비스명] [다운로드할 위치]
- rsync : rsync 명령어
- [option] : 각종옵션들 아래 참조
- [rsync 서버] : rsync가 구축되어 구동되고 있는 서버도메인 혹은 IP
- [서비스명] : 서비스 되고 있는 디렉토리명(NFS로 치면 서버측의 서비스되는 디렉토리)
- [다운로드할 위치] : 클라이언트(당신)의 디렉토리(NFS로 치면 마운트될 디렉토리)
option
-a : archive mode (심볼릭 링크, 속성, 퍼미션, 소유권 등 보존)
-r : 하위 디렉토리 포함
--delete : 서버 동기화 후 rsync 서버에서 파일이 삭제되었으면, 클라이언트도 대상 파일을 삭제하는 옵션
-v : verbose mode (자세한 정보 출력)
-z : compress (전송시 압축)
-e ssh : ssh를 이용한 rsync 동기화
실예제]
[root@orasrv /] #rsync -avzr --delete 121.xxx.xxx.xxx::leopard /ftproot
receiving file list ... done
./
fromhome
gotobed
gotobed1
test
sent 173 bytes received 297 bytes 940.00 bytes/sec
total size is 0 speedup is 0.00
====================================================================
참고]
rsync 서버 없이 사용하기
[root@orasrv /ftproot] #rsync -avzr --delete -e ssh 121.xxx.xxx.xxx:/stage/sqldeveloper* /ftproot/
root@121.xxx.xxx.xxx's password:
receiving file list ... done
sqldeveloper-2.1.1.64.39-1.noarch.rpm
sent 42 bytes received 98161656 bytes 2157399.96 bytes/sec
total size is 98128552 speedup is 1.00