회사에서 아파치 + 톰캣 연결을 하는데. 여러개의 톰캣 인스턴스를 띄우기 위해서 6000번지부터 sequence하게 쭉 번호를 매기고 있다.

그런데, 특정 port에서 문제가 생겼다.

www계정으로 확인해보니. 다음과 같다.

프로세스가 안나타나서.. 당혹했지만..

 

 netstat -anp | grep 6051
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:6051                0.0.0.0:*                   LISTEN      -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33565             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33841             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33315             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33836             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33322             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33629             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33627             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33625             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33183             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33182             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33178             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33932             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33968             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33722             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33707             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33495             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33245             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33242             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33220             CLOSE_WAIT  -                  
tcp        1      0 127.0.0.1:6051              127.0.0.1:33737             CLOSE_WAIT  -                  
udp        0      0 0.0.0.0:6051                0.0.0.0:*               

 

 

root 계정으로 보니. 다행히 zagent라는 프로세스를 발견하였다.

 netstat -anp | grep 6051
tcp        0      0 0.0.0.0:6051                0.0.0.0:*                   LISTEN      6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33565             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33841             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33315             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33836             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33322             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33629             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33627             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33625             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33183             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33182             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33178             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33932             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33968             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33722             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33707             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33495             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33245             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33242             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33220             CLOSE_WAIT  6426/zagent        
tcp        1      0 127.0.0.1:6051              127.0.0.1:33737             CLOSE_WAIT  6426/zagent        
udp        0      0 0.0.0.0:6051                0.0.0.0:*                               6426/zagent    

 

아니 먼 일을 하길래, CLOSE_WAIT된 상태로 내비둔거얌.. TCP/IP 통신에서 CLOSE_WAIT는 종료하기 전에 종료 시그널을 받고 마지막 오케이만 받으면 해당 포트를 운영체제 맡겨 종료시키도록 하는 것이다.

 

그래서, zagent 환경설정파일을 보았다.

vi /etc/rc.d//init.d/zagent

#!/bin/sh

# chkconfig: 2345 99 10
# probe: true

[ -f /usr/sbin/zagent ] || exit 0

RETVAL=0

start() {
    echo -n "Starting zagent: "
    /usr/sbin/zagent -start >& /dev/null
    echo
}

stop() {
    echo -n "Shutting down zagent: "
    /usr/sbin/zagent -stop
    sleep 1
    /usr/sbin/zagent -kill
    echo
}

kill() {
    /usr/sbin/zagent -kill
}

restart() {
    stop
    sleep 1
    kill
    start
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        restart
        ;;
    *)
                echo "Usage: zagent {start|stop|restart}"
        exit 1
esac

exit $RETVAL

 

환경설정파일은

다음과 같다.

 

 vi /var/zagent/zagent.ini

USE_WATCHDOG = 1
USERID = admin
MANAGERIP1 = 222.122.201.111
MANAGERPORT1 = 6052
MANAGERIP2 = 222.122.201.112
MANAGERPORT2 = 6052
HOSTPORT = 6051
BUFFER_MEM = off
LOCALIP =
MAX_WORK_THREADS = 5
SAVEONOFF = 0
SAVEPERIOD = 0
MANAGERTYPE = 2
HOSTNUM = 0
HOSTID = 35107

 

오호라 포트 번호가 저렇게 되어 있구나..

 

아무도 해당포트를 안쓰는지 확인하고 포트번호는 8051, 8052로 바꿨다.

데몬 재시작한다.

 

 /etc/rc.d/init.d/zagent restart

 

그리고, 문제는 사라졌다.

 

'unix and linux' 카테고리의 다른 글

Bash 간단한 내용 정리  (0) 2007.10.09
zagent 좀비 프로세스.  (0) 2007.10.08
리눅스에서 최대 파일 크기는?  (0) 2007.10.05
파일시스템 타입 보기  (0) 2007.10.05
스카시 디스크 장비 보기  (0) 2007.10.01
Posted by '김용환'
,