Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- PascalCase
- 카멜케이스
- udp
- SnakeCase
- ServerSocket
- DatagramPacket
- 명명규칙
- UDP통신
- NamingRule
- 스네이크케이스
- DatagramSocket
- tcp
- 케밥케이스
- camelcase
- Java
- 파스칼케이스
- KebabCase
- Socket
Archives
- Today
- Total
MATT's
파일 동기화 - rsync 본문
rsync 란?
서로 다른 두 컴퓨터에 들어있는 정보를 동기화 시킬 때 사용하는 프로그램
- Remote Sync의 약자
- rsync는 컴퓨터 시스템 상에서 파일을 효율적으로 전송하고 동기화하기 위한 유틸리티
- 파일의 타임스탬프와 크기를 검사하여 동작
- 전송 시에 네트워크 대역폭을 최소화하는 delta encoding algorithm을 구현하여 rcp나 scp보다 훨씬 빠르고 효율적으로 site간의 데이터를 동기화한다.
- rsync는 client와 server 프로그램이 모두 포함되어 있으며 server로 구동 시 tcp의 873 포트를 사용한다.
- server 구동 시 SSH나 RSH 같은 Remote Shell protocol 기반에서 동작할 수도 있으므로 ssh 기반으로 rsync를 사용하면 방화벽을 오픈할 필요 없이 편리하게 사용할 수 있다.
rsync 설치 방법
rsync 방화벽 허용 (SSH 기반으로 사용 시 생략)
# iptables -A -INUPT -p -tcp --dport 873 -j ACCEPT
( rsync는 873 port를 사용 )
rsync 설치 확인 방법
[root@web ~]# rpm -qa | grep rsync
[root@web ~]# yum list installed | grep rsync
rsync 설치 방법
[root@web ~]# yum -y install rsync
xinetd 설치 방법
xinetd 설치 확인 방법
[root@web ~]# rpm -qa | grep xinetd
[root@web ~]# yum list installed | grep xinetd
xinetd 설치 방법
[root@web ~]# yum -y install xinetd
rsync 설정 방법
xinetd rsync 설정 파일 수정
[root@web ~]# 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
flags = IPv6
socket_type = stream
wait = no user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
- 'disable=yes' 부분을 'disable=no'로 변경
rsync 설정 파일 작성
[root@web ~]# vi /etc/rsync.conf
[rsync_test] -> 사용할 rsync 서비스 이름
path = /usr/local/test -> 데이터원본 경로
comment = rsync_test -> 코멘트
uid = root -> 권한 사용자
gid = root -> 권한 그룹
use chroot = yes
read only = yes
hosts allow = 192.168.10.10 -> rsync 클라이언트IP, localhost일 경우 입력하지 않아도 된다
max connections = 10
timeout = 30
사용법
[root@web ~]# rsync [options] [source] [destination]
[options]
- -a : archive mode(권한 및 속성 복사) (=-rlptgoD)
- -r : 재귀적으로 하위 디렉토리까지 복사
- -l : symbolic link 보존
- -p : permission(권한) 보존
- -t : timestamp(최종 수정일) 보존
- -g : 그룹 보존
- -o : 소유자 보존(root만 가능)
- -D : devision, special 파일 보존
- -v : 동기화 내역 상세 출력
- -z : 데이터 압축
- -h : human readable
- -u : 덮어쓰기를 하지 않음
- --exclude : 제외할 파일 확장자 설정
- --delete : 동기화 시 서버에 파일이 없으면 클라이언트에서 파일 삭제
- --progress : 진행 정도를 화면에 출력
'개발etc' 카테고리의 다른 글
클린 코드(Clean Code) 란? (0) | 2022.10.03 |
---|---|
파일 동기화 - lsyncd (0) | 2021.10.04 |
MVC, MVVM 패턴 (0) | 2020.05.30 |
[VSCode] 유용한 플러그인 설치 및 설정 (0) | 2020.05.30 |
프로그래밍 명명 규칙 (Naming Rule) (0) | 2020.05.17 |