Pacemaker The Open Source, High Availability Cluster

Research Institute for Software technology OpenSource Technical Team | Kim, donghyun Saturday, July 23, 2016 한국 리눅스 사용자 그룹 [email protected] Korea User Group

# Whoami

Systems and Infrastructure Geek Enterprise Linux Infrastructure Engineer ()

Work - Technology Research

- Technical Support : Troubleshooting, Debugging, Performace Tuning…..

- Consulting : Linux (Red Hat, SUSE, OEL), Virtualization, High-Availability......

Hobby - Trevelling - Drawing (cartoon)

I love linux ♥

- Blog : http://rhlinux.tistory.com/

- Café : http://cafe.naver.com/iamstrong

- SNS : https://www.facebook.com/groups/korelnxuser

제3회 난공불락 오픈소스 인프라세미나 1 In this Session

 Pacemaker’s Story - The Open Source, High Availability Cluster

 Overview of HA architectural components

 Use case examples

 Future endeavors

제3회 난공불락 오픈소스 인프라세미나 2 Pacemaker - The Open Source, High Availability Cluster

제3회 난공불락 오픈소스 인프라세미나 3 HA for OpenSource Technology

제3회 난공불락 오픈소스 인프라세미나 4 “Mission Critical Linux”

제3회 난공불락 오픈소스 인프라세미나 5 High-Availability Clustering in the Open Source Ecosystem

https://alteeve.ca/w/High-Availability_Clustering_in_the_Open_Source_Ecosystem

2014s ~ 2010s ~ . Pacemaker 1.1.10, released with RHEL6.5 . 2010s, Pacemaker version 1.1 . Red Hat 에서는 기존 cman과rgmanager 방식을 RHEL6 - CIB (Cluster Information Base, XML Configure) - Red Hat’s “cman” Support 라이프사이클이 종료되는 시점(2020년)까지 지원예정 - SLES11 SP1 (OpenAIS to Corosync) . Global Vendors 간 기술 협약을 통해 적용범위 확대 - Hawk, a web-based . 오늘날, Clusterlabs는 Heartbeat Project 에서생성된 . 2010, Pacemaker added support for cman Component들과 다른 솔루션형태로 빠르게 통합 및 변화 . Heartbeat project reached version 3

2006s 2008s . 2005, RedHat’s cman+rgmanager . 2007, Pacemaker (Heartbeat v 2.1.3) (RHCS, Cluster Services version 2) - Heartbeat package called "Pacemaker“ . 2007s, two projects remained entirely separate until 2007 . 2008s, SUSE 및 레드햇 개발자 모두 몇 가지 코드를 재사용 when, out of the Linux HA project, Pacemaker was born as a 논의에 대해 비공식 회의 cluster resource manager that could take membership from - SUSE's CRM/pacemaker and communicate via Red Hat's OpenAIS or SUSE's Heartbeat. - Red Hat's OpenAIS . 1998–2007s, Heartbeat Old Linux-HA cluster manager . 2008, Pacemaker version 0.6.0 was release - Alan Robertson - support for OpenAIS

. 2009s, “Corosync” 새로운 Project 발표

2004s 2002s 1998s . 2002, REDHAT "Red Hat Cluster Manager" Version 1 - RHEL2.1 . 1990s, 오픈 소스 고가용성 플랫폼을 만들 수있는 두 개의 완전히 독립적 인 . 2003, SUSE's Lars Marowsky-Brée conceived of a new project 시도는 1990년대 후반에 시작 called the "crm" - SUSE's "Linux HA" project . 2003, Red Hat purchased Sistina Software ‘GFS’ - Red Hat's “Cluster Services" . 2004, Cluster Summit에 SUSE와 Red Hat developers 함께 참석 . 1998s, "Heartbeat“ 불리우는 새로운 프로토콜 'Linux-HA'프로젝트, 이후 heartbeat v1.0 발표 . 2004, SUSE, in partnership with Oracle, released OCFS2 . 2000s, “Mission Critical Linux” . 2005, "Heartbeat version 2“released . 2000s, ‘Sistina Software’ 회사 창립 “Global File System”

제3회 난공불락 오픈소스 인프라세미나 6 OpenSource Project Progress

Hwak (GUI) pcs_gui luci Pacemaker -mgmt booth pcs crmsh

pacemaker pacemaker rgmanager

resource -agents

fence- agents cluster-glue cman Heartbeat corosync

Linux-HA / ClusterLabs SLES HA RHEL HA Add-on

Community Novell Red Hat Developer Developer Developer

