cubrid inside 5th session 2 ha implementation

24
CUBRID Heartbeat 구현 작성자: 남창우 소속팀 / 상위부서: DBMS 개발랩 작성년월일: 2009-11-25 문서범위(대외비)

Upload: cubrid

Post on 29-Jan-2018

1.979 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Cubrid Inside 5th Session 2 Ha Implementation

CUBRID Heartbeat 구현

작성자: 남창우

소속팀 / 상위부서: DBMS 개발랩

작성년월일: 2009-11-25

문서범위(대외비)

Page 2: Cubrid Inside 5th Session 2 Ha Implementation

목차

1. 배경

1.1 Linux Heartbeat

1.2 CUBRID HA

2. CUBRID Heartbeat 구현

2.1 개요

2.2 구조

2.3 시나리오 – Start Node

– Monitor

- Deregister

– Change Node

– Stop Node

Page 3: Cubrid Inside 5th Session 2 Ha Implementation

1. 배경

Page 4: Cubrid Inside 5th Session 2 Ha Implementation

4 / 파워포인트 문서 사용 안내

1.1 Linux Heartbeat

Linux Heartbeat

The Heartbeat program is one of the core components of the Linux-HA (High-Availability Linux)

project.

no fixed maximum number of nodes - Heartbeat can be used to build large clusters as well as

very simple ones

resource monitoring: resources can be automatically restarted or moved to another node on

failure

fencing mechanism to remove failed nodes from the cluster

현재 resource manager는 pacemaker 프로젝트로 분리

Page 5: Cubrid Inside 5th Session 2 Ha Implementation

5 / 파워포인트 문서 사용 안내

1.2 CUBRID HA

Slave NodeMaster Node

Heartbeat

cub_server

copylogdb

applylogdb

start/stop/monitor

start/stop/monitor/promote/demote

heartbeat

lrm

ccm Heartbeat

cub_server

copylogdb

applylogdb

lrm

ccm

Linux Heartbeat을 이용한 CUBRID HA 구성

Page 6: Cubrid Inside 5th Session 2 Ha Implementation

6 / 파워포인트 문서 사용 안내

1.2 CUBRID HA

Linux Heartbeat에 의한 문제점

Linux Heartbeat

+ CUBRID HA

복잡한 설정과

Linux Heartbeat

에 대한 이해 필요문제 발생 시 원인

분석 및 대처의

어려움

Linux Only

Page 7: Cubrid Inside 5th Session 2 Ha Implementation

2. CUBRID Heartbeat 구현

Page 8: Cubrid Inside 5th Session 2 Ha Implementation

8 / 파워포인트 문서 사용 안내

2.1 개요

목표 및 기대 효과

CUBRID HA 동작에 필요한 heartbeat 기능을 CUBRID 내에 구현

손쉬운 CUBRID HA 구

Heartbeat에 의한 문제 최소화

OS 의존성 제거

Page 9: Cubrid Inside 5th Session 2 Ha Implementation

9 / 파워포인트 문서 사용 안내

cub_master

2.2 구조

cub_master내 heartbeat 기능 구현

local resource

manager

local resource

receiver

cluster node

manager

heartbeat

receiver

TCP or Unix Domain Socket

Heartbeat

/UDP

local

resource

entries

cluster

node

entries

Page 10: Cubrid Inside 5th Session 2 Ha Implementation

10 / 파워포인트 문서 사용 안내

2.3 시나리오 – Start Node

new node

local process cub_master

node #1

cub_mastercub_master

other

cluster

node #1

node #n

cub_master

1. Join

2. Registration

Start Node

Join

• 새로 시작된 노드가 클러스터 멤버로 참여

Registration

• 로컬 관리 대상 리소스 프로세스의 등록

Page 11: Cubrid Inside 5th Session 2 Ha Implementation

11 / 파워포인트 문서 사용 안내

2.3 시나리오 – Start Node

new node

local process cub_master

node #1 (Master)

cub_mastercub_master

node #n (Slave)

cub_master

1. start

3. score calculation

join timeout

2. heartbeat

[ hello, slave]2. heartbeat

[ hello , slave]

Join

클러스터 멤버로 참여

클러스터 내 마스터 노드가 이미 있는 경우

Page 12: Cubrid Inside 5th Session 2 Ha Implementation

12 / 파워포인트 문서 사용 안내

2.3 시나리오 – Start Node

new node

local process cub_master

node #1 (unknown)

cub_mastercub_master

node #n (unknown)

cub_master

1. start

3. score calculation

join timeout

2. heartbeat

[ hello , slave]2. heartbeat

[ hello , slave ]

Join

클러스터 멤버로 참여

클러스터 내 마스터 노드가 없거나, 클러스터 내에서 최초로 시작된 노드인 경우

Page 13: Cubrid Inside 5th Session 2 Ha Implementation

13 / 파워포인트 문서 사용 안내

2.3 시나리오 – Start Node

local process

1. startup

cub_master

4. start monitor

2. HA_REGISTER request

3. HA_REGISTER response

[ process arguments, PID, UID, GID, … ]

[ resource-id ]

Registration

로컬 관리 대상 프로세스 등록

