Jihoon's IT Development

Web Developer's Hobby Development Notes

Spring Boot와 함께하는 Pivotal Gemfire 간단예제(1)

목차

  1. Pivotal Gemfire 다운로드 및 설치, 기본 설정
  2. Spring Boot를 이용한 Gemfire 이용

갑작스럽지만 애플리케이션의 Cache를 담당해주던 Redis를 Pivotal Gemfire 로 변경하기로 했다.

이런 결정에는 몇가지 이유가 존재했는데.

  • 현재 프로젝트에서 사용하는 클라우드 환경은 PCF(Pivotal Cloud Foundry)로 Gemfire를 기반으로 하는 PCC(Pivotal Cloud Cache)를 간편하게 서비스로 등록 및 사용할 수 있다.
  • 여건상 Redis 를 사용할 경우 PCF 환경의 외부에 Redis 서버가 존재할 수 밖에 없었다.

이왕 Pivotal 제품인 PCF 를 쓰는거 끝까지 Pivotal 제품을 사용하기로 맘 먹은 부분도 크다. (기술 지원의 일원화?!)

1.1. Pivotal Gemfire 란

Pivotal GemFire는 글로벌 레벨로 데이터 동기화가 가능한 인 메모리 데이터 그리드(In-Memory Data Grid)다. 오픈소스 버전으로는 Apache Geode가 존재한다.

주요기능을 요약하자면 다음과 같다.

  • 읽기-쓰기 처리량이 높음.(High Read-and-Write Throughput)
  • 대기 시간이 낮으면서 예측 가능.(Low and Predictable Latency)
  • 높은 확장성.(High Scalability)
  • 지속적인 가용성.(Continuous Availability)
  • 안정적인 이벤트 알림.(Reliable Event Notifications)
  • 데이터 저장소 상의 병렬화 된 애플리케이션 동작.(Parallelized Application Behavior on Data Stores)
  • 비공유 데이터 지속성.(Shared-Nothing Disk Persistence)
  • 소유 비용 절감(Reduced Cost of Ownership)
  • 클라이언트 / 서버를위한 단일 홉 기능(Single-Hop Capability for Client/Server)
  • 클라이언트 / 서버 보안(Client/Server Security)
  • 멀티 사이트 데이터 배포(Multisite Data Distribution)
  • 연속 쿼리(Continuous Querying)
  • 이기종 데이터 공유(Heterogeneous Data Sharing)

참고 : Gemfire Main Features

단순 Cache로 쓰기에는 넘쳐 흐르는 기능이 아닐 수 없다.

1.2. Gemfire 다운로드

Windows 운영체제 기반으로 설명한다.
나머지 운영체제의 설치는 여기서 확인 가능하다.

  • Pivotal 홈페이지에서 Gemfire 최신버전 다운로드
  • 원하는 폴더로 압축파일을 해제
  • bin 폴더를 path 에 추가.

1.3. GFSH 실행 및 로컬 실행

  • 명령 프롬프트 창 열기
  • gfsh(Gemfire Shell) 실행
1
2
3
4
5
6
7
8
9
10
11
12
Microsoft Windows [Version 10.0.18362.476]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\park>gfsh
_________________________ __
/ _____/ ______/ ______/ /____/ /
/ / __/ /___ /_____ / _____ /
/ /__/ / ____/ _____/ / / / /
/______/_/ /______/_/ /_/ 9.9.0

Monitor and Manage Pivotal GemFire
gfsh>

간단하다.

실행을 위해서는 locator 와 server 를 기동해야 한다.

  • locator 기동

gfsh>start locator --name=locator1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
gfsh>start locator --name=locator1
Starting a Geode Locator in C:\Users\park\locator1...
..
Locator in C:\Users\park\locator1 on park-PC[10334] as locator1 is currently online.
Process ID: 19028
Uptime: 1 minute 1 second
Geode Version: 9.9.0
Java Version: 1.8.0_77
Log File: C:\Users\park\locator1\locator1.log
JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: D:\workspace\pivotal-gemfire-9.9.0\lib\geode-core-9.9.0.jar;D:\workspace\pivotal-gemfire-9.9.0\lib\geode-dependencies.jar

Successfully connected to: JMX Manager [host=park-PC, port=1099]

Cluster configuration service is up and running.
  • server 기동

gfsh>start server --name=server1

1
2
3
4
5
6
7
8
9
10
11
gfsh>start server --name=server1
Starting a Geode Server in C:\Users\park\server1...
..
Server in C:\Users\park\server1 on park-PC[40404] as server1 is currently online.
Process ID: 10964
Uptime: 1 minute 1 second
Geode Version: 9.9.0
Java Version: 1.8.0_77
Log File: C:\Users\park\server1\server1.log
JVM Arguments: -Dgemfire.default.locators=192.168.0.6[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true -XX:OnOutOfMemoryError=taskkill /F /PID %p -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
Class-Path: D:\workspace\pivotal-gemfire-9.9.0\lib\geode-core-9.9.0.jar;D:\workspace\pivotal-gemfire-9.9.0\lib\geode-dependencies.jar
  • locator와 server 기동 확인

gfsh>list members

1
2
3
4
5
6
7
gfsh>list members
Member Count : 2

Name | Id
-------- | ---------------------------------------------------------------
locator1 | 192.168.0.6(locator1:19028:locator)<ec><v0>:41000 [Coordinator]
server1 | 192.168.0.6(server1:10964)<v1>:41001

여기까지가 Gemfire 기동 준비다.

다음에는 Gemifre 의 Table 이라고 할 수 있는 region 생성과 간단히 Spring Boot 를 이용한 Spring Data Gemfire Cache 샘플 프로젝트를 만들어 보겠다.