제3회 난공불락 오픈소스 인프라세미나 7 Architectural Software Components

Corosync:

- Messaging(framework) and membership service.

Pacemaker:

- Cluster resource manager

Resource Agents (RAs):

- 사용가능한 서비스를 구성/관리 및 모니터링

Fencing Devices:

- Pacemaker에서 fencing 을 STONITH라 부름

User Interface:

- crmsh (Cluster Resource Manager Shell) CLI tools and Hawk web UI (SLES)

- pcs (Pacemaker Configuration System) CLI tools and pcs_gui (RHEL)

제3회 난공불락 오픈소스 인프라세미나 8 More ….

LVS : (=Keepalive)

- Kernel space, Layer 4, ip + port.

HAproxy :

- user space, Layer 7, HTTP based.

Shared filesystem :

- OCFS2 / GFS2

Block device replication :

- DRBD, cLVM mirroring, Cluster md raid1

제3회 난공불락 오픈소스 인프라세미나 9 Pacemaker : the resources manager

Pacemaker (Python-based Unified, scriptable, cluster shell)

- 리눅스플랫폼을 위한 고가용성과 로드밸런싱 스택 제공

- Resource Agents(RAs)를 통한 Application 간 상호작용을 통한 설정이 가능

클러스터 리소스의 정책을 사용자가 직접 결정

- Resource Agents 설정을 만들고 지우고 변경하는 것에 대한 자유로움

- 여러 산업 (공공, 증권/금융, 통신 등)환경의 어플리케이션에서 요구하는 HA조건들을 대체로 만족

- 리소스형태 fence agents 설정관리 용이

Monitor and Control Resource :

- SystemD / LSB / OCF Services

- Cloned Services : N+1, N+M, N nodes

- Multi-state (Master/Slave, Primary/Secondary)

STONITH (Shoot The Other Node In The Head) :

- Fencing with Power Management

제3회 난공불락 오픈소스 인프라세미나 10

Pacemaker - Architecture Component

Resource Agents - Agent Scripts Resource Agents - Open Cluster Framework

LRMd PEngine

Pacemaker Stonithd CRMd CIB - Resource Management

Cluster Abstraction Layer

Corosync - Membership Corosync - Messaging - Quorum

제3회 난공불락 오픈소스 인프라세미나 11 Pacemaker - High level architecture

Resource Agents RAs

Services Resources Layer (Apache, PostgreSQL 등) Local Cluster Policy Resource Information Engine CIB (복제) Manager Base LRM

XML XML

CRM Cluster Resource Manager Resource Allocation Layer

Corosync Corosync

Messaging / Infrastructure Layer Cluster Cluster Node #1 Node #2

제3회 난공불락 오픈소스 인프라세미나 12 Quick Overview of Components - CRMd

CRMd (Cluster Resource Management daemon)

- main controlling process 역할 담당 RA RA RA

Resource Layer - 모든 리소스 작업을 라우팅해주는 데몬 LRM PE - Resource Allocation Layer내에서 동작되는 모든 동작 처리

CIB STONITH CRM (XML) - Maintains the Cluster Information Base (CIB) Resource Allocation Layer

- CRMd에 의해 관리된 리소스는 필요에 따라 클라이언트 시스템에 Corosync 전달, 쿼리되거나 이동, 인스턴스화, 변경 Messaging/Infrastructure Layer

제3회 난공불락 오픈소스 인프라세미나 13 Quick Overview of Components - CIB

CIB (Cluster Information Base)

- 설정 정보 관리 데몬. XML파일로 설정 (In-memory data) RA RA RA

Resource Layer - DC(Designated Co-ordinator)에 의해 제공되는 각 노드별 LRM 설정내용 및 상태 정보를 동기화 PE

- CIB 은 cibadmin 명령어를 사용하여 변경할수 있고, crm shell CIB STONITH CRM 또는 pcs utility 사용 (XML)

Resource Allocation Layer

Corosync

Messaging/Infrastructure Layer

제3회 난공불락 오픈소스 인프라세미나 14 Quick Overview of Components - PEngine

PEngine (PE or Policy Engine)

- PE프로세스는 각 노드에서 실행되지만, DC[1]에서만 활성화 RA RA RA

Resource Layer - 여러 서비스환경에 따라 Clone 및 domain 등 사용자요구에 따라 LRM 정책 부여 PE

- 다른 클러스터 노드로 리소스 전환시 의존성 확인 CIB STONITH CRM (XML)

Resource Allocation Layer

Corosync

Messaging/Infrastructure Layer

[1] DC = Designated Controller (master node)

