rsync란 ?
작성자 정보
- 웹관리자 작성
- 작성일
컨텐츠 정보
- 13,248 조회
- 0 추천
- 목록
본문
rsync란 ?
원격지의 서버와 로칼의 데이터를 동기화 시켜주는 프로그램이다.
다시말하면 원격지서버의 각종 파일을  로칼의 지정위치에 시간 크기 내용 권한등을 
정확하게 일치하도록 해준다.
=========================================================================
원격지 서버에 설정하기
=========================================================================
1. 원격지 서버에 rsync 서버 설정하기
     - /etc/xinet.d/rsync 파일생성
      service rsync 
      { 
            disable = no 
            socket_type = stream 
            wait = no 
            user = root 
            server = /usr/bin/rsync 
            server_args = --daemon
            log_on_failure += USERID 
      }
2. /etc/service 파일에 추가
        rsync           873/tcp                         # rsync
        rsync           873/udp                         # rsync
3. /etc/rsyncd.conf 파일생성
      #motd = /etc/rsync.motd         # file : message of the day        
      uid = nobody                                                       
      gid = nobody                                                       
      use chroot = no                                                    
      max connections = 4                                                
      syslog facility = local5                                           
      pid file = /var/run/rsyncd.pid                                     
                                                                   
      [HOME]                                                       
              path = /home                    
              comment = home directory                         
              read only = false                                          
              uid = root                                               
              gid = root                                              
              auth users = wangsy                                        
              secrets file = /etc/rsyncd.secrets
4. /etc/rsyncd.secrets 파일 생성
      name:password
      chmod 0600 /etc/rsyncd.secrets
5. xinet.d 리스타트
/etc/rc.d/init.d/xinetd restart
=========================================================================
로칼서버에 설정하기 
=========================================================================
형식 : rsync [option] [src] [target]
ex) rsync -av test.net::HOME /home
      rsync -av test.net:/home /home
      rsync -av /home test.net::HOME 
      rsync -av /home test.net:/home
옵션 설명
  -v, --verbose                    상세하게 출력하기               
  -q, --quiet                        에러및 기타 어떠한 메시지도 출력 하지 말것
  -a, --archive                      아카이브 보드로 가져오기(퍼미션 소유주 및 위치까지 그대로 가져온다.) 
  -r, --recursive                    하위 구조의 디렉토리 모두 재귀적으로 가져온다.
  -z, --compress                   압축하여 전송하기       
  --delete    동기화시 소스 파일의 위치에 존재하지않는 팡리을 삭제한다.
  --exclude=patten  해당 패턴을 가진 파일이나 디렉토리를 동기화시 제외한다.  
  --include=patten  해당 패턴을 가진 파일이나 디렉토리를 동기화시포함시킨다.
주의 사항
 1. delete 옵션을 사용할 경우 충분한 테스트를 거친후 사용한다.
  소스위치에 없는 파일은삭제함으로 해당서버에서 삭제되어서는안될 파일은 exclude로 완벽하게 
  격리시켰는지 그런파일은없는지 꼭 확인해야한다 .
  어~~ 하는순간 파일은 사라진다.
 2. exclude 된파일은 include 되지않는다 
  웹서비스 같은경우 자주변하는파일을 동기화시 꼭확인해아한다 .
관련자료
- 
			이전
- 
			다음
 
								
