enterprises use edb postgres to manage postgresql at scale - … › edb-docs › static › docs...

55
EDB Failover Manager Guide September 2, 2014

Upload: others

Post on 06-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

September 2, 2014

Page 2: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

EDB Failover Manager Guide, Version 1.1

by EnterpriseDB Corporation

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

EnterpriseDB Corporation, 34 Crosby Drive Suite 100, Bedford, MA 01730, USA

T +1 781 357 3390 F +1 978 589 5701 E [email protected] www.enterprisedb.com

Page 3: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

Table of Contents

1 Introduction ................................................................................................................. 5

1.1 What’s New ........................................................................................................ 6

1.2 Typographical Conventions Used in this Guide ................................................. 7

2 Failover Manager - Overview ..................................................................................... 8

2.1 Supported Platforms............................................................................................ 9

2.2 Prerequisites ...................................................................................................... 10

2.2.1 Platform-specific Prerequisites ..................................................................... 11

2.3 Failover Manager Product Keys ....................................................................... 12

3 Installing and Configuring Failover Manager........................................................... 13

3.1 Extending Failover Manager Permissions ........................................................ 13

3.2 Configuring Failover Manager ......................................................................... 15

3.2.1 Specifying Cluster Properties ....................................................................... 15

3.2.2 Encrypting Your Database Password............................................................ 21

3.3 Using Failover Manager with Virtual IP Addresses ......................................... 23

3.4 Running Multiple Agents on a Single Node ..................................................... 26

4 Controlling the Failover Manager Service ................................................................ 29

4.1 The Cluster Status Report ................................................................................. 32

5 Controlling Logging.................................................................................................. 34

6 Notifications ............................................................................................................. 35

7 Use Case Diagrams .................................................................................................. 40

7.1 Starting the Failover Manager Cluster .............................................................. 40

7.2 Stopping the Failover Manager Cluster ............................................................ 41

7.3 Promoting the Failover Manager Cluster .......................................................... 42

8 Failover vs. Failure Detection ................................................................................... 44

8.1 Supported Failover Scenarios ........................................................................... 44

8.1.1 Failover Scenario 1 - Master Database Node Failure ................................... 45

8.1.2 Failover Scenario 2 - Master Database is Down, While Host Remains Up . 47

8.2 Supported Failure Scenarios ............................................................................. 50

8.2.1 Failure Scenario 1 - Failover Manager Master Agent Exits ......................... 50

8.2.2 Failure Scenario 2 - Failover Manager Standby Agent Exits ....................... 51

8.2.3 Failure Scenario 3 - Standby Database is Down ........................................... 52

8.2.4 Failure Scenario 4 - Standby Node Failure ................................................... 53

Page 4: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

8.2.5 Failure Scenario 5 - Failover Manager Witness Agent Exits / Node Fails ... 54

9 Inquiries .................................................................................................................... 55

Page 5: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

5

1 Introduction

EDB Failover Manager is a high-availability module from EnterpriseDB that enables a

Postgres Master node to automatically failover to a Standby node in the event of a

software or hardware failure on the Master.

This guide provides information about installing, configuring and using Failover

Manager.

This document uses Postgres to mean either the PostgreSQL or Postgres Plus Advanced

Server database. For more information about using Postgres Plus products, please visit

the EnterpriseDB website at:

http://www.enterprisedb.com/documentation

Page 6: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

6

1.1 What’s New

The following features have been added to EnterpriseDB Failover Manager 1.0 to create

EnterpriseDB Failover Manager 1.1:

Failover Manager now provides improved cluster status information during

normal operations and promotion. For more information about supported

notifications, see Section 6.

Failover Manager now implements jgroups authentication and message body

encryption behind the scenes. jgroups authentication provides improved security

to prevent unknown nodes from joining the failover manager cluster. No end-user

configuration is required to take advantage of this improvement.

Failover Manager now responds to standard Linux service commands rather than

a separate script. For more information about using the start, status, stop

and resume commands, see Section 4.

Failover Manager agents no longer require property changes and restarts after a

failure or failover. No end-user configuration is required to take advantage of this

feature.

Failover Manager agents now run as a user named ppfm instead of root. For

more information, see Section 3.1.

The improved cluster-status command provides information about the status

of the Failover Manager cluster, including the state of agents and their local

databases. Separately, the command makes direct connections to the databases to

report on whether or not the master and standby are synchronized. For more

information, see Section 4.

The Failover Manager promote command allows manual promotion in more

circumstances (for instance if master agent is not running or if the master/standby

databases are not in sync). For more information, see Section 4.0.

To use Failover Manager beyond the evaluation period, you must enter a valid

product key in the ppfm.properties file. For more information, see Section

2.3.

Page 7: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

7

1.2 Typographical Conventions Used in this Guide

Certain typographical conventions are used in this manual to clarify the meaning and

usage of various commands, statements, programs, examples, etc. This section provides a

summary of these conventions.

In the following descriptions a term refers to any word or group of words that are

language keywords, user-supplied values, literals, etc. A term’s exact meaning depends

upon the context in which it is used.

Italic font introduces a new term, typically, in the sentence that defines it for the

first time.

Fixed-width (mono-spaced) font is used for terms that must be given

literally such as SQL commands, specific table and column names used in the

examples, programming language keywords, etc. For example, SELECT * FROM emp;

Italic fixed-width font is used for terms for which the user must

substitute values in actual usage. For example, DELETE FROM table_name;

A vertical pipe | denotes a choice between the terms on either side of the pipe. A

vertical pipe is used to separate two or more alternative terms within square

brackets (optional choices) or braces (one mandatory choice).

Square brackets [ ] denote that one or none of the enclosed term(s) may be

substituted. For example, [ a | b ], means choose one of “a” or “b” or neither

of the two.

Braces {} denote that exactly one of the enclosed alternatives must be specified.

For example, { a | b }, means exactly one of “a” or “b” must be specified.

Ellipses ... denote that the proceeding term may be repeated. For example, [ a |

b ] ... means that you may have the sequence, “b a a b a”.

Page 8: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

8

2 Failover Manager - Overview

A Failover Manager (FM) cluster is comprised of FM processes that reside on the

following hosts on a network:

Master - The Master node is the primary database server that is servicing database

clients.

Standby - The Standby node is a streaming replication server associated with the

Master.

Witness - The Witness node confirms assertions of either the Master or the

Standby in a failover scenario.

Traditionally, the expression cluster refers to a single instance of Postgres managing

multiple databases. In this document, the term cluster refers to a Failover Manager

cluster. A Failover Manager cluster consists of a Master agent, a Standby agent, and a

Witness agent that reside on servers in a cloud or on a traditional network and

communicate using the JGroups toolkit.

Figure 2.1 - A FM scenario employing a Virtual IP address.

Page 9: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

9

Initially, Failover Manager does not make a distinction between the server that will

become the Master node, and the server that will become the Standby node. When an

agent starts, it connects to the local database and checks the state of the database. If it

finds that the database is in recovery, the agent assumes the role of standby; if the

database is not in recovery, the agent assumes the role of master.

There is only one witness agent, and its role within the cluster is unchanging; it can never

become a standby node or master node.

JGroups provides technology that allows Failover Manager to create clusters whose

member nodes can communicate with each other and detect node failures. For more

information about JGroups, visit the official project site at:

http://www.jgroups.org

Each Failover Manager cluster on your network must have a unique name; the cluster

name is defined in the cluster properties file (discussed in Section 3.2).

Figure 2.1 illustrates a Failover Manager cluster that employs a virtual IP address. You

can use a load balancer in place of a virtual IP address if you provide your own fencing

script to re-configure the load balancer in the event of a failure. For more information

about using Failover Manager with a virtual IP address, see Section 3.3. For more

information about using a fencing script, see Section 3.2.

2.1 Supported Platforms

Failover Manager is supported on Postgres Plus Advanced Server or PostgreSQL

