본문 바로가기

HTTP Session 관리/Oracle Coherence

[Coherence] standalone 설치 가이드 (14c) (Linux)

WebLogic 설치 시 패키지로 함께 설치되는 Coherence 외에도

 

Coherence 단독으로 설치하여 운영도 가능하다.

 


 

#. standalone Coherence 다운로드 페이지

https://www.oracle.com/kr/middleware/technologies/coherence-downloads.html

 


 

<Coherence 설치>

 

#01. silent 설치 스크립트

install_coherence.rsp 스크립트 생성.

ORACLE_HOME 옵션에 설치 경로 작성.

INSTALL_TYPE 옵션은 Typical로 하면 될듯.

실제 운영 시에는 Examples 파일들은 필요하지 않을 것이므로 최소한의 파일들만 가지고 가는 것이 편리하다.

[ENGINE]

#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0

[GENERIC]

#Set this to true if you wish to skip software updates
DECLINE_AUTO_UPDATES=true

#My Oracle Support User Name
MOS_USERNAME=

#My Oracle Support Password
MOS_PASSWORD=<SECURE VALUE>

#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
AUTO_UPDATES_LOCATION=

#Proxy Server Name to connect to My Oracle Support
SOFTWARE_UPDATES_PROXY_SERVER=

#Proxy Server Port
SOFTWARE_UPDATES_PROXY_PORT=

#Proxy Server Username
SOFTWARE_UPDATES_PROXY_USER=

#Proxy Server Password
SOFTWARE_UPDATES_PROXY_PASSWORD=<SECURE VALUE>

#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/app/coherence/coherence1411

#The federated oracle home locations. This should be an existing Oracle Home. Multiple values can be provided as comma seperated values
FEDERATED_ORACLE_HOMES=

#Set this variable value to the Installation Type selected. e.g. Typical, Typical With Examples.
INSTALL_TYPE=Typical

 


 

#02. 설치 실행 명령어

/usr/jdk/jdk1.8.0_202/bin/java -jar fmw_14.1.1.0.0_coherence.jar -silent -responseFile install_coherence.rsp -invPtrLoc oraInst.loc

 


 

#03. bug fix 패치

Coherence 서버 대상의 Oracle Patch도 존재한다.

14c 버전에서 크게 문제가 될 수 있는 버그들이 있어 최신 패치 유지가 중요할 듯 하다.

Coherence에 연동된 WebLogic 인스턴스 멤버 중 하나가 장애로 shutdown되면

다른 인스턴스에 연쇄적으로 문제가 생기는 등의 사례를 본 적 있음.

 


 

<Cluster 생성>

 

#01. cache-server.sh 수정

{COHERENCE_HOME}/bin 디렉토리의 cache-server.sh 스크립트를 수정한다.

 

맨 하단의 두 line을 수정한다.

 - ${JAVA_OPTS} 추가

 - $COHERENCE_HOME/lib/coherence-web.jar 추가

JAVA_OPTS="${JAVA_OPTS} -Xms$MEMORY -Xmx$MEMORY $JMXPROPERTIES"

$JAVAEXEC -server -showversion $JAVA_OPTS -cp "$COHERENCE_HOME/lib/coherence-web.jar:$COHERENCE_HOME/lib/coherence.jar" com.tangosol.net.DefaultCacheServer "$@"

 


 

#02. cluster 디렉토리 생성

WebLogic 에서는 각각의 업무를 Domain 이라는 용어로 구분하듯이,

Coherence 에서는 Cluster 라는 용어로 구분하는 듯 하다.

COHERENCE_HOME 디렉토리 하위에 clusters 라는 디렉토리를 생성하고

clusterA 라는 디렉토리를 생성하였다.

 


 

#03. config 파일 생성

cluster 이름, IP Address, port 번호 등의 옵션 값을 여기에 입력한다.

아래 config는 TCP 포트를 사용한 Unicast 방식을 사용하는 예시.

파일명은 자유롭게 설정 가능