제3회 난공불락 오픈소스 인프라세미나 15 Quick Overview of Components - LRMd

LRMd (Local Resource Management Daemon)

- CRMd와 각 리소스 사이에 인터페이스 역할을 수행하며, RA RA RA

CRMd의 명령을 agent에 전달 Resource Layer

LRM - CRM을 대신하여 자기 자신의 RAs(Resource Agents) 호출 PE

- CRM수행되어 보고된 결과에 따라 start / stop / monitor를 동작 CIB STONITH CRM (XML)

Resource Allocation Layer

Corosync

Messaging/Infrastructure Layer

제3회 난공불락 오픈소스 인프라세미나 16 Quick Overview of Components - Resource Agents (1/2)

RAs (Resource Agents) 는 클러스터리소스를 위해 정의된 규격화된 인터페이스

- local resource의 start / stops / monitors 스크립트 제공 RA RA RA

- RAs(Resource Agents)는 LRM에 의해 호출 Resource Layer

Pacemaker support three types of RA’s : LRM PE - LSB : Linux Standard Base “init scripts”

• /etc/init.d/resource CIB STONITH CRM - OCF : Open Cluster Framework (LSB Resource agents 확장자) (XML) Resource types : Standard:provider:name Resource Allocation Layer • /usr/lib/ocf/resource.d/heartbeat

• /usr/lib/ocf/resource.d/pacemaker Corosync - Stonith Resource Agents Messaging/Infrastructure Layer

Resource = Service http://linux-ha.org/wiki/OCF_Resource_Agent clone = multiple instances of a resource http://linux-ha.org/wiki/LSB_Resource_Agents https://github.com/ClusterLabs/resource-agents ms = master-slave instances of a resource

수백만명의 많은 Contributer 들이 여러 Application환경에 적용될수 있도록 github 통해 배포

제3회 난공불락 오픈소스 인프라세미나 17 Quick Overview of Components - Resource Agents (2/2)

기본적으로 Resource Agents 제공되어지는 기능:

- start / stop / monitor

- Validate-all : resource 설정 확인

- Meta-data : Resource Agents 대한 정보를 스스로 회신 (GUI or Other tools)

OCF Resource Agents를 통해 제공되는 추가 기능

- promote : master/ Primary

- demote : slave/secondary

- Notify : 이벤트 발생된 리소스를 사전에 클러스터 에이전트를 통해 통보하여 알림

- Reload : 리소스 설정정보를 갱신

- Migrate_from/migrate_to : 리소스 live migration 수행

Resource scores 값의 의미

- 대부분 리소스는 Score가 정의되어 있지만 종종 지정되어 있지 않은 경우가 있음

- 어느 Cluster nodes에서 리소스가 사용되고 결정되어지는 경우 필요

- Higfest Score INF (1.000.000), lowest score –INF(-1.000.000)

- 해당 값의 Positive의미는 “Can run”, Negative한 의미로는 “Can not run” +/-INF 변경값으로 “can 또는 must” 가능

제3회 난공불락 오픈소스 인프라세미나 18 Quick Overview of Components - STONITHD (1/2)

STONITHD “Shoot The Other Node In The Head Daemon”

- fence node에서 사용되는 서비스 데몬 RA RA RA

Resource Layer - Pacemaker의 fencing agents LRM PE - 일반적인 클러스터 리소스로써 모니터링

CIB STONITH CRM (XML) - STONITH-NG는 STONITH 데몬의 다음 세대로 모니터링, 알림 및 기타 기능 제공 Resource Allocation Layer

Corosync

Messaging/Infrastructure Layer

제3회 난공불락 오픈소스 인프라세미나 19 Quick Overview of Components - STONITHD (2/2)

Application-level fencing 설정 가능

- Pacemaker 에서 직접 fencing 조정

- fenced (X)  stonithd (O)

실무에서 가장 많이 사용되는 fence devices :

- APC PDU (Networked Power Switch)

- HP iLO, Dell DRAC, IBM IMM, IPMI Appliance 등

- KVM, Xen, VMware (Software library)

- 소프트웨어 기반의 SBD (SUSE진영 가장 많이 사용)

Data integrity (데이터 무결성)을 위해 반드시 필요

- 클러스터내 다른 노드로 리소스를 전환하기 위한 가장 최상의 방법

- “Enterprise”을 지향하는 Linux HA Cluster에서는 선택이 아닌 필수

제3회 난공불락 오픈소스 인프라세미나 20 What is fencing?

‘Planned or Unplanned’ 시스템 다운타임으로 부터 데이타보호하고 예방하기 위한 장치 (I/O Fencing)