Page 14: Cubrid Inside 5th Session 2 Ha Implementation

14 / 파워포인트 문서 사용 안내

2.3 시나리오 – Monitor

Monitor

Cluster Node

• 클러스터 멤버 노드의 상태를 감시

• 마스터 노드의 상태가 비정상이면, 마스터 후보 노드가 Failover 수행

Resource Process

• 관리 대상 프로세스의 상태를 감시

• 관리 대상 프로세스의 장애가 감지되면, 해당 프로세스를 재 시작함

HA mode

• Master/Slave 프로세스의 현재 HA 모드를 감시

• 노드와 프로세스의 모드가 불일치하면, 모드 변경 요청

Page 15: Cubrid Inside 5th Session 2 Ha Implementation

15 / 파워포인트 문서 사용 안내

2.3 시나리오 – Monitor

node (slave)

local process cub_master

node #1 (master)

cub_master cub_master

node #n (slave)

cub_master

1. exchange

heartbeat

2. heartbeat

2. heartbeat

exchange

heartbeat

interval

3. score calculation

score

calculation

interval

[ monitor / current-status ]

[ monitor / current-status ]

Cluster Node

자체 Heartbeat 을 이용한 클러스터 멤버 노드 상태 감시

마스터 노드의 상태가 정상인 경우

Page 16: Cubrid Inside 5th Session 2 Ha Implementation

16 / 파워포인트 문서 사용 안내

2.3 시나리오 – Monitor

node (slave)

local process cub_master

node #1 (master)

cub_master cub_master

node #n (slave)

cub_master

1. exchange

heartbeat

2. heartbeat

2. heartbeat

exchange

heartbeat

interval

3. score calculation

score

calculation

interval

[ monitor / current-status ]

[ monitor / current-status ]

Cluster Node

자체 Heartbeat 을 이용한 클러스터 멤버 노드 상태 감시

마스터 노드에 장애가 발생한 경우

Page 17: Cubrid Inside 5th Session 2 Ha Implementation

17 / 파워포인트 문서 사용 안내

2.3 시나리오 – Monitor

local process cub_master

registration

1. process

down

2. detect process

failure

3. start processfork and execute4. process

started

5. confirm start

registration

confirm

process start

timer

close

Resource Process

로컬 리소스 프로세스 장애 감지 및 재 시작

Page 18: Cubrid Inside 5th Session 2 Ha Implementation

18 / 파워포인트 문서 사용 안내

2.3 시나리오 – Monitor

local process cub_master

2. HA_CHANGEMODE request

[ mode ]

1. check HA-mode

check

HA-mode

interval

3. HA_CHANGEMODE response

[ current-mode ]

HA mode

HA 모드가 설정된 프로세스의 상태 감시

마스터 노드에서 관리 대상 프로세스의 HA 모드가 ‘standby’ 인 경우

Page 19: Cubrid Inside 5th Session 2 Ha Implementation

19 / 파워포인트 문서 사용 안내

2.3 시나리오 – Deregister

local process cub_master

registration

2. remove process

entry and kill process3. SIGTERM

5. SIGKILL

dereg timeout

4. confirm dereg

process

1. execute stop

process

command

Deregister Local Process

더 이상 관리대상에 포함되지 않는 로컬 프로세스의 종료 및 등록 해제

Page 20: Cubrid Inside 5th Session 2 Ha Implementation

20 / 파워포인트 문서 사용 안내

2.3 시나리오 – Change Cluster

node

local

processcub_master

node #1

cub_mastercub_master

other cluster node

#1

node #n

cub_master

1. reconfigure cluster

2. reload cluster configuration

Reconfigure Nodes

클러스터 멤버 노드의 설정을 변경

Page 21: Cubrid Inside 5th Session 2 Ha Implementation

21 / 파워포인트 문서 사용 안내

2.3 시나리오 – Stop Node

node

local process cub_master

node #1

cub_master cub_master

other

cluster

node

#1

node #n

cub_master

1. Stop all local process

2. Leave cluster

3. Stop node

Stop Node

Stop all local processes

• 모든 로컬 리소스 프로세스 종료

Leave Cluster

• 클러스터 멤버 탈퇴

Stop Node

• cub_master 프로세스 종료

Page 22: Cubrid Inside 5th Session 2 Ha Implementation

22 / 파워포인트 문서 사용 안내

2.3 시나리오 – Stop Node

local process cub_master

registration

1. stop

process

2. SIGTERM

4. SIGKILL

dereg timeout

3. confirm dereg

process

Stop all resource processes

모든 로컬 관리 대상 프로세스 종료

Page 23: Cubrid Inside 5th Session 2 Ha Implementation

23 / 파워포인트 문서 사용 안내

2.3 시나리오 – Stop Node

node

local process cub_master

node

#1

cub_mastercub_master

other

cluster

node

#1

node #n

cub_master

1. leave cluster

2. heartbeat

[ bye, unknown ]2. heartbeat

[ bye, unknown ]

Leave Cluster

Cluster 탈퇴 절차 수행

Page 24: Cubrid Inside 5th Session 2 Ha Implementation

Thank you.