개인 저장용 블로그

Coherence Data Grid - First Coherence Application 구축 본문

Oracle Fusion Middleware/Coherence

Coherence Data Grid - First Coherence Application 구축

우엉잇 2022. 1. 26. 17:40

코히런스 예제를 진행함으로써 기본적인 코히런스 개념을 인지하고자 진행하였습니다. 

 

첫번째 코히런스 어플리케이션은 Coherence에 data를 key value 형태서 넣는 기초적인 어플리케이션 입니다. 

 

코히런스 파일 설정 변경 및 실행  

 

코히런스를 설치하고 ${COHERCNE_HOME}/bin/cohercne.sh 또는 cmd 파일에 들어가 
-Dcoherence.distributed.localstorage=false 부분을 True로 변경해 준다 

--> 테스트를 위해 데이터를 넣은 storage를 생성 

 

coherence 파일 실행 후 아래와 같이 

Map (?) : cache hello-example    

2022-01-26 17:20:59.620/207.295 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=main, member=1): Loaded cache configuration from "jar:file:/C:/ofm/weblogic/wls12214/coherence/lib/coherence.jar!/coherence-cache-config.xml"
2022-01-26 17:20:59.708/207.383 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=main, member=1): Created cache factory com.tangosol.net.ExtensibleConfigurableCacheFactory
2022-01-26 17:20:59.883/207.558 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=DistributedCache:PartitionedCache, member=1): Service PartitionedCache joined the cluster with senior service member 1
2022-01-26 17:20:59.896/207.571 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=DistributedCache:PartitionedCache, member=1): Service PartitionedCache: sending PartitionConfig ConfigSync to all
2022-01-26 17:20:59.926/207.601 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=DistributedCache:PartitionedCache, member=1): This member has become the distribution coordinator for MemberSet(Size=1
  Member(Id=1, Timestamp=2022-01-26 17:17:49.172, Address=비밀:62466, MachineId=64085, Location=process:17416, Role=CoherenceConsole)
  )
2022-01-26 17:20:59.964/207.639 Oracle Coherence GE 12.2.1.4.0 <Info> (thread=DistributedCache:PartitionedCache, member=1): Partition ownership has stabilized with 1 nodes

Cache Configuration: hello-example
  SchemeName: near-direct
  ServiceName: LocalCache
  FrontScheme (LocalScheme)
    HighUnits
      Units: 10000
    UnitFactor: 1
  BackScheme (DistributedScheme)
    SchemeName: thin-direct
    ServiceName: PartitionedCache
    ServiceDependencies
      EventDispatcherThreadPriority: 10
      ThreadPriority: 10
      WorkerThreadsMax: 2147483647
      WorkerThreadsMin: 1
      WorkerPriority: 5
      ActionPolicyBuilder
        RulesArray (ArrayList of QuorumRule)
          [0]
            RuleElementName: distribution-quorum
            RuleMask: 1
          [1]
            RuleElementName: restore-quorum
            RuleMask: 2
          [2]
            RuleElementName: recover-quorum
            RuleMask: 16
          [3]
            RuleElementName: read-quorum
            RuleMask: 4
          [4]
            RuleElementName: write-quorum
            RuleMask: 8
      Backups: 1
      DistributionAggressiveness: 20
      DistributionSynchronized: true
      OwnershipCapable: true
      Partitions: 257
      BldrsPartitionListener
      AssignmentStrategyBuilder
        Strategy: simple
      TransferThreshold: 524288
      DepsPersistence
        PersistenceBuilder: Mode: on-demand
        Active Location: C:\Users\User\coherence\active
        Snapshot Location:C:\Users\User\coherence\snapshots
        Trash Location:C:\Users\User\coherence\trash
      StrictPartitioning: true
    BackingMapScheme
      InnerScheme (LocalScheme)
        UnitFactor: 1
    BackupConfig
      InitialSize: 1MB
      MaximumSize: 1GB
  InvalidationStrategy: auto

Map (hello-example): list 

 

HelloWorld.java

아래와 같이 Java Project에서 HelloWorld Class를 생성해 준다. 

* External Libraries에 ${COHERCNE_HOME}/lib/coherence.jar 등록 필요 

 

이후 RUN을 하면 이전에 실행했던 코히런스에 멤버가 조인이 되면서 key = value 형식으로 데이터를 넣는다. 

 

데이터 확인 

list 를 입력하면 입력된 데이터를 확인 할 수 있습니다. 

 

자세한 내용은 아래 오라클 문서에서 확인 하면 됩니다. 

https://docs.oracle.com/middleware/1221/coherence/develop-applications/gs_example.htm#COHDG5046