Kernel panic System freeze Live hang / recovery

제3회 난공불락 오픈소스 인프라세미나 21 Quick Overview of Components - Corosync

일반적인 클러스터, 클라우드컴퓨팅 그리고 고가용성 환경에서 사용되는 오픈소스 그룹 메시징시스템. open source group messaging system typically used in clusters, cloud computing, and other high availability environments.

RA RA RA Pacemaker 작동에 필요한 기본 클러스터 인프라 Resource Layer

LRM Communication Layer : messaging and membership PE - Totem single-ring ordering and membership protocol

- 기본적인 제약 조건 : 브로드캐스트를 통한 멀티캐스트 통신 CIB STONITH CRM 방식을 선호 (XML)

- UDP/IP and InfiniBand 기반의 networks 통신 Resource Allocation Layer

- UDPU (RHEL경우 6.2+ 이상부터 지원) Corosync - Corosync (OpenAIS) cman (Only RHEL6) Messaging/Infrastructure Layer

클러스터 파일시스템 지원 (GFS2, OCFS2, cLVM2 등)

제3회 난공불락 오픈소스 인프라세미나 22 Corosync Cluster Engine Architecture

Handle Database Manager :

- maps in O1 order a unique 64-bit handle identifier to a memory address. Configuration Engines

Live Component Replacement :

- Corosync 클러스터 엔진에 의해 사용되는 Plug-in 시스템 (LCR object) Service Engines

Object Database : IPC Manager

- 설정엔진과 서비스엔진을 in-memory 형태의 저장 메커니즘 제공 Service Manager

The Totem Stack : Synchronization Engine

- Totem Single Ring Ordering and Membership Protocol The Totem Stack

Synchronization Engine : Timers - 클러스터 failure 또는 추가 등의 상태 변경후에는 모든 서비스엔진

Logging System

Service Manager : Object Database - responsible for loading and unloading plug-in service engines Live Component Replacement

Service Engines : Handle Database Manager - 클러스터 전체 서비스중 하나로 third-party제품 필요에 의해 제공 (pacemaker or CMAN) https://landley.net/kdocs/ols/2008/ols2008v1-pages-85-100.pdf

제3회 난공불락 오픈소스 인프라세미나 23 Quick Overview of Components - User Interface

고가용성 관리

Pacemaker 설정 시스템은 통일된 클러스터 설정 및 관리 도구로 제공

장점 :

- 명령행 도구

- 클러스터를 쉽게 부트스트랩할 수 있어 첫 번째 클러스터를 시작 및 실행할 수 있음

- 클러스터 옵션을 설정할 수 있음

- 리소스 및 상호 관련성을 추가, 삭제, 변경할 수 있음

- crm shell : Cluster Resource Manager Shell (SLES)

- pcs : Pacemaker Cluster System (Red Hat)

pcs_gui (RHEL) Hawk web UI (SLES) 제3회 난공불락 오픈소스 인프라세미나 24 Cluster Filesystem on shared disk

클러스터 노드가 노드 사이에서 공유되는 블록 장치로 동시에 액세스하게 하는 클러스터 파일 시스템

- 클러스터에서의 실행 최적화를 위해 분산 메타데이터와 다중 저널 사용

- 파일 시스템 무결성을 유지하기 위해 GFS는 I/O를 관리하여 잠금 관리 기능 사용

GFS (Global File System, Red Hat)

- Linux 커널 파일 시스템 인터페이스의 VFS 레이어와 직접적으로 통신하는 파일 시스템

OCFS2 (Oracle Cluster File System, SLES)

- 오라클이 개발한 범용 클러스터 파일 시스템으로 Enterprise Linux 커널과 통합

- 전체 노드가 클러스터 파일 시스템에 동시 접근하는 것을 가능하게 하며, 로우 디바이스 관리의 필요성을 제거

제3회 난공불락 오픈소스 인프라세미나 25 Cluster Block Device

DRBD (Device Replication Block Devices)

- 네트워크 기반의 raid 1(Mirroring)

- 네트워크를 통해 고속 성능 데이타복제 기능 제공 (10Gb Network Bandwidth)

CLVM2 (Cluster LVM2)

- LVM으로의 클러스터 확장 모음 (LVM TYPE=3, lvm.conf)

- 클러스터에서 LVM 메타데이터 업데이트를 사용하는 데몬

- 하나 이상의 클러스터 노드가 활성 노드 사이에서 공유되는 스토리지로의 액세스를 필요로할 경우

