이 글은 Coherence-WEB 기준이다.
https://billy727.tistory.com/207
위 방법을 통해 coherence를 따로 설치해준 이후, xml 파일을 생성하여 WebLogic과 연동하는 방법도 존재하나, 같이 설치되는 coherence와의 연동 설정 방법을 정리해본다.
1. coherence cluster 생성 (admin console) : Coherence Inner 추천!!
- weblogic.xml 설정 : persistent-store-type을 coherence-web으로 ~
https://billy727.tistory.com/26 -> 참고
서버 생성 (cache server, weblogic instance)
- coh : 코히런스를 위한 서버
- test1, test2 : 웹로직 인스턴스
☆☆ coherence 한 서버당 웹로직 인스턴스는 3~4개를 추천한다.
=> 이유는 가령 60씩 잡고있는 인스턴스 2개만 존재할때 한 서버가 fail 되면 남은 서버가 120을 받아서 연달아 fail. 하지만 3개인 경우 30씩 나눠가지니 {0 /90 /90} 으로 살아남는다.
# 캐시 서버 (coh) 에 대한 설정
- 로컬 저장은 -Dtangosol.coherence.distributed.localstorage=true 에 대한 옵션임
- Coherence 웹 로컬 저장 영역이 사용으로 설정됨 : Coherence 웹 클러스터 멤버에 대해 로컬 저장소가 사용으로 설정되었는지 여부를 지정
캐시 서버가 아닌 웹로직 인스턴스의 경우 일관성 페이지가 다음과 같이 나타나는 것이 맞다.
웹로직 클러스터 생성
- 코히런스 멤버 조인을 희망하는 운영 웹로직 인스턴스를 클러스터에 추가해준다.
☆☆ 클러스터에 추가하지 않는 경우
=> 각각의 웹로직 인스턴스가 캐시서버로 사용이 된다. 따라서 해당 인스턴스에 운영을 한다고 하면 캐시 + 운영이 되기에 heap memory를 많이 잡아먹을 것이다. 우리의 목표는 캐시 서버를 따로 생성해놓고 운영 인스턴스는
'멤버'로 활용되는 것이다.
Coherence Cluster 생성
Coherence Cluster를 생성해준다. 멤버는 캐시서버 + 멤버로 쓰이고자 하는 인스턴스가 넣어져 있는 웹로직 클러스터 추가.
>>>> 순서가 중요하다. WebLogic 클러스터 먼저 설정해주고 Coherence 구성에 추가해줘야 한다. 그렇지 않다면 Coherence cluster 멤버를 다시 업데이트 해야지 인식이 된다.
=================================================================================
2. 별도의 coherence process (script)
=> 이 방법을 사용 시, 이기종 (ex> Tomcat ~ Coherence) 설정도 가능하다.
## cache-server.sh 경로 : ${ENGINE_HOME}/coherence/bin cache-server.sh가 default로 있지만, 스크립트를 위해 다음과 같이 스크립트 추가 |
위 JAVA_OPTS는 다음과 같은 것을 의미한다.
JAVA_OPTS="${JAVA_OPTS} -Dcoherence.cacheconfig=default-session-cache-config.xml" => default-session-cache-config.xml를 따로 생성해줘야 함. JAVA_OPTS="${JAVA_OPTS} -Dcoherence.session.localstorage=true" => session 객체의 저장소 (coherence에 저장 true) JAVA_OPTS="${JAVA_OPTS} -Dcoherence.cluster=test_cluster" => 클러스터 이름 JAVA_OPTS="${JAVA_OPTS} -Dcoherence.clusteraddress=192.168.56.242" => 멀티캐스트 IP JAVA_OPTS="${JAVA_OPTS} -Dcoherence.clusterport=14199" => 멀티캐스트 port JAVA_OPTS="${JAVA_OPTS} -Dcoherence.ttl=1" => TTL $JAVAEXEC -server -showversion -cp "$COHERENCE_HOME/lib/coherence.jar:${COHERENCE_HOME}/lib/coherence-web.jar:" $JAVA_OPTS com.tangosol.net.DefaultCacheServer $1 => 'coherence-web.jar'를 추가함 |
또한 default-session-cache-config.xml를 같은 경로에 생성하는데 내용은 다음과 같다.
<?xml version="1.0"?> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- --> <!-- Cache configuration descriptor for Coherence*Web --> <!-- --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd"> <scope-name>oracle.coherence.web</scope-name> <caching-scheme-mapping> <!-- The clustered cache used to store Session management data. --> <cache-mapping> <cache-name>session-management</cache-name> <scheme-name>replicated</scheme-name> </cache-mapping> <!-- The clustered cache used to store ServletContext attributes. --> <cache-mapping> <cache-name>servletcontext-storage</cache-name> <scheme-name>replicated</scheme-name> </cache-mapping> <!-- The clustered cache used to store Session attributes. --> <cache-mapping> <cache-name>session-storage</cache-name> <scheme-name>session-distributed</scheme-name> </cache-mapping> <!-- The clustered cache used to store the "overflowing" (split-out due to size) Session attributes. Only used for the "Split" model. --> <cache-mapping> <cache-name>session-overflow</cache-name> <scheme-name>session-distributed</scheme-name> </cache-mapping> <!-- The local cache used to store Sessions that are not yet distributed (if there is a distribution controller). --> <cache-mapping> <cache-name>local-session-storage</cache-name> <scheme-name>unlimited-local</scheme-name> </cache-mapping> <!-- The local cache used to store Session attributes that are not distributed (if there is a distribution controller or attributes are allowed to become local when serialization fails). --> <cache-mapping> <cache-name>local-attribute-storage</cache-name> <scheme-name>unlimited-local</scheme-name> </cache-mapping> </caching-scheme-mapping> <caching-schemes> <!-- Replicated caching scheme used by the Session management and ServletContext attribute caches. --> <replicated-scheme> <scheme-name>replicated</scheme-name> <service-name>ReplicatedSessionsMisc</service-name> <request-timeout>30s</request-timeout> <backing-map-scheme> <local-scheme> <scheme-ref>unlimited-local</scheme-ref> </local-scheme> </backing-map-scheme> <autostart>true</autostart> </replicated-scheme> <local-scheme> <scheme-name>session-front</scheme-name> <eviction-policy>HYBRID</eviction-policy> <high-units>1000</high-units> <low-units>750</low-units> </local-scheme> <distributed-scheme> <scheme-name>session-distributed</scheme-name> <service-name>DistributedSessions</service-name> <thread-count system-property="coherence.session.threads">4 </thread-count> <lease-granularity>member</lease-granularity> <local-storage system-property="coherence.session.localstorage"> false</local-storage> <partition-count>257</partition-count> <backup-count>1</backup-count> <request-timeout>30s</request-timeout> <backing-map-scheme> <ramjournal-scheme> <high-units system-property="coherence.session.highunits"/> <unit-calculator>BINARY</unit-calculator> </ramjournal-scheme> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> <!-- Local caching scheme definition used by all caches that do not require an eviction policy. --> <local-scheme> <scheme-name>unlimited-local</scheme-name> <service-name>LocalSessionCache</service-name> </local-scheme> <!-- Clustered invocation service that manages sticky session ownership. --> <invocation-scheme> <service-name>SessionOwnership</service-name> <request-timeout>30s</request-timeout> </invocation-scheme> </caching-schemes> </cache-config> |
# 생성한 cache-server.sh를 실행한다.
coherence로 연동하고자 하는 WebLogic 기동 script에도 같은 내용을 추가해준다.
또한 해당 서버에 배포한 application에 다음과 같은 설정을 한다. (weblogic.xml)
# 테스트 결과
유지되는 것을 확인.
(참조 : https://with-kami.tistory.com/1534841?category=755124)
※ multicast 주소는 임의로 설정한 주소이다. 설정 시에는 맞게 설정해야 한다.
'Oracle > Middleware' 카테고리의 다른 글
Coherence 클러스터 기본 (0) | 2022.09.14 |
---|---|
JEUS 기초 안내 자료 (0) | 2022.06.14 |
JEUS 기초 (0) | 2022.06.03 |