<coherence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://xmlns.oracle.com/coherence/coherence-operational-config"
   xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-operational-config
   coherence-operational-config.xsd">
    <cluster-config>
        <member-identity>
            <cluster-name system-property="tangosol.coherence.cluster">clusterA</cluster-name>
        </member-identity>
        <unicast-listener>
            <well-known-addresses>
                <socket-address id="1">
                    <address>***.***.***.***</address>
                    <port>7000</port>
                </socket-address>
            </well-known-addresses>
            <address system-property="tangosol.coherence.localhost">***.***.***.***</address>
            <port system-property="tangosol.coherence.localport">7000</port>
        </unicast-listener>
    </cluster-config>
    <license-config>
        <edition-name system-property="tangosol.coherence.edition">GE</edition-name>
        <license-mode system-property="tangosol.coherence.mode">prod</license-mode>
    </license-config>
</coherence>

 


 

#04. 기동 스크립트 생성

JAVA_HOME 옵션을 명시하지 않으면 환경변수에 등록되어 있는 java를 사용하므로 주의.

Dtangosol.coherence.override 옵션에 앞서 작성한 config 파일 경로를 입력한다.

#java home
export JAVA_HOME=/usr/jdk/jdk1.8.0_202

#coherence home
COHERENCE_HOME=/app/coherence/coherence1411/coherence

#cluster properties
CLUSTER_NAME=clusterA
CLUSTER_HOME=/app/coherence/coherence1411/coherence/clusters/${CLUSTER_NAME}

#cluster options
JAVA_OPTS="${JAVA_OPTS} -Dtangosol.coherence.override=${CLUSTER_HOME}/${CLUSTER_NAME}.xml"
JAVA_OPTS="${JAVA_OPTS} -Dtangosol.coherence.cacheconfig=default-session-cache-config.xml"
JAVA_OPTS="${JAVA_OPTS} -Dtangosol.coherence.distributed.localstorage=true"
JAVA_OPTS="${JAVA_OPTS} -Dtangosol.coherence.session.localstorage=true"
JAVA_OPTS="${JAVA_OPTS} -Djava.net.preferIPv4Stack=true"
export JAVA_OPTS

#nohup ${COHERENCE_HOME}/bin/cache-server.sh >> ./${CLUSTER_NAME}.out 2>&1 &
${COHERENCE_HOME}/bin/cache-server.sh

 


 

<Coherence 프로세스 기동>

 

#. 기동 테스트

기동하면 다음과 같은 로그가 기록된다.

 


 

<Coherence - WebLogic 연동>

 

#01. WebLogic 서버에 Coherence 패치 적용 

WebLogic 서버에도 Coherence 서버에 적용한 패치를 동일하게 적용해주어야 한다.

WebLogic 인스턴스가 기동하면서 Coherence 서버와 통신하기 위해

{WEBLOGIC_HOME}/coherence/lib 디렉토리 내의 라이브러리를 사용하기 때문.

Coherence 서버 측과 동일한 라이브러리를 사용하도록 맞춰주는 것이 옳다고 판단된다.

 


 

#02. weblogic.xml 수정

어플리케이션 디렉토리 내 weblogic.xml 파일을 수정한다.

<persistent-store-type>coherence-web</persistent-store-type>

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
    <context-root>test</context-root>
    <session-descriptor>
        <persistent-store-type>coherence-web</persistent-store-type>
    </session-descriptor>
</weblogic-web-app>

 


 

#03. 기동 스크립트 수정

Coherence 서버와 통신하기 위해 아래 jvm options 을 추가한다.

#coherence
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.distributed.localstorage=false"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.session.localstorage=false"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.cluster=클러스터 이름"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.wka=클러스터 IP주소"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.wka.port=클러스터 TCP포트"
JAVA_OPTIONS="${JAVA_OPTIONS} -Dtangosol.coherence.mode=prod"

 


 

#04. WebLogic 프로세스 기동

어플리케이션이 deploy 되면서 Coherence 및 WebLogic 로그에 아래와 같은 내용이 기록된다.

Coherence cluster 의 멤버 구성원 정보가 출력된다.

멤버 구성원이 Coherence 서버인지 WebLogic 서버인지 알 수 있으며,

멤버 별 Coherence 패치 버전을 확인할 수 있다.