- 단, 데이타복제 속도가 현저히 느려질수 있음

Cluster md raid1 (Cluster Software Based RAID 1)

- 여러 클러스터 노드가 공유하는 소프트웨어레이드 기반의 스토리지 제공

- 클러스터환경에서 제공하는 성능(High Performance) 과 안정성(RAID 1)을 보장

- 참고문헌 https://lwn.net/Articles/674085/

제3회 난공불락 오픈소스 인프라세미나 26 Debugging Pacemaker

Configuration :

/var/lib/pacemaker/cib/cib.xml

Cluster status :

# pcs staus (or crm_mon)

Failed Actions:

* pgsqld_monitor_0 on pcmk-srv1 'master (failed)' (9): call=6, status=complete, exitreason='none',

last-rc-change='Fri Jul 1 06:39:58 2016', queued=0ms, exec=484ms

System Log Debug :

# /var/log/cluster/corosync.log

# journalctl -u pacemaker.service

# crm_reports

- sosreport 와 유사한 형태의 기능 제공

Examples :

crm_report -f "2016-07-21 13:05:00" unexplained-apache-failure

제3회 난공불락 오픈소스 인프라세미나 27 Use case samples (1/3) – Enterprise Linux환경 PostgreSQL 이중화 적용 검토

오픈소스기반의 이중화 솔루션 도입 검토 필요성

- 특정 vendors 종속성 탈피

- 기술력 내재화를 통한 운영관리 효율화

- Hardware 도입 비용 절감

- 인프라 운영 인력 리소스 투입 축소

- 기술 트랜드에 따른 R&D목적

제3회 난공불락 오픈소스 인프라세미나 28 Architecture - Dedication 환경 PoC 적용 검토 진행

Clients / Application Servers

1Gb Service Networking L2 Switch Service Network bond0 bond0

eth0 eth1 eth2 eth3 eth0 eth1 eth2 eth3

NIC #1 NIC #2 NIC #1 NIC #2

High-Availability (Pacemaker) High-Availability (Pacemaker)

HBA #1 HBA #2 HBA #1 HBA #2

Port0 port1 Port0 Port1

device-mapper-multipath fence_scsi (SDB) Shared Shared Volume Volume

SAN Switch

EMC CX300 SAN Storage

제3회 난공불락 오픈소스 인프라세미나 29 PostgreSQL Active/Stanby Status

# pcs status Cluster name: pcmk-ha Last updated: Thu Jul 21 16:32:06 2016 Last change: Thu Jul 21 16:26:01 2016 by root via crmd on pcmk-ha2 Stack: cman Current DC: pcmk-ha2 (version 1.1.14-8.el6-70404b0) - partition with quorum 2 nodes and 12 resources configured

Online: [ pcmk-ha1 pcmk-ha2 ]

Full list of resources:

fence1 (stonith:fence_scsi): Started pcmk-ha2 fence2 (stonith:fence_scsi): Started pcmk-ha1 Resource Group: pgsql lvm-archive (ocf::heartbeat:LVM): Started pcmk-ha1 lvm-xlog (ocf::heartbeat:LVM): Started pcmk-ha1 lvm-data (ocf::heartbeat:LVM): Started pcmk-ha1 fs-archive (ocf::heartbeat:Filesystem): Started pcmk-ha1 fs-xlog (ocf::heartbeat:Filesystem): Started pcmk-ha1 fs-data (ocf::heartbeat:Filesystem): Started pcmk-ha1 vip (ocf::heartbeat:IPaddr): Started pcmk-ha1 pgsqld (ocf::heartbeat:pgsql): Started pcmk-ha1

PCSD Status: pcmk-ha1: Online pcmk-ha2: Online

제3회 난공불락 오픈소스 인프라세미나 30 Detail : Configuration

HA-LVM 설정 필요 # vi /etc/lvm/lvm.conf volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] HA-LVM 권고가 아닌 필수요소 pcs resource create lvm-archive LVM volgrpname=pg_archive exclusive=true --group pgsql pcs resource create fs-archive Filesystem device="/dev/pg_archive/archive" directory="/archive" options="noatime,nodiratime" fstype="ext4" --group pgsql pcs resource create lvm-xlog LVM volgrpname=pg_xlog exclusive=true --group pgsql pcs resource create fs-xlog Filesystem device="/dev/pg_xlog/xlog" directory="/pg_xlog" options="noatime,nodiratime" fstype="ext4" --group pgsql pcs resource create lvm-data LVM volgrpname=pg_data exclusive=true --group pgsql pcs resource create fs-data Filesystem device="/dev/pg_data/data" directory="/data" options="noatime,nodiratime" fstype="ext4" --group pgsql pcs resource create vip ocf:heartbeat:IPaddr ip=xxx.xxx.xxx.xxx --group pgsql

