운영관리

linux에서 ipcs를 이용한 CUBRID의 Shared Memory 확인하는 방법

by seongjoon posted Mar 31, 2010

Shared Memory 프로세스와 프로세스간에 메모리를 공유하도록 하여, 프로세스간 정보를 쉽게 공유하거나 교환할 있도록 하여 줍니다.

CUBRID에서는 Shared Memory CUBRID Broker 사용합니다. Broker Shared Memory cub_cas 상태 정보를 저장하며, Shared Memory 저장된 cub_cas 상태 정보를 참조하여 응용 클라이언트와의 연결을 중계합니다. Shared Memory 저장된 cub_cas 상태 정보를 통해 System Administrator 어떤 cub_cas 작업을 수행중이며, 어떤 응용 클라이언트의 요청을 처리 중인지 확인을 있습니다.

 

리눅스에서 Shared Memory ipcs 명령을 통해서 확인 가능합니다. ipcs 명령어는 Shared Memory, Semaphore, Message Queues 자원을 사용하는 IPC(Inter Process Communication) 상태를 출력합니다.

아래는 ipcs 명령의 사용했을 때의 출력입니다.

 [imjoony83@newTest2 conf]$ ipcs

 

------ Shared Memory Segments --------

key        shmid      owner      perms      bytes      nattch     status     

0x00030001 6619137    imjoony83 644        1860       2                      

0x00030000 6651920    imjoony83 644        77832      6                      

0x00033000 6684693    imjoony83 644        77832      6                      

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems    

 

------ Message Queues --------

key        msqid      owner      perms      used-bytes   messages

이중 붉은 글씨로 Shared Memory key값은 CUBRID Broker 사용하는 Shared Memory 이며, 값은 $CUBRID/cubrid_broker.conf에서 MASTER_SHM_ID APPL_SERVER_SHM_ID 지정되어 있습니다. 30001, 30000, 33000 CUBRID 설치시 기본적으로 설정되는 값입니다. 자세히 보시면 아시겠지만 값은 10진수가 아니라 16진수 입니다.

[imjoony83@newtest3 conf]$ vi cubrid_broker.conf

 [broker]

MASTER_SHM_ID           =30001

ADMIN_LOG_FILE          =log/broker/cubrid_broker.log

 

[%query_editor]

SERVICE                 =ON

BROKER_PORT             =30000

MIN_NUM_APPL_SERVER     =5

MAX_NUM_APPL_SERVER     =40

APPL_SERVER_SHM_ID      =30000

LOG_DIR                 =log/broker/sql_log

ERROR_LOG_DIR           =log/broker/error_log

SQL_LOG                 =ON

TIME_TO_KILL            =120

SESSION_TIMEOUT         =300

KEEP_CONNECTION         =AUTO

 

[%BROKER1]

SERVICE                 =ON

BROKER_PORT             =33000

MIN_NUM_APPL_SERVER     =5

MAX_NUM_APPL_SERVER     =40

APPL_SERVER_SHM_ID      =33000

LOG_DIR                 =log/broker/sql_log

ERROR_LOG_DIR           =log/broker/error_log

SQL_LOG                 =ON

TIME_TO_KILL            =120

SESSION_TIMEOUT         =300

KEEP_CONNECTION         =AUTO

 

리눅스의 ipcs 명령을 통해 CUBRID Broker 사용하는 Shared Memory 다른 process 의해 사용되고 있는지 확인이 가능하며, 다른 processor 의해서 사용되고 있다면 CUBRID Broker 구동시 아래와 같은 에러가 발생합니다.

[imjoony83@newtest3 conf]$ cubrid broker start

@ cubrid broker start

query_editor: cannot create shared memory

++ cubrid broker start: fail

경우 ipcs 수행시켜 보면 CUBRID Broker 사용하는 Shared Memory Key 값이 사용중인 것을 있으며, CUBRID Broker 다른 Key 값을 사용하도록 cubrid_broker.conf 에서의 key 값을 수정하여야 합니다.


Articles

2 3 4 5 6 7 8 9 10 11