(version 9.0 and higher) installations running on Intel x86_64 and IBM Power PC

systems:

CentOS 6.x

Red Hat Enterprise Linux 6.x

Page 10: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

10

2.2 Prerequisites

Before configuring a Failover Manager cluster, you must satisfy the prerequisites

described below.

Provide an SMTP Server

Failover Manager sends notification emails to the email address specified in the cluster

properties file. An SMTP server must be running on each node of the Failover Manager

scenario. For more information about using an SMTP server, visit:

https://access.redhat.com/site/documentation

Configure Streaming Replication

Failover Manager requires that PostgreSQL streaming replication be configured between

the Master node and the Standby node. Failover Manager does not support other types of

replication. For more information about streaming replication, see the PostgreSQL core

documentation at http://www.enterprisedb.com/warm-standby.html .

Modify the pg_hba.conf File

You must modify the pg_hba.conf file on the Master and Standby nodes, adding

entries that allow communication between the Master, Standby and Witness servers. The

following example demonstrates entries that might be made to the pg_hba.conf file on

the Master node:

# access for itself

host fmdb ppfm 127.0.0.1/32 md5

# access for standby

host fmdb ppfm 192.168.27.1/32 md5

# access for witness

host fmdb ppfm 192.168.27.34/32 md5

Where:

ppfm specifies the name of a valid database user.

fmdb specifies the name of a database to which the ppfm user may connect.

The specified user must have read permission on the database specified by the

db.database parameter in the properties file. For more information about the

properties file, see Section 3.2.

By default, the pg_hba.conf file resides in the data directory, under your Postgres

installation. After modifying the pg_hba.conf file, you must reload the configuration

file on each node for the changes to take effect. You can use the following command:

Page 11: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

11

# /etc/init.d/ppas-9.x reload

Where x specifies the Postgres version.

Ensure Communication Through Firewalls

If a Linux firewall (i.e. iptables) is enabled on the host of a Failover Manager node, you

may need to add rules to the firewall configuration that allow tcp communication

between the PPFM processes in the cluster. For example:

# iptables -I INPUT -p tcp --dport 7800:7810 -j ACCEPT

/sbin/service iptables save

The command shown above opens a small range of ports (7800 through 7810). Failover

Manager will connect via the port that corresponds to the port specified in the cluster

properties file. Other ports will be used for command line interface commands that need

to connect to the cluster (for example, service ppfm-1.1 stop-cluster).

2.2.1 Platform-specific Prerequisites

IBM Power PC

By default, the Java Cryptography Extension (JCE) distributed with the IBM software

developer kit (SDK) provides limited policy files. To use Failover Manager's database

password encryption, you must download and enable an unlimited JCE policy. For

detailed information about downloading and enabling an unlimited policy, please visit:

http://www-

01.ibm.com/support/knowledgecenter/#!/SSYKE2_6.0.0/com.ibm.java.security.compone

nt.60.doc/security-component/sdkpolicyfiles.htmlhttp://www-01.ibm.com/support

Page 12: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

12

2.3 Failover Manager Product Keys

The initial installation of Failover Manager does not require a product key. Upon

installation you are granted full access to the cluster monitoring and failover features

under a Limited Use License for evaluation purposes for a trial period.

At the end of the trial period, you are required to either un-install the software or

purchase a valid subscription. In addition, at the end of the trial period, the Failover

Manager agents will exit making cluster monitoring and failover non-operational.

Failover Manager will send multiple email alerts alerting your system administrator of

the approaching end of trial period.

To use Failover Manager beyond the evaluation period, you are required to purchase a

database server subscription (i.e. Standard Edition with the Failover Manager option or

Enterprise Edition) from EnterpriseDB. With the purchase of a subscription you will

receive a product key, which will re-enable Failover Manager's cluster monitoring and

failover operations. The product key is applied to the Failover Manager configuration

file and will restore full functionality for the term of your subscription.

After purchasing a product key, edit the cluster properties file, adding the value to the

right of the ppfm.license parameter:

ppfm.license=license_key

Where license_key specifies the product key you received from EDB.

You do not need to restart the agents after adding the product key. Every 6 hours,

Failover Manager agents check for and validate the product key, so the parameter update

will be detected dynamically. For more information about editing the cluster properties

file, see Section 3.2.1.

To purchase a database subscription that includes Failover Manager, contact one of the

EnterpriseDB offices listed at:

http://www.enterprisedb.com/company/offices

or contact EnterpriseDB at:

[email protected]

Page 13: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

13

3 Installing and Configuring Failover Manager

Failover Manager is packaged and delivered as an RPM. To install Failover Manager,

copy the RPM package to the Master, Standby and Witness systems. After copying the

archive to each system, use yum to install the package:

# yum install ppfm11-1.1.0-1.noarch.rpm

Failover Manager must be installed by root. During the installation process, the

installer will also create a user named ppfm that has sufficient privileges to invoke scripts

that control the Failover Manager service for clusters owned by enterprisedb or postgres.

If you are using Failover Manager to monitor a cluster owned by a user other than

enterprisedb or postgres, see Section 3.1, Extending Failover Manager Permissions.

Failover Manager File Locations

Failover Manager components are installed in the following locations:

Executables: /usr/ppfm-1.1/bin

Libraries: /usr/ppfm-1.1/lib

Cluster configuration files: /etc/ppfm-1.1

Logs: /var/log/ppfm-1.1

Lock files: /var/lock/ppfm-1.1

Log rotation file: /etc/logrotate.d/ppfm-1.1

sudo configuration file: /etc/sudoers.d/ppfm-11

3.1 Extending Failover Manager Permissions

During the Failover Manager installation, the installer creates a user named ppfm. ppfm

does not have sufficient privileges to perform management functions that are normally

limited to the database owner. When performing management functions, ppfm invokes

the ppfm_functions script; the ppfm_functions script performs management

functions on behalf of the ppfm user. When assigning or releasing a virtual IP address,

ppfm uses the ppfm_address script to assign or release the VIP.

The sudoers.d file contains entries that allow the user ppfm to control the Failover

Manager service for clusters owned by postgres or enterprisedb. You can modify

the entries in the sudoers file to grant permission to manage Postgres clusters owned by

other users to ppfm.

The ppfm-11 file is located in /etc/sudoers.d, and contains the following entries:

Page 14: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

14

[master@localhost ~]}> cat /etc/sudoers.d/ppfm-11

# Copyright EnterpriseDB Corporation, 2014. All Rights Reserved.

#

# This file assumes you are running your ppfm cluster as user

'ppfm'. If not,

# then you will need to edit this file.

# Allow user 'ppfm' to sudo ppfm_functions as either 'postgres'

or 'enterprisedb'.

# If you run your db service under a non-default account, you

will need to edit

# this file to grant the proper permissions and specify the

account in your ppfm

# cluster properties file by changing the 'db.service.owner'

property.

ppfm ALL=(postgres) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_functions

ppfm ALL=(enterprisedb) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_functions

# Allow user 'ppfm' to sudo ppfm_functions as 'root' to

write/delete the PID file

# and validate the db.service.owner property.

ppfm ALL=(ALL) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_functions writepid * *

ppfm ALL=(ALL) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_functions deletepid *

ppfm ALL=(ALL) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_functions validatedbowner *

# allow user 'ppfm' to sudo ppfm_address as root

ppfm ALL=(ALL) NOPASSWD: /usr/ppfm-

1.1/bin/ppfm_address

# relax tty requirement for user 'ppfm'

Defaults:ppfm !requiretty

If you are using Failover Manager to monitor clusters that are owned by users other than

postgres or enterprisedb, you should add entries to the sudoers file for each

additional cluster owner that allow ppfm to use the ppfm_functions script to manage

their clusters.

If the agents cannot start because of permission problems, make sure the default

/etc/sudoers file contains the following at the end of the file:

## Read drop-in files from /etc/sudoers.d (the # here does not

mean a comment)

#includedir /etc/sudoers.d

Page 15: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

15

3.2 Configuring Failover Manager

After installing Failover Manager RPM, you must create a cluster properties file. On

each node of the cluster, make a working copy of the cluster properties file template. The

cluster properties file template is named ppfm.properties.in and is located in the

/etc/ppfm-1.1 directory.

For example, the following command copies the ppfm.properties.in template to a

new file:

# cp /etc/ppfm-1.1/ppfm.properties.in /etc/ppfm-1.1/ppfm.properties

After creating the cluster configuration file, add (or modify) configuration parameter

values as required. For detailed information about each parameter, see Section 3.2.1,

Specifying Cluster Properties.

The property files are owned by root. The Failover Manager service script expects to

find the files in the /etc/ppfm-1.1 directory; if you relocate the property file to

another location you must modify the service script (/etc/init.d/ppfm-1.1) to

identify the new location of the property file.

Note that you must use the ppfm encrypt utility to encrypt the value supplied in the

db.password.encrypted parameter.

3.2.1 Specifying Cluster Properties

You can use the parameters listed in the cluster properties file to specify connection

properties and behaviors for your Failover Manager cluster. Modifications to

configuration parameter settings will be applied when Failover Manager starts. If you

modify a parameter value (with the exception of the ppfm.license parameter) you must

restart Failover Manager to apply the changes.

Property values are case-sensitive. Note that while Postgres uses quoted strings in

parameter values, Failover Manager does not allow quoted strings in the parameter

values. For example, while you might specify a Postgres parameter value as:

trigger_file = '/var/lib/ppas/9.3/data/recovery_end.trigger'

Failover Manager requires that the value not be enclosed in quotes:

db.trigger.file=/var/lib/ppas/9.3/data/recovery_end.trigger

Use the parameters that follow to specify connection, administrative, and operational

details for Failover Manager.

Use the ppfm.license parameter to provide the Failover Manager product key:

Page 16: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

16

# The full license to run failover manager.

ppfm.license=

When there are five (or fewer) days left in the trial period, Failover Manager will send an

email warning you that it is time to provide a valid license number. If you have not

provided a product key before the trial period expires, all Failover Manager agents will

exit.

You do not need to restart the agents after adding the product key to the properties file.

Every six hours the Failover Manager agent will attempt to locate and validate the

product key.

Use the cluster.name parameter to specify a name for the cluster:

# A name for this ppfm cluster. The value must be the same across

# all agents, and must be unique on a node.

# NOTE: do not change this property once the encrypted password

# password has been generated. ppfm will no longer work

cluster.name=

The auto.failover parameter enables automatic failover. By default,

auto.failover is set to true.

# Whether or not failover will happen automatically when the master # fails. Set to false if you want to receive the failover notifications # but not have ppfm actually perform the failover steps. # The value of this property must be the same across all agents.

auto.failover=true

Use the following parameters to specify connection properties for each node of the

Failover Manager cluster:

# These properties must be the same for both master and standby.

# The value for the password property should be the output from

# 'ppfm encrypt' -- do not include clear text password here.

db.user=

db.password.encrypted=

db.port=

db.database=

For information about encrypting the password for the database user, see Section 3.2.2,

Encrypting Your Database Password.

Page 17: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

17

The db.reuse.connection parameter allows the admin to control whether or not

Failover Manager reuses the same database connection each time it checks the database

health. The default value is false, indicating that Failover Manager will create a fresh

connection each time it checks the database health. Please note that setting

db.reuse.connection to true may prevent Failover Manager from detecting certain

failover scenarios.

# This property controls whether or not PPFM reuses the db

# connection when checking the status of the database.

# NOTE: It is highly recommended that this property be set to

# "false", as the use of a persistent database connection may

# prevent detection of certain failure scenarios such as the

# death of the postmaster process.

db.reuse.connection=false

Use the admin.port parameter to specify the port on which Failover Manager listens

for administrative commands.

# This property controls the port binding of the administration

# server which is used for some commands (ie cluster-status).

admin.port=

The local.timeout parameter specifies how long a node will wait for a response from

the local database server. The local.period parameter specifies how many seconds

between attempts to contact the database server.

# These properties apply to the JDBC connection ppfm uses

# to monitor the local database. Timeout is the total time to

# wait for a response from the database, in seconds. Period is

# how often to ping the database in seconds.

local.timeout=25

local.period=10

Use the remote.timeout parameter to specify how many seconds an agent waits for a

response from a remote database server (i.e., how long the standby agent waits to verify

that the master database is actually down before performing failover).

# Timeout for a call to check if a remote database is responsive.

# For example, this is how long the standby would wait for a

# DB ping request from itself and the witness to the master DB

# before performing failover.

remote.timeout=5

Page 18: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

18

The jgroups.max.tries parameter specifies the number of consecutive times Failover

Manager attempts to contact a node before the node is assumed to be down.

jgroups.timeout specifies the number of milliseconds before the connection attempts

time out.

# These properties apply to the jgroups connection between the

# nodes. Description copied from jgroups:

#

# Max tries: Number of times to send an are-you-alive message.

# Timeout (in ms): Timeout to suspect a node P if neither a

# heartbeat nor data were received from P.

#

# The value of these properties must be the same across all

# agents.

jgroups.max.tries=3

jgroups.timeout=3000

Use the user.email parameter to specify the email address of a system administrator.

# Email address of the user for notifications. The value of this

# property must be the same across all agents.

user.email=

Use the agents parameter to specify the IP address and port of the master and standby

nodes; the witness parameter should specify the IP address and port of the witness

node:

# The value of the master/standby agents and witness properties

# must be the same across all agents. The agent addresses are

# <ip>:<port>, separated by commas. The witness is <ip>:<port>.

# The port is not the database port, but the port on which the

# ppfm agents will listen.

agents=

witness=

The Postgres pg_is_in_recovery() function is a boolean function that reports the

state of a database. The function returns true if the database is in recovery, or false if

the database is not in recovery. When an agent starts, it connects to the local database

and invokes the pg_is_in_recovery() function. If the server responds true, the

agent assumes the role of standby; if the server responds false, the agent assumes the

role of master.

Use the db.service.owner parameter to specify the name of the operating system user

that owns the cluster that is being managed by Failover Manager.

Page 19: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

19

# This property tells PPFM which OS user owns the $PGDATA dir for

# the 'db.database'. Normally, it would either be "postgres" for

# PostgreSQL or "enterprisedb" for Postgres Plus Advanced Server.

# However, if you have configured your db to run as a different

# user, you will need to manually tune the /etc/sudoers.d/ppfm-XX

# conf file to grant the necessary permissions to your db owner.

#

# This username must have write permission to the

# 'db.recovery.conf.dir' specified below.

db.service.owner=

For more information about managing Failover Manager permissions, see Section 3.1,

Extending Failover Manager Permissions.

Use the db.trigger.file parameter to specify the location to which the database

trigger file will be written on the Standby node of the cluster. The value must match the

trigger_file parameter in the standby database's recovery.conf file.

# Specify the location of the db trigger file on the standby

# node. This file will be created during promotion of the

# standby database to cause streaming replication to end.

#

db.trigger.file=

Use the db.recovery.conf.dir parameter to specify the location to which a recovery

file will be written on the Master node of the cluster.

# Specify the location of the db recovery.conf file on the master

# node. A recovery.conf file will be written during failover and

# promotion to ensure that the master node can not be restarted

as the database master.

#

# The user running the ppfm process must have write access in

# this dir.

db.recovery.conf.dir=

The virtualIp parameter specifies virtual IP address information for the Failover

Manager cluster. Use the virtualIp.interface parameter to specify an alias for

your network adaptor (for example, eth0:1 specifies an alias for the adaptor, eth0).

You might create multiple aliases for each adaptor on a given host; for more information