제3회 난공불락 오픈소스 인프라세미나 31 Use case samples (2/3) - PostgreSQL Streaming Replication 이중화 기술 검토

PostgreSQL Streaming Replication 이중화 기술 검토 필요성

- 공유볼륨이 필요하지 않는 아키텍쳐  WAL (transaction log) 기반의 복제  Single master, multi-slave 제공

- locking 문제와 Split brain 네트워크와 같은 이슈로 부터 자유로움

- 다양한 인프라환경 이중화 구축 기술연구

Application / Client

Write (A)

Read (A) Read (B)

Streaming Replication

WAL Sender WAL Reciever

Primary / Master Standby / Slave

제3회 난공불락 오픈소스 인프라세미나 32 PostgreSQL Master/Slave Status

# pcs status Cluster name: passr Last updated: Fri Jul 1 09:03:06 2016 Last change: Fri Jul 1 08:44:55 2016 by root via cibadmin on pcmk-srv1 Stack: cman Current DC: pcmk-srv1 (version 1.1.14-8.el6-70404b0) - partition with quorum 2 nodes and 4 resources configured

Online: [ pcmk-srv1 pcmk-srv2 ]

Full list of resources:

fence1 (stonith:fence_kvm): Started pcmk-srv2 fence2 (stonith:fence_kvm): Started pcmk-srv1

vip (ocf::heartbeat:IPaddr2): Started pcmk-srv1 Master/Slave Set: pgsql-ha [pgsqld] Masters: [ pcmk-srv1 ] Slaves: [ pcmk-srv2 ]

PCSD Status: pcmk-srv1: Online pcmk-srv2: Online

제3회 난공불락 오픈소스 인프라세미나 33 Detail : Configuration (2/2)

http://dalibo.github.io/PAF/Quick_Start-CentOS-6.html

제3회 난공불락 오픈소스 인프라세미나 34 RHEL for SAP HANA Certified

Automates the failover of a SAP HANA System Replication

RHEL 6.5, 6.6, and 6.7 (as of Feb. 2016)

- HANA Version: HANA ~ SPS10 (later new feature SPS11 supported)

- CPU Architecture: Intel Ivy Bridge-EX, Haswell-EX

RHEL Pacemaker cluster stack 사용

- RHEL HA add-on 제품형태로 제공

Resource agents

- SAPHana : SAP Replication 환경 설정 및 관리

- SAPHanaTopology : SAP Replication 상태 정보 수집 및 보고

- Bundle 패키지 필요 : resource-agents-sap-hana

Configuration Guide

https://access.redhat.com/sites/default/files/attachments/automated_sap_hana_sr_setup_guide_20150709.pdf

제3회 난공불락 오픈소스 인프라세미나 35 Failover Scenario - Primary Node Down

Clients / Application Servers

VIP

X3850 X6 SAP HANA Appliance

Master SAPHana Slave Master/Slave Resource

Clone SAPHanaTopology Clone Clone Resource

System Replication Data Volume Data Volume “Sync” mode

AUTOMATED_REGISTER=false 권고

제3회 난공불락 오픈소스 인프라세미나 36 Failover Scenario - Secondary Node Take-Over

Clients / Application Servers

VIP failover VIP HW/SW 장애발생

X3850 X6 SAP HANA Appliance

Master SAPHana Master Master/Slave Resource

Clone SAPHanaTopology Clone Clone Resource

System Replication Data Volume Data Volume “Sync” mode

AUTOMATED_REGISTER=false 권고

제3회 난공불락 오픈소스 인프라세미나 37 SAP HANADB Master/Slave Status

# pcs status Cluster name: hanacluster Last updated: Mon May 2 17:41:52 2016 Last change: Mon May 2 17:41:24 2016 Stack: cman Current DC: saphana-ha1 - partition with quorum Version: 1.1.11-97629de 2 Nodes configured 12 Resources configured

