<commit_before>---
published: false
---
# FAILOVER


Today, I am going to talk about automatic failover.

Not just about cluster failvover (primary failure and standby taking over) but from client point of view.

Yes, PostgreSQL 10 is out since october 5th and 11 is on its way. It has (among others) a new awesome feature. 
Client can reconnect automaticaly to cluster after failure to either RO or RW instance.

So, here are some questions you might have :

* Is it easy to setup ? 
* How much downtime ?
* Above all else : Is the damn thing working ?

## In the Beginning... 


### Which HA ?

To cut it short, I chose `REPMGR`.

Configuration is 3 nodes (1 primary and 2 standbys) plus a witness server.
In case you wonder, this last player serves as as casting vote in a situation of doubt over which node needs to be promoted.

![Configuration REPMGR](https://www.loxodata.com/images/post/failover-2017/config_REPMGR.png)


Here is an extract from repmgr.conf:<commit_msg>Convert to post change date<commit_after>---
published: false
---
# CLIENT FAILOVER


Today, I am going to talk about automatic failover.

Not just about cluster failvover (primary failure and standby taking over) but from client point of view.

Yes, PostgreSQL 10 is out since october 5th and 11 is on its way. It has (among others) a new awesome feature. 
Client can reconnect automaticaly to cluster after failure to either RO or RW instance.

So, here are some questions you might have :

* Is it easy to setup ? 
* How much downtime ?
* Above all else : Is the damn thing working ?

## In the Beginning... 


### Which HA ?

To cut it short, I chose `REPMGR`.

Configuration is 3 nodes (1 primary and 2 standbys) plus a witness server.
In case you wonder, this last player serves as as casting vote in a situation of doubt over which node needs to be promoted.

![Configuration REPMGR](https://www.loxodata.com/images/post/failover-2017/config_REPMGR.png)


Here is an extract from repmgr.conf:
{'fraction_non_alphanumeric': 0.06777946383409206, 'fraction_numerical': 0.012139605462822459, 'mean_word_length': 3.7777777777777777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 2, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '664367', 'n_tokens_mistral': 598, 'n_tokens_neox': 558, 'n_words': 298}