about running multiple agents on a single node, please see Section 3.4. The

virtualIp.netmask parameter specifies which bits in the virtual IP address refer to the

network address (as opposed to the host address).

# This is the IP and netmask that will be remapped during fail

# over. If you do not use VIPs as part of your failover

Page 20: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

20

# solution, then leave these properties blank to disable PPFM's

# support for VIP processing (assigning, releasing, testing

# reachability, etc).

#

# If you enable VIP, then all three properties are required.

#

# The address and netmask must be the same across all agents.

# The 'interface' value must contain the secondary virtual ip id

(ie ":1", etc)

virtualIp=

virtualIp.interface=

virtualIp.netmask=

Use the pingServer parameter to specify the IP address of a server that Failover

Manager can use to confirm that network connectivity is not a problem.

# This is the address of a well-known server that PPFM can ping

# in an effort to determine network reachability issues. It

# might be the IP address of a nameserver within your corporate

# firewall or another server that *should* always be reachable

# via a 'ping' command from each of the PPFM nodes.

#

# There are many reasons why this node might not be considered

# reachable: firewalls might be blocking the request, ICMP might

# be filtered out, etc.

#

# Do not use the IP address of any node in the PPFM cluster

# (master, standby, or witness because this ping server is meant

# to provide an additional layer of information should the PPFM

# nodes lose sight of each other.

#

# You might default to Google's DNS server

pingServerIp=8.8.8.8

Use the pingServerCommand parameter to specify the command used to test network

connectivity.

# This command will be used to test the reachability of certain

# nodes.

#

# Do not include an IP address or hostname in on the end of this

# command - it will be added dynamically at runtime with the

# values contained in 'virtualIp' and 'pingServer'.

#

# Make sure this command returns reasonably quickly - test it

# from a shell command line first to make sure it works properly.

pingServerCommand=/bin/ping -q -c3 -w5

Page 21: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

21

script.fence specifies an optional path to a user-supplied script that will be invoked

during failover.

# absolute path to fencing script

#

# This is an optional user-supplied script that will be run

# during failover on the standby database node. If left blank,

# no action will be taken. If specified, PPFM will execute this

# script before promoting the standby.

#

# NOTE: FAILOVER WILL NOT OCCUR IF THIS SCRIPT RETURNS A NON-ZERO

EXIT CODE

script.fence=

Please note that the fencing script runs as the ppfm user; you must ensure that the ppfm

user has sufficient privileges to invoke any commands included in the fencing script. For

more information about Failover Manager permissions, please see Section 3.1.

Use the jgroups.loglevel and ppfm.loglevel parameters to specify the level of

detail logged by Failover Manager. For more information about logging, see Section 5,

Controlling Logging.

# logging levels for jgroups and ppfm

# legal values are: FINEST, FINER, FINE, CONFIG, INFO, WARNING,

# SEVERE

# default value: INFO

jgroups.loglevel=INFO

ppfm.loglevel=INFO

3.2.2 Encrypting Your Database Password

Failover Manager requires that you encrypt your database password before including it in

the cluster properties file. To encrypt the password, open a command line, and enter the

command:

# service ppfm-1.1 encrypt

The Failover Manager service will prompt you to enter the database password twice

before generating an encrypted password for you to place in your cluster property file.

When the utility shares the encrypted password, copy and paste the encrypted password

into all of the cluster property files.

The following example demonstrates using the encrypt utility to encrypt a password for

the acctg cluster:

Page 22: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

22

# service ppfm-1.1 encrypt

This utility will generate an encrypted password for you to place in

your PPFM cluster property file (/etc/ppfm-1.1/ppfm.properties).

Please enter the password and hit enter:

Please enter the password again to confirm:

The encrypted password is: 835fb18954f198e94fd3d6f4b070350b

Please paste this into /etc/ppfm-1.1/ppfm.properties

db.password.encrypted=835fb18954f198e94fd3d6f4b070350b

If there is a problem with the encrypted password, the Failover Manager service will not

start:

[witness@localhost ~]# service ppfm-1.1 start

Starting local ppfm-1.1 service: [FAILED]

If you receive this message when starting the Failover Manager service, please see the

startup log (located in /var/log/ppfm-1.1/startup-ppfm.log) for more

information.

Please Note: To prevent a cluster from inadvertently connecting to the database of

another cluster, the cluster name is incorporated into the encrypted password. If you

modify the cluster name, you will need to re-encrypt the database password and update

the cluster properties file.

Page 23: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

23

3.3 Using Failover Manager with Virtual IP Addresses

Failover manager uses the ppfm_address script to assign or release the VIP. By

default, the script resides in:

/usr/ppfm-1.1/bin/ppfm_address

The following command invokes the ppfm_address script to assign a VIP:

# ppfm_address assign interface_name ip_address netmask

The following command invokes the ppfm_address script to release a VIP:

# ppfm_address release interface_name ip_address

Where:

interface_name matches the name specified in the virtualIp.interface

parameter in the cluster properties file.

ip_address matches the name specified in the virtualIp parameter in the

cluster properties file.

netmask matches the name specified in the virtualIp.netmask parameter in

the cluster properties file.

You must invoke the ppfm_address script as the root user. The ppfm user is created

during the installation, and is granted privileges in the sudoers file to run the

ppfm_address script. For more information about the sudoers file, see Section 3.1,

Extending Failover Manager Permissions.

When using a virtual IP (VIP) address with Failover Manager, it is important to test the

VIP functionality manually before starting failover manager. This will catch any

network-related issues before they cause a problem during an actual failover. The

following steps test the actions that failover manager will take. The example uses the

following property values:

virtualIp=172.24.38.239

virtualIp.interface=eth0:0

virtualIp.netmask=255.255.255.0

pingServerCommand=/bin/ping -q -c3 -w5

Note that the virtual IP address and netmask specified when invoking ppfm_address

must be the same on all nodes, though the Witness node will not attempt to broadcast the

VIP. When instructed to ping the VIP from a node, use the command defined by the

pingServerCommand property.

Page 24: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

24

1. Ping the VIP from all three nodes to confirm that the address is not already in use:

# /bin/ping -q -c3 -w5 172.24.38.239

PING 172.24.38.239 (172.24.38.239) 56(84) bytes of data.

--- 172.24.38.239 ping statistics ---

4 packets transmitted, 0 received, +3 errors, 100% packet

loss, time 3000ms

You should see 100% packet loss.

2. Run the ppfm_address assign command on the Master node to assign the VIP and

then confirm with ifconfig:

# ppfm_address assign eth0:0 172.24.38.239 255.255.255.0

# ifconfig

<output truncated>

eth0:0 Link encap:Ethernet HWaddr 36:AA:A4:F4:1C:40

inet addr:172.24.38.239 Bcast:172.24.38.255

Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500

Metric:1

Interrupt:247

3. Ping the VIP from the Standby node and the Witness node to verify that both nodes

can reach the VIP:

# /bin/ping -q -c3 -w5 172.24.38.239

PING 172.24.38.239 (172.24.38.239) 56(84) bytes of data.

--- 172.24.38.239 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time

1999ms

rtt min/avg/max/mdev = 0.023/0.025/0.029/0.006 ms

You should see no packet loss. Repeat this step on all nodes.

4. Use the ppfm_address release command to release the address on the master

node and confirm the node has been released with ifconfig:

# ppfm_address release eth0:0 172.24.38.239

# ifconfig

eth0 Link encap:Ethernet HWaddr 22:00:0A:89:02:8E

inet addr:10.137.2.142 Bcast:10.137.2.191

...

The output from this step should not show an eth0:0 interface

5. Repeat step 3, this time verifying that the Standby and Witness do not see the VIP in

use:

Page 25: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

25

# /bin/ping -q -c3 -w5 172.24.38.239

PING 172.24.38.239 (172.24.38.239) 56(84) bytes of data.