Online: [ saphana-ha1 saphana-ha2 ] Full list of resources: fence1 (stonith:fence_ipmilan): Started saphana-ha2 fence2 (stonith:fence_ipmilan): Started saphana-ha1 rsc_vip_52_SAPHana_ONP_HDB00 (ocf::heartbeat:IPaddr): Started saphana-ha1 Clone Set: bond2-monitor-clone [bond2-monitor] Started: [ saphana-ha1 saphana-ha2 ] rsc_vip_100_SAPHana_ONP_HDB00 (ocf::heartbeat:IPaddr): Started saphana-ha1 Clone Set: bond1-monitor-clone [bond1-monitor] Started: [ saphana-ha1 saphana-ha2 ] Clone Set: rsc_SAPHanaTopology_ONP_HDB00-clone [rsc_SAPHanaTopology_ONP_HDB00] Started: [ saphana-ha1 saphana-ha2 ] Master/Slave Set: msl_rsc_SAPHana_ONP_HDB00 [rsc_SAPHana_ONP_HDB00] Masters: [ saphana-ha1 ] Slaves: [ saphana-ha2 ]

제3회 난공불락 오픈소스 인프라세미나 38 Detail : Configuration

VIP

# pcs resource create rsc_vip_52_SAPHana_ONP_HDB00 ocf:heartbeat:IPaddr ip=xxx.xxx.xxxx.xxxx

# pcs resource create bond2-monitor ethmonitor interface=bond2 --clone

# pcs resource create rsc_vip_100_SAPHana_ONP_HDB00 ocf:heartbeat:IPaddr ip=xxxx.xxxx.xxxx.xxxx

# pcs resource create bond1-monitor ethmonitor interface=bond1 --clone

bonding 절체를 통한 resource 감지가 필요하다면 ethmonitor 추가 필요 SAPHanaTopology

# pcs resource create rsc_SAPHanaTopology_ONP_HDB00 SAPHanaTopology SID=ONP InstanceNumber=00 op start timeout=600 op stop timeout=300 op monitor interval=10 timeout=600

# pcs resource clone rsc_SAPHanaTopology_ONP_HDB00 meta is-managed=true clone-max=2 clone-node-max=1 interleave=true

SAPHana

# pcs resource create rsc_SAPHana_ONP_HDB00 SAPHana SID=ONP InstanceNumber=00 PREFER_SITE_TAKEOVER=true DUPLICATE_PRIMARY_TIMEOUT=7200

AUTOMATED_REGISTER=false op start timeout=3600 op stop timeout=3600 op promote timeout=3600 op demote timeout=3600 op monitor interval=59 role="Master“ timeout=700 op monitor interval=61 role="Slave" timeout=700

# pcs resource master msl_rsc_SAPHana_ONP_HDB00 rsc_SAPHana_ONP_HDB00 meta is-managed=true notify=true clone-max=2 clone-node-max=1 interleave=true HA에서 auto replication하지않음 권고사항 Resource constraint

# pcs constraint location msl_rsc_SAPHana_ONP_HDB00 rule score=-INFINITY ethmonitor-bond2 ne 1

# pcs constraint location msl_rsc_SAPHana_ONP_HDB00 rule score=-INFINITY ethmonitor-bond1 ne 1

# pcs constraint colocation add rsc_vip_xx_SAPHana_ONP_HDB00 with master msl_rsc_SAPHana_ONP_HDB00 2000

# pcs constraint colocation add rsc_vip_xxx_SAPHana_ONP_HDB00 with master msl_rsc_SAPHana_ONP_HDB00 2000

# pcs constraint order rsc_SAPHanaTopology_ONP_HDB00-clone then msl_rsc_SAPHana_ONP_HDB00 symmetrical=false

제3회 난공불락 오픈소스 인프라세미나 39 Future endeavors (1/2)

Future Development (개발 진행중이거나 통합 및 업데이트)

- Pacemaker Cloud

• 클라우드 환경에서 monitoring, isolation, recovery, and notification 기술을 사용하여 고가용성제공

• Our developers have very high scale requirements. Our goal is multi-hundred assembly (virtual machine) deployments, with many thousands of deployments within a system.

• https://www.openhub.net/p/pacemaker-cloud

- 여러 기술들을 통한 연계

• DeltaCloud : REST 기반 (HATEOAS) 클라우드 추상화 API, IaaS간의 API를 통합하여 관리 할 수 있도록 해 주는 오픈소스 (1세대 PaaS 벤더 종속성 해방)

• Matahari : Systems Management and Monitoring APIs (w/ pacemaker-cloud)

제3회 난공불락 오픈소스 인프라세미나 40 Future endeavors (2/2)

Upstream activities

- docker: 이미 참여하여 진행중…..

- openstack: 일부 커뮤니티 또는 벤더사에서 참여하거나 계획중

- scalability of corosync/pacemaker

- ………

Where you can contribute

- openSUSE Leap ( Tumbleweed )

- RHEL/CentOS ( Fedora ) 다수 Upstream 참여

