JAVA2015. 8. 7. 17:21

서버간의 파일을 공유 하고 싶을때 rsync나 scp를 활용 할 수 있다. 
이번에는 rsync에 대해서 알아 보도록 하자. 

우선 rsync를 사용하기 위해서는 rsync가 필요 하겠지? 패키지가 설치 되어 있는지 확인해 볼 필요가 있겠다. 


Server program install

# rpm -qa | grep rsync

없다면 

# yum install rsync


xinetd 패키지도 필요 하다. 

#  rpm -qa | grep xinetd

마찬가지로 없다면 

# yum install xinetd

사용할 준비는 되었다.


Server Setting

# vi /etc/xinetd.d/rsync 를 열어서 

disable = yes라고 되어 있는 부분을 no로 변경 하자.

# 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

}


Client Setting

이제는 환경 설정 파일을 만들어 줄 차례이다 

# vi /etc/rsyncd.conf


[bmrbt]                                                                  #rsync 서비스명

path=/svc/                                                            #경로

comment = rsync_channel_image

uid = svc

gid = svc

use chroot=yes

read only = no

host allow=114.202.131.248


max connections = 5

timeout=300



이제는 서비스를 재시작!!
# /etc/init.d/xinetd restart

기본 포트는 873 포트를 사용 한다. 포트가 막혔는지 telnet을 활용하여 확인하기 바랍니다. 


이제는 클라이언트 서버에서 명령어를 통해 파일을 송/수신을 받을 수 있다. 

rsync [옵션] [보낼파일 및 폴더] [받을 파일 및 폴더]

rsync -av WON 114.202.131.247::bmrbt/
rsync -av 114.202.131.247::bmrbt ./

이런 식으로... 

근데 만약에 이런 에러가 난다면... 
rsync: mkstemp "/.test.PZQvTe" (in BACKUP) failed: Permission denied (13)
나처럼 삽질 안하시길.... 

문제는 sellinux란 녀석 때문... 이건 리눅으세 보안을 관장하는 프로그램인데 이녀석이 활성화 되어 있으면 접근을 하지 못하게 된다. 따라서 이 부분을 비활성화 하면 되는데 비활성화 하는 방법은 

/etc/selinux/conf 파일에서

SELINUX=enforcing으로 되어 있는데  

SELINUX=disabled 로 변경 한다.


# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted


요로코롬...  변경하고 서버를 재부팅 한다. 

#reboot 또는 shutdown -r now


그런담에 다시 해 보시면.. 우왕... 신세계!! 









Posted by 원찬식
JAVA2015. 7. 22. 17:31
시스템이 처음 시작 될때... 
반드시 실행 되어야 하는 스케쥴이나 일련의 작업이 필요 할 경우 Spring에서 listener를 등록 해 주시면 됩니다. 

web.xml을 열어서 아래 내용을 추가해 주세요.


<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>


<listener>

<listener-class>com.laby.listener.InitListener</listener-class>

</listener>



그렇다면 initListener는? 


InitListener.java



Posted by 원찬식
RabbitMQ2015. 7. 22. 16:32
Posted by 원찬식