--- 172.24.38.239 ping statistics ---

4 packets transmitted, 0 received, +3 errors, 100% packet

loss, time 3000ms

You should see 100% packet loss. Repeat this step on all nodes.

6. Repeat step 2 on the Standby node to assign the VIP to it. You can ping the VIP from

any node to verify that it is in use.

# ppfm_address assign eth0:0 172.24.38.239 255.255.255.0

# ifconfig

<output truncated>

eth0:0 Link encap:Ethernet HWaddr 36:AA:A4:F4:1C:40

inet addr:172.24.38.239 Bcast:172.24.38.255

Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500

Metric:1

Interrupt:247

After the test steps above, release the VIP from the Standby before attempting to start

Failover Manager.

Page 26: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

26

3.4 Running Multiple Agents on a Single Node

You can monitor multiple database clusters that reside on the same node by running

multiple Master or Standby agents on that node. You may also run multiple Witness

agents on a single node. To configure Failover Manager to monitor more than one

database cluster, while ensuring that Failover Manager agents from different clusters do

not interfere with each other, you must:

1. Create a properties file for each cluster with a unique name and set of properties.

2. Customize the service script for each cluster.

3. Start the services for each cluster.

The examples that follow uses two database clusters (acctg and sales) running on the

same node:

Data for acctg resides in /opt/pgdata1; its server is monitoring port 5444.

Data for sales resides in /opt/pgdata2; its server is monitoring port 5445.

To run a Failover Manager agent for both of these database clusters, use the

ppfm.properties.in template to create two properties files. Each cluster properties

file must have a unique name. For this example, we create acctg.properties and

sales.properties to match the acctg and sales database clusters.

The following parameters must be unique in each cluster properties file:

db.port

db.trigger.file

db.recovery.conf.dir

agents (port must be unique)

witness (port must be unique)

virtualIp (if used)

virtualIp.interface (if used)

script.fence (if used)

Within each cluster properties file, the db.port parameter should specify a unique value

for each cluster, while the db.user, db.password.encrypted and db.database

parameter may have the same value or a unique value. For example, the

acctg.properties file may specify:

db.user=ppfm_user

db.password.encrypted=7c801b32a05c0c5cb2ad4ffbda5e8f9a

db.port=5444

db.database=acctg_db

Page 27: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

27

While the sales.properties file may specify:

db.user=ppfm_user

db.password.encrypted=e003fea651a8b4a80fb248a22b36f334

db.port=5445

db.database=sales_db

Remember, the database user specified in the cluster properties file must have read access

to the database.

If you are using a fencing script, use the script.fence parameter to identify a fencing

script that is unique for each cluster. In the event of a failover, Failover Manager does

not pass any information to the fencing script that could identify which master has failed.

When creating the cluster properties file for each cluster, the db.trigger.file and

db.recovery.conf.dir parameters must specify values that are unique for each

respective database cluster. For example, the db.trigger.file value in

acctg.properties must match the value specified in the trigger_file parameter in

/opt/pgdata1/recovery.conf. Mismatched information could cause one Failover

Manager cluster to promote the standby of a different Failover Manager cluster.

The following parameters also require special attention when setting up more than one

Failover Manager cluster agent on the same node. The agents and witness parameters

define the location of nodes in a cluster:

agents=ip_address:port,ip_address:port

witness=ip_address:port

If multiple agents reside on the same node, the IP address will be reused, but the port

must be unique. For example, if running more than one agent on the master node and

standby node, acctg.properties might specify:

agents=10.151.79.57:7800,10.151.79.58:7800

While sales.properties might specify:

agents=10.151.79.57:8800,10.151.79.58:8800

Any two ports will work, but it may be easier to keep the information clear if using ports

that are not too close to each other. If a Linux firewall is enabled on the host of a

Failover Manager node, you may need to add rules to the firewall configuration that

allow tcp communication between the PPFM processes in the cluster; see Section 2.2 for

more information.

The following parameters are used when assigning the virtual IP address to a node. If

your Failover Manager cluster does not use a virtual IP address, leave these parameters

blank.

Page 28: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

28

virtualIp

You must specify a unique virtual IP address for each cluster. If the same address is

used, a failure of one database cluster would cause the address to be released from the

master, breaking existing connections to the remaining database cluster.

virtualIp.interface

You must specify a unique interface name for each cluster. For example,

acctg.properties might include a value of eth0:0, while sales.properties

might specify eth0:1.

virtualIp.netmask

This parameter value is determined by the virtual IP addresses being used and may or

may not be the same for both acctg.properties and sales.properties.

After creating the acctg.properties and sales.properties files, create a service

script for each cluster that points to the respective property files by copying the ppfm-

1.1 service script to file with a name that is unique for each cluster. For example:

# cp /etc/init.d/ppfm-1.1 /etc/init.d/ppfm-acctg

# cp /etc/init.d/ppfm-1.1 /etc/init.d/ppfm-sales

Then edit the CLUSTER variable at the top of each script, modifying the cluster name

from ppfm to acctg or sales. Note that this name is not related to the cluster property

in the properties files, but instead is used to specify the name of the properties file to load

and the name of the startup log for this cluster.

After creating the service scripts, run:

# chkconfig ppfm-acctg on

# chkconfig ppfm-sales on

Now the agents can be run using the new service scripts. For example, you can start the

acctg agent with the command:

# service ppfm-acctg start

Page 29: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

29

4 Controlling the Failover Manager Service

Failover Manager runs as a Linux service named (by default) ppfm-1.1 that is located in

/etc/init.d. Each database cluster monitored by Failover Manager will run a copy of

the service on each node (master, standby and witness nodes) of the replication cluster.

You can use the service script to control Failover Manager. The service script expects to

find a configuration file named ppfm.properties in the /etc/ppfm-1.1 directory

that contains the properties used by the Failover Manager service. Each node of a

replication scenario must contain a properties file. To create the ppfm.properties file,

copy the template file (located in /etc/ppfm-1.1/ and named

ppfm.properties.in) to its new location and modify the file contents.

When starting a Failover Manager cluster, always start the agent that resides on the

Witness node before starting the Master or Standby agent. If a Failover Manager agent is

started on the Master or Standby before the Witness agent is started, the agent will exit

immediately.

After providing a service properties file, you can start and control the Failover Manager

service with the following commands:

service ppfm-1.1 start

The start command starts the Failover Manager service on the current node.

Invoke the service first on the Witness node, and then on the Master and Standby

nodes. The start command starts the service that monitors the local database

and communicates with Failover Manager on the other nodes. This command

must be invoked by root or ppfm.

service ppfm-1.1 cluster-status

The cluster-status command returns the status of the entire Failover Manager

cluster. You can invoke the cluster-status command on any node to instruct

Failover Manager to connect to each node in the cluster and return status

information. For example:

[master@localhost temp]# service ppfm-1.1 cluster-status

Cluster Status: acctg

Agent Type Address Agent DB Info

-------------------------------------

Master 10.0.1.11 UP UP

Witness 10.0.1.12 UP N/A

Standby 10.0.1.13 UP UP

Page 30: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

30

Database Status:

Address DB Info

------------------------------------

10.0.1.11 UP

10.0.1.13 UP

Promote Status:

Master ( 10.0.1.11 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 )is up-to-date with Master (10.0.1.11). It is safe to promote.

For more information about the Cluster Status report, see Section 4.1.

service ppfm-1.1 status

The status command returns the status of the Failover Manager agent on which it

is invoked. You can invoke the status command on any node to instruct

Failover Manager to return status information. For example:

[witness@localhost ~]# service ppfm-1.1 status

ppfm-1.1 (pid 50836) is running...

service ppfm-1.1 promote

The promote command instructs Failover Manager to perform a manual failover

of master to standby. This command must be invoked by root or ppfm.

Manual promotion should only be attempted if the status command reports that

the Standby is up-to-date with the Master. If the Standby is not up to date,

