building a high-availability postgresql cluster at arin

20
Building a High-Availability PostgreSQL Cluster Presenter: Devon Mizelle System Administrator Co-Author: Steven Bambling System Administrator

Post on 19-Oct-2014

818 views

Category:

Technology


1 download

DESCRIPTION

Through a long and intense period of research, implementation, and testing, ARIN completed the migration from Oracle to PostgreSQL late last year. Learn more at: http://teamarin.net/2014/04/01/building-high-availability-postgresql-cluster-arin/

TRANSCRIPT

Page 1: Building a High-Availability PostgreSQL Cluster at ARIN

Building a High-Availability PostgreSQL Cluster

Presenter: Devon MizelleSystem Administrator

Co-Author: Steven Bambling System Administrator

Page 2: Building a High-Availability PostgreSQL Cluster at ARIN

What is ARIN?• Regional Internet registry for Canada,

US, and parts of the Caribbean• Distributes IPv4 & IPv6 addresses and

Autonomous System Numbers

(Internet number resources) in the

region• Provides authoritative WHOIS services

for number resources in the region

2

Page 3: Building a High-Availability PostgreSQL Cluster at ARIN

ARIN’s Internal Data

3

Page 4: Building a High-Availability PostgreSQL Cluster at ARIN

Requirements

4

Page 5: Building a High-Availability PostgreSQL Cluster at ARIN

Why Not Slony or pgpool-II?• Slony replaces pgSQL’s replication –

Why do this?–Why not let pgSQL handle it?

• Pgpool is not ACID-Compliant – Doesn’t confirm writes to multiple nodes

5

Page 6: Building a High-Availability PostgreSQL Cluster at ARIN

Our solution

• CMAN / Corosync– Red Hat + Open-source solution for

cross-node communication• Pacemaker– Red Hat and Novell’s solution for service

management and fencing• Both under active development by

Clusterlabs

6

Page 7: Building a High-Availability PostgreSQL Cluster at ARIN

CMAN/ Corosync

• Provides a messaging framework between nodes

• Handles a heartbeat between nodes– “Are you up and available?”– Does not provide ‘status’ of service,

Pacemaker does• Pacemaker uses Corosync to send

messages between nodes

7

Page 8: Building a High-Availability PostgreSQL Cluster at ARIN

CMAN / Corosync

8

Page 9: Building a High-Availability PostgreSQL Cluster at ARIN

About Pacemaker• Developed / maintained by Red Hat and Novell • Scalable – Anywhere from a two-node to a 16-

node setup• Scriptable – Resource scripts can be written in

any language– Monitoring – Watches out for service state changes– Fencing – Disables a box and switches roles when

failures occur• Shareable database between nodes about

status of services / nodes

9

Page 10: Building a High-Availability PostgreSQL Cluster at ARIN

Pacemaker

10

Master

AsyncSync

?

Page 11: Building a High-Availability PostgreSQL Cluster at ARIN

Other Pacemaker Resources

11

Fencing IP Addresses

Page 12: Building a High-Availability PostgreSQL Cluster at ARIN

How does it all tie together?

From the bottom up…

Page 13: Building a High-Availability PostgreSQL Cluster at ARIN

Pacemaker

13

Client “vip”Replication “vip”

Master

Sync Async App

Page 14: Building a High-Availability PostgreSQL Cluster at ARIN

Event Scenario

14

?X

XMaster Sync AsyncMaster SyncAsync

Page 15: Building a High-Availability PostgreSQL Cluster at ARIN

PostgreSQL

• Still in charge of replicating data• The state of the service and how it

starts is controlled by Pacemaker

15

Page 16: Building a High-Availability PostgreSQL Cluster at ARIN

Layout

16

��

��

MasterSlave Slave

cman cman cman

Client

Page 17: Building a High-Availability PostgreSQL Cluster at ARIN

Using Tools to Look Deeper

Introspection…

Page 18: Building a High-Availability PostgreSQL Cluster at ARIN

# crm_mon -i 1 -Arf

Page 19: Building a High-Availability PostgreSQL Cluster at ARIN

# crm_mon –i 1 -Arf (cont)

Page 20: Building a High-Availability PostgreSQL Cluster at ARIN

Questions? Devon Mizelle