- Debian, Ubuntu

- Build from source (BSD, MacOS X, etc.)

- 여러 커뮤니티를 통해 Patch, mailling, ask, test 등을 통해 Upstream 손쉽게 참여

제3회 난공불락 오픈소스 인프라세미나 41 At the end of….

여러분이 생각하는 고가용성이란 무엇인가요?

또한 어떻게 생각하고 계셨나요?

어떠한 솔루션도 99.9999999% 보장해주는 시스템은 세상 어디에도 없습니다.

또한, Best Practice 란 없습니다.

오로지 Test! Test! TEST!!!

제3회 난공불락 오픈소스 인프라세미나 42 REFERENCE

All *open-source* in the whole stack. Go, googling, …

Configuring the Red Hat High Availability Add-On with Pacemaker https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Configuring_the_Red_Hat_High_Availability_Add- On_with_Pacemaker/index.html

SAP on Red Hat Technical Documents http://www.redhat.com/f/pdf/ha-sap-v1-6-4.pdf

Red Hat Reference Architecture Series http://www.sistina.com/rhel/resource_center/reference_architecture.html

Clusterlabs http://clusterlabs.org/doc/ http://blog.clusterlabs.org/

OpenStack HA http://www.slideshare.net/kenhui65/openstack-ha

High Availability on Linux - the SUSE way https://tuna.moe/assets/slides/SFD2015/SUSE_HA_arch_overview.pdf

제3회 난공불락 오픈소스 인프라세미나 43

제3회 난공불락 오픈소스 인프라세미나 44 별첨1) CLUSTER CREATION

Task Pacemaker Create cluster # pcs cluster setup [--start] --name clustername node1 node2 ... Start on one node: # pcs cluster start Start cluster Start on all cluster members: # pcs cluster start –all

Enable cluster # pcs cluster --enable –all

Stop one node: # pcs cluster stop Stop cluster Stop on all cluster members: # pcs cluster stop –all Add node to cluster # pcs cluster node add node Remove node from cluster # pcs cluster node remove node Show configured cluster nodes # pcs cluster status Show cluster configuration # pcs config show Propagation is automatic on configuration for pacemaker cib.xml file Sync cluster configuration To sync corosync.conf # pcs cluster sync

제3회 난공불락 오픈소스 인프라세미나 45 별첨2) FENCING & CLUSTER RESOURCES AND RESOURCE GROUPS

Task Pacemaker Show fence agents # pcs stonith list Show fence agent options # pcs stonith describe fenceagent Create fence device # pcs stonith create stonith_id stonith_device_type[stonith_device_options] Configure backup fence device # pcs stonith level add level node devices Remove a fence device # pcs stonith delete stonith_id Modify a fence device # pcs stonith update stonith_id stonith_device_options Display configured fence devices # pcs stonith show

Task Pacemaker List available resource agents # pcs resource list List options for a specific resource # pcs resource describe resourcetype Create resource # pcs resource create resource_id resourcetyperesource_options # pcs resource group add group_name resource_id1[resource_id2] [...] Create resource groups or create group on resource creation # pcs resource create resource_id resourcetyperesource_options --group group_name Create resource to run on all nodes # pcs resource create resource_id resourcetyperesource_options --clone clone_options Display configured resources # pcs resource show [--full] Order constraints (if not using service groups) # pcs constraint order [action] resource_id1 then [action]resource_id2

Location constraints Configure resource contraints # pcs constraint location rsc prefers node[=score] # pcs constraint location rsc avoids node[=score]

Colocation constraints # pcs constraint colocation add source_resource withtarget_resource [=score] Modify a resource option # pcs resource update resource_id resource_options

제3회 난공불락 오픈소스 인프라세미나 46 별첨3) TROUBLESHOOTING

Task Pacemaker Display current cluster and resource status # pcs status Display current version information # pcs status Stop and disable a cluster element # pcs resource disable resource | group Enable a cluster element # pcs resource enable resource | group Freeze a cluster element (prevent status check) # pcs resource unmanage resource | group Unfreeze a cluster element (resume status check) # pcs resource manage resource | group Disable Pacemaker resource management: # pcs property set maintenance-mode=true Disable cluster resource management Re-enable Pacemaker resource management: # pcs property set maintenance-mode=false Disable single node # pcs cluster standby node Re-enable node # pcs cluster unstandby node pcs resource move groupname move_to_nodename Move cluster element to another node (move_to_nodename remains preferred node until "pcs resource clear" is e xecuted)

제3회 난공불락 오픈소스 인프라세미나 47