Building Real-time CEP Application with Open Source Projects
Red Hat Forum 2012 - JBoss RHQ - Java Application Monitoring & Management Platform
1.
2. JBoss RHQ를 이용한
오픈소스 자바 애플리케이션 모니터링
KTH 원종석
JBoss User Group / RHQ Contributor
3. About Me
l Korea
JBoss
User
Group
커뮤니티 부운영자
– h/p://www.facebook.com/groups/jbossusergroup
l JBoss
RHQ
Evangelist
/
Contributor
-‐
한글화 작업
l tedwon.com
WIKI
운영
l 오픈 소스로 일하는 Java
개발자
l Hadoop
/
CEP기반 Big
Data
플랫폼 설계/개발/운영
l 현재 KTH에서 DAISY
데이터 분석 플랫폼 개발 중
4. Content
• RHQ Overview
• RHQ Architecture
• RHQ History
• JBoss ON
• Contributions
• Monitoring Practice
6. What is RHQ?
JBoss의 대표적인 Infrastructure Project
Open Source Management & Monitoring Project
7. In some cases
l 내가 만든 Java
Applica*on을 모니터링하고 싶다.
l 장기간
지속적으로...
Chart도 필요하고...
Sta*s*cs도 필요하고...
l 직접 만들려고 해보면 너무 일이 커지고
l 돈 주고 사기에는 너무 비싸고
l 손쉽게 공짜로 사용
할
수
있는
것
어디
없을까?
l 게다가 좀 더 체계적이고 다양한 기능을 제공했으면 좋겠다.
15. RHQ’d be one of the Solutions!
l 개발/운영 전체 라이프 사이클을 위한Enterprise
Management
PlaUorm
– 배포,
리소스 추가,
모니터링,
통지
16. What is RHQ?
l JBoss
Enterprise
Management
PlaUorm
l JBoss
Middleware
제품의 모니터링 PlaUorm
l JBoss
AS
l Infinispan
l HornetQ
l BlackTie
l Mobicents
l CirrAS
l Byteman
l Hibernate
l etc
...
17.
18. RHQ monitors any resources
l JBoss
제품 뿐만아니라 다른 모든 애플리케이션에 대해 모니터링 가능
l Apache
Web
Server
l Apache
Tomcat
Server
l Apache
Hadoop
Cluster
l Apache
Zookeeper
Cluster
l Apache
Ka;a
Cluster
l Apache
Flume
l Facebook
Scribe
Log
Aggregator
(C-‐daemon
provided
CLI)
l Etc...
19. What is RHQ?
l Make
technologies
more
manageable!!
– Aims
to
develop
a
common
services
management
plaAorm
l Java
기반의 Open
Source
System
Management
Project
– 설치 매우 용이
l 전세계의 수많은 Contributor들의 참여와 기여에 의해 개발 되고 있음
l 소규모 단일 노드부터 대규모 클러스터 모니터링에 적용 가능
21. RHQ Agent
l OS당 하나의 Agent
설치
l 각 Plugin은 특정 대상(resource)을 전담해서 모니터링
l DB
저장 없는 Standalone
Java
Instance
l 주기적으로 모니터링 정보를 수집하여 서버로 레포팅
l JBoss
RemoPng
프레임워크를 이용한 socket
통신
22. RHQ Agent Plugins
l 다양한 리소스를 위한 기본Plugin
제공
l Server
Plugins
l Apache,
Tomcat,
JBoss
AS
l RDBMS
Plugins
l MySQL,
PostgreSQL,
Oracle
l Java
JMX
Plugin
l C
daemon
프로세스 (Ex:
Scribe
Log
Aggregator)
l Shell
Script,
Pid
file,
Process
Query
l 필요에 맞는 Custom
Plugin
제작 가능
– 간단하게 또는 정교하게 개발 가능
l h/ps://docs.jboss.org/author/display/RHQ/Plugin+Community
23. SIGAR + JMX
RHQ 주요 모니터링 기술
l OS
플랫폼 별 SIGAR
API
활용
– SIGAR
API를 사용하여 System
InformaPon
Gathering
(CPU,
Memory)
l Java
표준 모니터링 스펙 JMX
활용
– JMX
기술 기반으로 원격 JVM
모니터링/관리 기능 제공 -‐
JMX
Plugin
24. What is JMX?
l Java 표준 모니터링 스펙 JMX 활용
l RHQ는 하나의 JMX 클라이언트
l http://goo.gl/BLHfM
JSR 160
Java Management Extensions
25. RHQ Implementation Techniques
l 대부분 JBoss
project
기술로 구현
l JBoss
AS
v4.2.3
l JBoss
Remo*ng
v2
l Hibernate
l JBoss
Web
/
TransacPons
/
Cache
/
SerializaPon
l JBoss
Seam
v2.1
/
RishFaces
l GWT
v2.4.0
l SmartGWT
v3.0
l Java
SE
6
Script
Features
for
RHQ
CLI
26. RHQ History
l 2005년
부터
시작한
Hyperic
&
Red
Hat
joint
project
l Hyperic이 SIGAR
API를 기반으로 프로젝트를 처음 시작
l Red
Hat이 확장 및 발전
l 2008년 2월 RHQ
1.0
배포
l Red
Hat
and
Hyperic
Launch
Common
Services
PlaUorm
Project
l RHQ
Project
Overview
l Red
Hat
RHQ
vs.
SpringSource
Hyperic
HQ
으로 발전 중
l RHQ에서 일부가 Jopr라는 프로젝트로 분리
l 2010년에 Jopr
프로젝트를 RHQ
프로젝트 하나로 통합
28. GNU General Public License
GNU Lesser General Public License
http://git.fedorahosted.org/cgit/rhq/rhq.git/tree/LICENSE
RHQ License
29. JBoss AS 5/6/7 Admin Console
l JBoss
AS
built-‐in
admin
console
l Embedded
Jopr
l 사실 RHQ
코드 재사용
l RHQ를 통해 더욱 자세한 관리 및 모니터링 가능
30. JBoss Operations Network
l RHQ
Commercial
Product
Version
l RHQ
유료 기술 지원 버전
l Code
base
동일
l Fully
quality-‐tested
&
cer*fied
by
Red
Hat
l JBoss
ON
으로 줄여서 호칭
l h/p://www.jboss.com/products/jbosson
l h/p://en.wikipedia.org/wiki/JBoss_operaPons_network
32. How to monitor My Java App
l Step
1.
RHQ
Server와 Agent
설치
l Step
2.
Java
ApplicaPon에 JMX
MBean
추가
l Step
3.
JMX
MBean정의에 맞춰서 Plugin
XML
파일 정의
l Step
4.
나의 ApplicaPon용 JMX
Plugin으로 RHQ
Server에 등록
l Step
5.
모니터링 및 관리 시작!!
Java JMX + RHQ XML = Menu 추가
Standard & Simplicity
33. Sample JMX Application
l Business
Class에 MBean
인터페이스 구현
public
class
MyJmxObject
implements
MyJmxObjectMBean
{
//
모니터링 하고자하는 대상 데이터 Ex:
throughput
public
double
getRandomNumber()
{
return
Math.random();
}
//
원격에서 실행하고자 하는 Opera*on
Ex:
start/stop
public
String
toUppercase(String
string)
{
return
(string
!=
null)
?
string.toUpperCase()
:
"";
}
}
34. Sample JMX Application
l MBean
인터페이스 정의
public
interface
MyJmxObjectMBean
{
//
모니터링 하고자하는 대상 데이터 Ex:
throughput
double
getRandomNumber();
//
원격에서 실행하고자 하는 Opera*on
Ex:
start/stop
String
toUppercase(String
string);
}
l JMX
OpPon
추가
java
-‐Dcom.sun.management.jmxremote.port=19999
-‐Dcom.sun.management.jmxremote.authen*cate=false
-‐Dcom.sun.management.jmxremote.ssl=false
-‐jar
./jmxapp.jar
53. RHQ Contributions
l Installer
UI
한글화
작업
완료
from
v4.2
l 메인 메뉴 GWT
UI
한글화
작업
진행
중
l RHQ
Plugin
개발
– h/ps://github.com/tedwon/apache-‐hadoop-‐rhq-‐plugin
– h/ps://github.com/tedwon/apache-‐kata-‐rhq-‐plugin
– h/ps://github.com/tedwon/apache-‐zookeeper-‐rhq-‐plugin
(Incomplete)
55. Motivations
l 모니터링 시스템 개발 공수
이슈
l 우리가 사용하는 리소스에 대한 측정
필요
l 장애
발생시
원인 파악에 도움
l 측정하는 습관
필요
l Measure-‐driven
Development
l A/B
test를 습관화하는 개발 문화
l Quality
향상
l 이러한 활동을 위한 인프라
제공
l 일종의 개발자의 무기
l Product
개발시 활용