Failover Manager will prompt you before continuing.

Please note that this command instructs the service to ignore the value specified in

the auto.failover parameter in the cluster properties file.

service ppfm-1.1 stop

Stop the Failover Manager on the current node. This command must be invoked

by root or ppfm.

service ppfm-1.1 stop-cluster

The stop-cluster command stops Failover Manager on all nodes. This command

instructs Failover Manager to connect to each node on the cluster and instruct the

existing members to shut down. The command has no effect on running

Page 31: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

31

databases, but when the command completes, there is no failover protection in

place. This command must be invoked by root or ppfm.

service ppfm-1.1 resume

Resume monitoring a previously stopped database. This command must be

invoked by root or ppfm.

service ppfm-1.1 prop-check

The prop-check command invokes a utility that may help to identify configuration

problems caused by mismatched property files.

When invoked on the Witness node with a cluster named employees, the prop-

check command might display:

# service ppfm-1.1 prop-check

Agents: 172.24.38.107:7800 172.24.38.122:7800 Witness: 172.24.38.185:7800 Binding address: 172.24.38.185 I am witness node: true Cluster name: employees User email: [email protected] VIP: 172.24.38.239 Automatic failover set to: true Network adapters:eth0 fe80:0:0:0:10a8:bff:fe7c:70cf%2 172.24.38.185 lo 0:0:0:0:0:0:0:1%1 127.0.0.1

service ppfm-1.1 encrypt

Invoke the encrypt command on any node to interactively encrypt your database

password for storage in the cluster properties file. Once encrypted, paste the

password into each property file as the value of the db.password.encrypted

parameter.

For more information about encrypting your password, please see Section 3.1.1.

service ppfm-1.1 help

Display online help for the Failover Manager service script.

Page 32: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

32

4.1 The Cluster Status Report

The cluster-status command returns a report that contains information about the

status of the Failover Manager cluster. For example, the command:

[master@localhost temp]# service ppfm-1.1 cluster-status

Might return the following status report:

Cluster Status: acctg

Agent Type Address Agent DB Info

-------------------------------------

Master 10.0.1.11 UP UP

Witness 10.0.1.12 UP N/A

Standby 10.0.1.13 UP UP

Database Status:

Address DB Info

------------------------------------

10.0.1.11 UP

10.0.1.13 UP

Promote Status:

Master ( 10.0.1.11 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 )is up-to-date with Master ( 10.0.1.11 ). It is safe to promote.

--- end ---

The cluster status report contains three sections. The Cluster Status section provides

an overview of the status of the agents that reside on each node of the cluster:

Cluster Status: acctg

Agent Type Address Agent DB Info

-------------------------------------

Master 10.0.1.11 UP UP

Witness 10.0.1.12 UP N/A

Standby 10.0.1.13 UP UP

Failover Manager agents provide the information displayed in the Cluster Status section.

The Database Status section of the report is based on a direct database query from the

node on which you are invoking cluster-status to each node in the cluster:

Database Status:

Page 33: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

33

Address DB Info

------------------------------------

10.0.1.11 UP

10.0.1.13 UP

The Promote Status section of the report is the result of a direct query from the node

on which you are invoking the cluster-status command to each database in the

cluster; the query returns the transaction log location of each database.

Promote Status:

Master ( 10.0.1.11 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 ) transaction log location: 0/170047A0

Standby ( 10.0.1.13 )is up-to-date with Master (10.0.1.11). It is safe to promote.

Note that if an agent is down, the Cluster Status section of the report will display

Unknown in the Agent column and UNKNOWN in the DB column. Since the agent is not

running, it will not respond to queries about its status, or the status of the database that it

monitors.

If a database is down (or if the database has been restarted, but the resume command has

not yet been invoked), the state of the agent that resides on that host will be Idle.

If all agents are running, and the databases on the master and standby nodes are running

and in sync, the exit code will be 0. If an agent or database is down, the

cluster-status command will return a non-zero exit code.

Page 34: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

34

5 Controlling Logging

Failover Manager writes and stores one log file per agent and one startup log per agent in

/var/log/ppfm-1.1. You can control the level of detail written to the logs by

modifying the jgroups.loglevel and ppfm.loglevel parameters in the cluster

properties file:

# logging levels for jgroups and ppfm

# legal values are: FINEST, FINER, FINE, CONFIG, INFO, WARNING,

# SEVERE

# default value: INFO

jgroups.loglevel=INFO

ppfm.loglevel=INFO

The logging facilities use the Java logging library and logging levels. The log levels (in

order from most logging output to least) are:

FINEST FINER FINE CONFIG INFO WARNING SEVERE

For example, if you set the ppfm.loglevel parameter to WARNING, Failover Manager

will only log messages at the WARNING level and above (WARNING and SEVERE).

By default, Failover Manager log files are rotated daily, compressed, and stored for a

week. You can modify the file rotation schedule by changing settings in the log rotation

file (/etc/logrotate.conf/ppfm-1.1). For more information about modifying the

log rotation schedule, consult the logrotate man page:

$ man logrotate

Page 35: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

35

6 Notifications

Failover Manager will send e-mail notifications about events that happen while

monitoring the database cluster. You must have an SMTP server running on port 25 on

each node and you must configure the recipient address in each cluster properties file:

# Email address of the user for notifications.

[email protected]

Where [email protected] represents the administrator's email address. Note

that you must specify the same email address in each cluster properties file.

The body of the notification contains details about the event that triggered the

notification, and about the current state of the cluster. For example:

PPFM node: 172.24.38.158

Cluster name: acctg

Database name: postgres

VIP support: DISABLED

The standby agent signaled that its database has failed.

The master also cannot reach the standby database.

Failover Manager assigns a severity level to each notification. The following levels

indicate increasing levels of attention required:

INFO indicates an informational message about the agent and does not require

any manual intervention (for example, Failover Manager has started or stopped).

WARNING indicates that an event has happened that requires the administrator to

check on the system (for example, failover has occurred).

SEVERE indicates that a serious event has happened and requires the immediate

attention of the administrator (for example, failover was attempted, but was

unable to complete).

The severity level designates the urgency of the notification. A notification with a

severity level of SEVERE requires user attention immediately, while a notification with a

severity level of INFO will call your attention to operational information about your

cluster that does not require user action. Notification severity levels are not related to

logging levels; all notifications are sent regardless of the log level detail specified in the

configuration file.

Page 36: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

36

The conditions listed in the table below will trigger an INFO level notification:

Subject Description

Executing fencing script Executing fencing script script_name Results: script_results

Witness agent started on node_address for cluster cluster_name

Witness agent is running.

Master agent started on node_address for cluster cluster_name

Master agent is running and database health is being

monitored.

Standby agent started on node_address for cluster cluster_name

Standby agent is running and database health is

being monitored.

Assigning VIP to node node_address Assigning VIP VIP_address to node

node_address Results: script_results

Releasing VIP from node node_address Releasing VIP VIP_address from node

node_address Results: script_results

Witness agent exited on node_address for cluster cluster_name

Witness agent has exited.

Master agent exited on node_address for cluster cluster_name

Database health is not being monitored.

Standby agent exited on node_address for cluster cluster_name

Database health is not being monitored.

Agent exited on node_address for cluster cluster_name

The agent has exited. Note that if an agent is unable

to locate notification address information, it will

send an email notification to root@localhost.

Agent exited for cluster cluster_name The agent has exited. Note that if an agent is unable

to locate notification address information, it will

send an email notification to root@localhost.

Manual promotion has started Manual promotion has started. Master PPFM agent

will stop monitoring the local database and signal

cluster to promote standby.

The conditions listed in the table below will trigger a WARNING level notification:

Subject Description

Virtual IP address assigned to non-master node The virtual IP address appears to be assigned to a

non-master node. In order to avoid any issues,

Failover Manager will release the VIP. You should

ensure that the VIP is assigned to your master node

and manually reassign if not.

No standby agent in cluster for cluster cluster_name

The standby has left the cluster.

Standby agent failed for cluster cluster_name The standby agent has left the cluster, but the

master has detected that the standby database is still

running.

Standby database failed for cluster cluster_name The standby agent signaled that its database has

failed. The master also cannot reach the standby

database.

Standby agent cannot reach database for cluster cluster_name

The standby agent has signaled database failure, but

the master has detected that the standby database is

still running.

No witness agent in cluster for cluster cluster_name

The witness has left the cluster. The witness must

be restarted for failover protection in the case of

another node failure.

node_name node is isolated from network for The node_name node is isolated from the network.

Page 37: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

37

cluster cluster_name

Members missing in cluster cluster_name node_address node has rejoined the cluster and

the following nodes are missing: node_name

Standby agent tried to promote, but master DB is

still running

The standby PPFM agent tried to promote itself, but

detected that the master DB is still running on

node_address. This usually indicates that the

master PPFM agent has exited. Failover has NOT

occurred.

Standby agent tried to promote, but could not verify

master DB

The standby PPFM agent tried to promote itself, but

could not detect whether or not the master DB is

still running on node_address. Failover has NOT

occurred.

Standby agent tried to promote, but VIP appears to

still be assigned

The standby PPFM agent tried to promote itself, but

could not because the virtual IP address

(VIP_address) appears to still be assigned to

another node. Promoting under these circumstances

could cause data corruption. Failover has NOT

occurred.

Standby agent tried to promote, but appears to be

orphaned

The standby PPFM agent tried to promote itself, but

could not because the well-known server

(server_address) could not be reached. This

usually indicates a network issue that has separated

the standby agent from the other agents. The

standby agent is unable to determine if the master

agent and database are running. Failover has NOT

occurred.

Standby agent tried to promote, but local database is

not running

The standby PPFM agent tried to promote itself, but

could not because the standby database is not

running. Failover has NOT occurred.

Failover has not occurred The standby has detected that the master database is

no longer available in cluster cluster_name, but

cannot confirm the database is down with another

node. Please see the agent log files for more

information.

Failover should occur but is disabled A failover situation was detected for cluster

cluster_name. Automatic failover has been

disabled for this cluster, so manual intervention is

required.

Failover has completed on cluster cluster_name Failover has completed on cluster cluster_name.

Lock file for cluster cluster_name has been

removed

The lock file for cluster cluster_name has been

removed from: path_name on node

node_address. This lock prevents multiple

agents from monitoring the same cluster on the

same node. Please restore this file to prevent

accidentally starting another agent for cluster.

recovery.conf file for cluster cluster_name

has been found

A recovery.conf file for cluster cluster_name has

been found at: path_name on master node

node_address. This may be problematic should

you attempt to restart the DB on this node.

Trial license expiring soon Your trial license for EDB Failover Manager will

expire on expiration_date. A valid product key

is required for continued operation once the initial

trial period has ended. Without a valid product key,

at the end of the trial, Failover Manager will exit

and no longer run. Please contact your

Page 38: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

38

EnterpriseDB account manager to purchase a

license for Failover Manager.

Full license expiring soon Your Full Use license for EDB Failover Manager

will expire on expiration_date. A valid product

key is required is required for continued operation

once your current license subscription ends.

Without a valid product key, at the end of your

subscription, Failover Manager will exit and no

longer run. Please contact your EnterpriseDB

account manager to renew your subscription for

Failover Manager.

License has expired Your license subscription to run this product

expired on expiration_date. Failover Manager

is continuing to run under the trial period. Please

contact your EnterpriseDB Account Manager to

purchase a new license subscription for Failover

Manager.

License is invalid There is a problem with the Full Use License for

EDB Failover Manager that was provided in the

cluster properties file. Please check to be sure it was

entered correctly. Failover Manager will continue to

run for the duration of the trial period. If this

problem persists, please contact your EnterpriseDB

Account Manager.

The conditions listed in the table below will trigger a SEVERE notification:

Subject Description

Fencing script error Executing fencing script script_name Exit Value:

exit_code Results: script_results Failover

has NOT occurred.

master|standby database failure for cluster cluster_name

The agent has detected that the database has failed

on node_address.

Could not assign VIP to node node_address Failure assigning VIP VIP_address to node

node_address Results: script_results

Unable to connect to DB on node_address The maximum connections limit has been reached.

Unable to connect to DB on node_address Invalid password for db.user=user_name.

Unable to connect to DB on node_address Invalid authorization specification.

Could not promote standby The trigger file file_name could not be created on

node. Could not promote standby. Error details: message_details

Error creating recovery.conf file on

node_address for cluster cluster_name

There was an error creating the recovery.conf file

on master node node_address during promotion.

Promotion has continued, but requires manual

intervention to ensure that the old master node can

not be restarted. Error details: message_details

License has expired EDB Failover Manager has shutdown. Your license

subscription to run this product expired on

expiration_date. Please contact your

EnterpriseDB Account Manager to purchase a new

license subscription for Failover Manager.

License is invalid EDB Failover Manager has shutdown. There is a

problem with the Full Use License for EDB

Failover Manager that was provided in the cluster

Page 39: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

39

properties file. Please check to be sure it was

entered correctly. If this problem persists, please

contact your EnterpriseDB Account Manager.

Please note: In addition to sending notices to the administrative email address, all

notifications are recorded in the cluster log file (/var/log/ppfm-

1.1/cluster_name.log).

Page 40: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

40

7 Use Case Diagrams

The following use case diagrams outline the steps taken by Failover Manager when the

state of the monitored cluster changes.

7.1 Starting the Failover Manager Cluster

Prerequisites:

A two-node database cluster is configured with streaming replication.

The virtual IP address is unassigned.

You may have additional cascading standbys off of the primary Standby, but

Failover Manager does not monitor their health or allow failover to those servers.

Figure 7.1 - Failover Manager pre-requisites.

Starting Failover Manager Agents:

You must invoke service ppfm-1.1 start on all nodes, starting with the

Witness Node.

The Witness node must be started first; the Master and Standby agents can be

started in any order.

Before joining the cluster, the agent checks the supplied database credentials to

ensure that it can connect to both the Master and Standby databases. If there is a

failure to connect, the agent exits.

Upon startup, the three agents create and join a cluster.

Page 41: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

41

The virtual IP address is assigned to the Master node.

The Master and Standby agents begin monitoring the health of their local

databases.

Figure 7.2 - Starting Failover Manager.

7.2 Stopping the Failover Manager Cluster

Invoking service ppfm-1.1 stop-cluster on any node will cause all Failover

Manager agents to exit. Terminating the Failover Manager agents completely disables all

failover functionality. This operation changes the state of your Failover Manager cluster

from the state shown in Figure 7.2 to the state shown in Figure 7.1.

Page 42: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

42

7.3 Promoting the Failover Manager Cluster

You may invoke service ppfm-1.1 promote from any node to cause a manual

promotion of the Standby database to Master database. This should only be performed if

you are in a maintenance window for your database cluster. If the Standby database is

not up-to-date with the Master database, you will be prompted before continuing.

Figure 7.3 - Before Manual Promotion of Standby Database.

During manual promotion:

The Master agent releases the virtual IP address on Node 1.

The Master agent creates a recovery.conf file in the directory specified by the

db.recovery.conf.dir parameter, remains running, and assumes a status of

Idle.

The Standby agent verifies that the virtual IP address is no longer in use.

The Standby agent pings a well-known address to ensure that the agent is not

isolated from the network.

The Standby agent runs the fencing script.

The Standby promotes the Standby database to Master.

Page 43: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

43

The Standby agent assigns the virtual IP address to Node 2.

After a manual promotion, Failover Manager is no longer providing failover protection

for the new Master database unless the old master database is brought up as a Standby.

Failover Manager currently does not provide fallback functionality to restore the old

Master database - you must perform this configuration manually.

Figure 7.4 - After Manual Promotion of Standby Database.

Page 44: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

44

8 Failover vs. Failure Detection

Failover Manager supports both failover and failure detection. The primary difference

between failover and failure is that in a failover scenario the Standby database is

promoted to Master database and the virtual IP address is reassigned, while during a

failure scenario Failover Manager detects some other error condition and notifies the

administrator via e-mail (without modifying either database).

The scenarios that follow detail the steps taken by Failover Manager in the event of a

detected failure. For more information about email notifications, see Section 6.

8.1 Supported Failover Scenarios

Failover Manager supports a very specific and limited set of failover scenarios. Failover

can occur:

if the Master database crashes or is shutdown.

if the entire node hosting the Master database crashes, reboots, or otherwise

becomes unreachable due to network connectivity issues.

Failover Manager makes every attempt to verify the accuracy of these conditions by

requiring consensus between two nodes about the state of the Master node. Therefore, it

is important that the Witness agent run on a different physical segment of the network

than the Standby or Master agents, ideally on a connection path similar to incoming client

connections to both database servers. If consensus cannot be reached that the Master

database or node has failed, then Failover Manager will not perform any failover actions

on the cluster.

Failover Manager also supports a no auto-failover mode for situations where you want

Failover Manager to monitor and detect failover conditions, but not perform failover to

the Standby database. In this mode, a notification is sent to the administrator when

failover conditions are met. To disable automatic failover, modify the cluster properties

file, setting the auto.failover parameter to false.

Page 45: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

45

8.1.1 Failover Scenario 1 - Master Database Node Failure

If there are any errors or network conditions that make the Master database node

unavailable or unreachable (due to a system panic, reboot, hardware failure, network

connectivity, etc), then Failover Manager begins the process of confirming the failure.

Figure 8.1 - Failure of Master Database Node.

Then:

1) The Standby agent detects that the Master agent has left.

a) The Standby and Witness agents attempt to directly connect to the Master

database.

i) If a connection is successful, the Standby agent sends a notification about the

Master agent failure.

ii) If the connection fails:

(1) The Standby and Witness agents attempt to ping the virtual IP address to

determine if it was released.

(2) The Standby agent pings a well-known address to confirm that it is not

isolated.

Page 46: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

46

(3) If the above checks succeed, the Standby agent:

(a) Runs a fencing script (if applicable).

(b) Promotes the Standby database to Master database.

(c) Assigns the virtual IP address to the Standby node.

Figure 8.2 - Results After Failover.

If this scenario has occurred because the master has been isolated from network, the

Master will detect the isolation and release the virtual IP address and create the

recovery.conf file. Failover Manager will perform the previously listed steps on the

remaining nodes of the cluster.

To recover from this scenario without restarting the entire cluster, you should:

1. Restart the original master node.

2. Bring the original master database up as a standby database.

3. Invoke the service ppfm-1.1 start command on the original master node.

Page 47: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

47

8.1.2 Failover Scenario 2 - Master Database is Down, While Host Remains Up

If the Failover Manager agent running on the Master database node detects a failure of

the Master database as shown in Figure 8.1 (because it crashed, someone killed or

stopped it, etc), then Failover Manager begins the process of confirming the failure.

Figure 8.3 - Failure of Master Database.

The following actions happen in this scenario:

1) The Failover Manager agent on the Master node detects a database failure:

a) The Master agent releases the virtual IP address.

b) The Master agent creates a recovery.conf file in the directory specified by

the db.recovery.conf.dir parameter.

c) The Master agent stops monitoring the database, and becomes Idle.

2) The Failover Manager agent on the Standby node is notified that the Master

database has failed.

Page 48: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

48

a) The Standby and Witness agents attempt to directly connect to the Master

database. If the Witness is unavailable, promotion will continue if the Master

and Standby both agree that the database has failed.

i) If a connection is successful, the Standby agent sends a notification about

the Master database failure.

ii) If the connection fails:

(1) The Standby and Witness agents attempt to ping the virtual IP address

to determine if it was released.

(2) The Standby agent pings a well-known address to make sure it was not

isolated.

(3) After the above checks, the Standby agent:

(a) Runs a fencing script (if applicable).

(b) Promotes the Standby database to Master database.

(c) Assigns the virtual IP address to the Standby node.

Figure 8.4 - Results After Failover.

Page 49: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

49

To recover from this scenario without restarting the entire cluster, you should:

1. Restart the database on the original master node as a standby database.

2. Invoke the service ppfm-1.1 resume command on the original master

node.

Page 50: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

50

8.2 Supported Failure Scenarios

In addition to failover detection, Failover Manager performs failure detection. This

includes many scenarios that require administrator intervention, but that don’t involve

promoting the Standby database to Master.

Failover Manager will notify the administrator if:

the Standby agent dies.

the Standby database crashes or becomes unreachable.

the Witness agent dies or becomes unreachable.

the Master agent dies but the Master database is still alive.

8.2.1 Failure Scenario 1 - Failover Manager Master Agent Exits

Figure 8.5 - Failure of Master Agent.

If the Failover Manager Master agent fails for any reason, the standby agent will detect

the failure.

1) The Standby agent will ask the Witness to independently check the status of the

Master database. The Witness and Standby agents must agree the Master

database is not available or failover will not be performed.

Page 51: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

51

2) A notification is sent to the administrator.

Note: at this point, there is no failover protection until the master agent is started again.

8.2.2 Failure Scenario 2 - Failover Manager Standby Agent Exits

Figure 8.6 - Failure of Standby Agent.

If the Failover Manager Standby agent fails for any reason, the Master agent will detect

that it is no longer connected to the Standby. The Master agent will contact the Standby

server to see if the database is still up, and send the appropriate notification to the

administrator.

Note: at this point, there is no failover protection until the Standby agent is started again.

Page 52: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

52

8.2.3 Failure Scenario 3 - Standby Database is Down

Figure 8.7 - Failure of Standby Database.

If the Standby agent detects a failure of the Standby database, the following actions will

take place:

1) The Standby agent detects a failure of the Standby database, and notifies the

administrator.

2) The Standby agent notifies the Witness and Master agents of the failure of the

Standby database.

3) The Master agent checks the Standby database to confirm that it is down, and

sends a notification to the administrator.

Note: at this point, there is no failover protection until the Standby database is restarted,

and the service ppfm-1.1 resume command is invoked on the Standby node.

Page 53: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

53

8.2.4 Failure Scenario 4 - Standby Node Failure

Figure 8.8 - Failure of Standby Node.

If there are any errors or network conditions that make the Standby node unavailable or

unreachable, the Master agent will contact the Standby server to confirm that the database

is down, and send the appropriate notification to the administrator.

Note: at this point, there is no failover protection until the Standby node is restarted, and

the service ppfm-1.1 start command is invoked to start the Standby agent.

Page 54: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

54

8.2.5 Failure Scenario 5 - Failover Manager Witness Agent Exits / Node Fails

Figure 8.9 - Failure of Witness Agent.

If the Failover Manager Witness agent exits or the Witness node crashes or experiences

network connectivity issues, the Master and Standby agents detect the failure and send

notifications to the administrator.

Note: at this point, there is no failover protection in the case of a Master node failure until

the Witness is restarted. In the case of a Master database failure, the Master and Standby

agents can agree that the database failed and proceed with failover.

Page 55: Enterprises Use EDB Postgres to Manage PostgreSQL at Scale - … › edb-docs › static › docs › efm › 1... · 2014-09-09 · normal operations and promotion. For more information

EDB Failover Manager Guide

Copyright © 2013 - 2014 EnterpriseDB Corporation. All rights reserved.

55

9 Inquiries

If you have any questions regarding EDB Failover Manager, please contact EnterpriseDB

at:

[email protected]