pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgres HA
16+ messages / 15 participants
[nested] [flat]
* Postgres HA
@ 2017-02-22 22:58 Dylan Luong <Dylan.Luong@unisa.edu.au>
0 siblings, 6 replies; 16+ messages in thread
From: Dylan Luong @ 2017-02-22 22:58 UTC (permalink / raw)
To: pgsql-general
Hi
I am a DBA at the University of South Australia. For PostgreSQL High Availability, we currently have setup a Master/Slave across two datacenters using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer) server that sits between the application servers and the PostgreSQL server that directs connections to the Master (and the Slave if failover occurs). We also have watchdog processes on the PostgreSQL servers that polls the LTM to determine who is Master and perform automatic failover if required. I am looking at options to improve our high availability.
I would like to know how other organizations in different industries (other than education) setup High Availability on their PostgreSQL environments.
What tools do you use. Are they commercial licensed products? How is the architecture setup and how do you do recovery of new slave.
Your information is greatly appreciated.
Regards
Dylan
Dylan Luong
Information Strategy & Technology Services
University of South Australia
A Building, Room E2-07, Mawson Lakes Campus
MAWSON LAKES
South Australia 5095
Email: dylan.luong@unisa.edu.au<mailto:dylan.luong@unisa.edu.au>
Phone: +61 8 83023629
Fax: +61 8 83023577
WWW: http://www.unisa.edu.au
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 00:26 Andrew Sullivan <ajs@crankycanuck.ca>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 0 replies; 16+ messages in thread
From: Andrew Sullivan @ 2017-02-23 00:26 UTC (permalink / raw)
To: pgsql-general
Hi,
On Wed, Feb 22, 2017 at 10:58:10PM +0000, Dylan Luong wrote:
>
> I am looking at options to improve our high availability.
I suspect the central question you have to answer is, "What do you
mean by 'improve'?"
Do you want to increase the ability to retrieve data? Decrease the
potential for data loss? Shorten the recovery time to read/write
availability? And so on. The answers for these different questions
will determine which trade-off you need to make.
And rest assured, there is abolutely no solution in the world -- not
even a really expensive commercial one -- that requires no trades.
Distributing data reliably with ACID semantics and no data loss or
corruption or loss in write throughput is not possible, at least
today. You have to pick which poison you want :)
A
--
Andrew Sullivan
ajs@crankycanuck.ca
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 01:36 Julyanto Sutandang <julyanto@equnix.id>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 0 replies; 16+ messages in thread
From: Julyanto Sutandang @ 2017-02-23 01:36 UTC (permalink / raw)
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; +Cc: pgsql-general
Dear Dylan,
Talking about High Availability, we should understand the basic concept of
HA, it is avoiding SPOF (Single Point of Failure). When we use a
Loadbalancer (LTM) and that load balancer is single, then you may get HA
only for the PostgreSQL but there are another single point of failure, it
is the LTM it self. In overall that topology is not HA.
The best configuration for HA i know is using Linux-HA to watch between 2
servers and doing failover VIP (Virtual IP) when Master is down or out of
service. The best configuration for HA, Servers should be on the same site
and uses direct cable connection to ensure dedicated private bandwidth and
there are no Single Point of Failure.
LinuxHA or pacemaker or corosync will do the Virtual IP swing over from
master host to slave host and promote the replica database in slave host
become master.
There is no single point of failure.
Julyanto SUTANDANG
Equnix Business Solutions, PT | www.equnix.id
(An Open Source and Open Mind Company)
Plaza Semanggi 9 Fl. Unit 9; Jl. Jend Sudirman Kav 50
Jakarta - Indonesia 12930
T: +6221 22866662 <(021)%2022866662> M: +628164858028 <0816-4858-028>
Caution: The information enclosed in this email (and any attachments) may
be legally privileged and/or confidential and is intended only for the use
of the addressee(s). No addressee should forward, print, copy, or otherwise
reproduce this message in any manner that would allow it to be viewed by
any individual not originally listed as a recipient. If the reader of this
message is not the intended recipient, you are hereby notified that any
unauthorized disclosure, dissemination, distribution, copying or the taking
of any action in reliance on the information herein is strictly prohibited.
If you have received this communication in error, please immediately notify
the sender and delete this message.Unless it is made by the authorized
person, any views expressed in this message are those of the individual
sender and may not necessarily reflect the views of PT Equnix Business
Solutions.
On Thu, Feb 23, 2017 at 5:58 AM, Dylan Luong <Dylan.Luong@unisa.edu.au>
wrote:
> Hi
>
>
>
> I am a DBA at the University of South Australia. For PostgreSQL High
> Availability, we currently have setup a Master/Slave across two datacenters
> using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer)
> server that sits between the application servers and the PostgreSQL server
> that directs connections to the Master (and the Slave if failover occurs).
> We also have watchdog processes on the PostgreSQL servers that polls the
> LTM to determine who is Master and perform automatic failover if required.
> I am looking at options to improve our high availability.
>
> I would like to know how other organizations in different industries
> (other than education) setup High Availability on their PostgreSQL
> environments.
>
> What tools do you use. Are they commercial licensed products? How is the
> architecture setup and how do you do recovery of new slave.
>
> Your information is greatly appreciated.
>
>
>
> Regards
>
> Dylan
>
>
>
> *Dylan Luong*
>
> *Information Strategy & Technology Services*
>
> University of South Australia
>
> A Building, Room E2-07, Mawson Lakes Campus
>
> MAWSON LAKES
>
> South Australia 5095
>
>
>
> Email: *dylan.luong@unisa.edu.au <dylan.luong@unisa.edu.au>*
>
> Phone: +61 8 83023629 <+61%208%208302%203629>
>
> Fax: +61 8 83023577 <+61%208%208302%203577>
>
> WWW: http://www.unisa.edu.au
>
>
>
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 04:38 Venkata B Nagothi <nag1010@gmail.com>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 1 reply; 16+ messages in thread
From: Venkata B Nagothi @ 2017-02-23 04:38 UTC (permalink / raw)
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; +Cc: pgsql-general
On Thu, Feb 23, 2017 at 9:58 AM, Dylan Luong <Dylan.Luong@unisa.edu.au>
wrote:
> Hi
>
>
>
> I am a DBA at the University of South Australia. For PostgreSQL High
> Availability, we currently have setup a Master/Slave across two datacenters
> using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer)
> server that sits between the application servers and the PostgreSQL server
> that directs connections to the Master (and the Slave if failover occurs).
> We also have watchdog processes on the PostgreSQL servers that polls the
> LTM to determine who is Master and perform automatic failover if required.
> I am looking at options to improve our high availability.
>
> I would like to know how other organizations in different industries
> (other than education) setup High Availability on their PostgreSQL
> environments.
>
> What tools do you use. Are they commercial licensed products? How is the
> architecture setup and how do you do recovery of new slave.
>
> Your information is greatly appreciated.
>
An efficient High Availability setup for PostgreSQL would depend on various
factors like Application, Infrastructure and other Business Continuity
requirements. In your case, you have already mentioned that the Load
Balancer continuously polls to check the master status and fails over to
slave when the former is down. If you are looking at improving this setup,
then, it is important for us to know how the slave promotion is happening ?
is that done by some tools like pgPool-II ? Well, those are the open-source
tools available if you wish to automate the slave promotion when the master
is down. If you are looking at an highly efficient High Availability setup
would depend on how a) Application failover and b) slave promotion are
going hand-in-hand. Following are some of the factors to consider which can
help improve the efficiency in PostgreSQL High Availability -
- Application requirements for continued / uninterrupted data operations on
slave post the fail-over
- How fast the slave gets promoted when master fails
- You need to ensure Master and Slave are in absolute sync all the time
(importantly just before fail-over)
- Various other factors related to infrastructure like Network, database
load etc.
Hope that helps !
Regards,
Venkata B N
Database Consultant
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 06:00 JD <venkijd@gmail.com>
parent: Venkata B Nagothi <nag1010@gmail.com>
0 siblings, 0 replies; 16+ messages in thread
From: JD @ 2017-02-23 06:00 UTC (permalink / raw)
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; +Cc: pgsql-general
Here is the option for HA i.e. EDB failover manager.
https://www.enterprisedb.com/docs/en/2.1/edbfm/EDB_Failover_Manager_Guide.1.02.html
On Thu, Feb 23, 2017 at 10:08 AM, Venkata B Nagothi <nag1010@gmail.com>
wrote:
>
> On Thu, Feb 23, 2017 at 9:58 AM, Dylan Luong <Dylan.Luong@unisa.edu.au>
> wrote:
>
>> Hi
>>
>>
>>
>> I am a DBA at the University of South Australia. For PostgreSQL High
>> Availability, we currently have setup a Master/Slave across two datacenters
>> using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer)
>> server that sits between the application servers and the PostgreSQL server
>> that directs connections to the Master (and the Slave if failover occurs).
>> We also have watchdog processes on the PostgreSQL servers that polls the
>> LTM to determine who is Master and perform automatic failover if required.
>> I am looking at options to improve our high availability.
>>
>> I would like to know how other organizations in different industries
>> (other than education) setup High Availability on their PostgreSQL
>> environments.
>>
>> What tools do you use. Are they commercial licensed products? How is the
>> architecture setup and how do you do recovery of new slave.
>>
>> Your information is greatly appreciated.
>>
>
> An efficient High Availability setup for PostgreSQL would depend on
> various factors like Application, Infrastructure and other Business
> Continuity requirements. In your case, you have already mentioned that the
> Load Balancer continuously polls to check the master status and fails over
> to slave when the former is down. If you are looking at improving this
> setup, then, it is important for us to know how the slave promotion is
> happening ? is that done by some tools like pgPool-II ? Well, those are the
> open-source tools available if you wish to automate the slave promotion
> when the master is down. If you are looking at an highly efficient High
> Availability setup would depend on how a) Application failover and b) slave
> promotion are going hand-in-hand. Following are some of the factors to
> consider which can help improve the efficiency in PostgreSQL High
> Availability -
>
> - Application requirements for continued / uninterrupted data operations
> on slave post the fail-over
> - How fast the slave gets promoted when master fails
> - You need to ensure Master and Slave are in absolute sync all the time
> (importantly just before fail-over)
>
> - Various other factors related to infrastructure like Network, database
> load etc.
>
> Hope that helps !
>
> Regards,
> Venkata B N
>
> Database Consultant
>
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 06:08 John R Pierce <pierce@hogranch.com>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 0 replies; 16+ messages in thread
From: John R Pierce @ 2017-02-23 06:08 UTC (permalink / raw)
To: pgsql-general
On 2/22/2017 2:58 PM, Dylan Luong wrote:
> For PostgreSQL High Availability, we currently have setup a
> Master/Slave across two datacenters using PostgreSQL (WAL) streaming
> replication.
have you considered the ramifications of network problems between these
two datacenters? with a master/slave cluster, you need to avoid the
'split brain' scenario where both servers think they are master because
they can't reach the other.
--
john r pierce, recycling bits in santa cruz
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 08:28 Jehan-Guillaume de Rorthais <ioguix@free.fr>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 0 replies; 16+ messages in thread
From: Jehan-Guillaume de Rorthais @ 2017-02-23 08:28 UTC (permalink / raw)
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; +Cc: pgsql-general
On Wed, 22 Feb 2017 22:58:10 +0000
Dylan Luong <Dylan.Luong@unisa.edu.au> wrote:
> Hi
>
> I am a DBA at the University of South Australia. For PostgreSQL High
> Availability, we currently have setup a Master/Slave across two datacenters
> using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer)
> server that sits between the application servers and the PostgreSQL server
> that directs connections to the Master (and the Slave if failover occurs). We
> also have watchdog processes on the PostgreSQL servers that polls the LTM to
> determine who is Master and perform automatic failover if required.
And how do you deal with split brain ? Fencing? Network partition? What if the
network fail on the master side for 5 minutes? Will the LTM go back to the old
master as soon as the watchdog pool it again?
> I am looking at options to improve our high availability. I would like to
> know how other organizations in different industries (other than education)
> setup High Availability on their PostgreSQL environments. What tools do you
> use. Are they commercial licensed products? How is the architecture setup and
> how do you do recovery of new slave. Your information is greatly appreciated.
We use Pacemaker with the PAF[1] resource agent. Pacemaker takes great care to
avoid split brain using fencing. It mostly supports local cluster, but it
supports multi-site clusters as well thanks to a layer called "Cluster Ticket
Registry"[2].
HA is a complex subject, it requires some time to get familiar with it. Good
luck :)
[1] http://dalibo.github.io/PAF/
[2] http://clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/ch15.html
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-23 08:36 dinesh kumar <dineshkumar02@gmail.com>
parent: Dylan Luong <Dylan.Luong@unisa.edu.au>
5 siblings, 0 replies; 16+ messages in thread
From: dinesh kumar @ 2017-02-23 08:36 UTC (permalink / raw)
To: Dylan Luong <Dylan.Luong@unisa.edu.au>; +Cc: pgsql-general
Hi Dylan,
On Thu, Feb 23, 2017 at 4:28 AM, Dylan Luong <Dylan.Luong@unisa.edu.au>
wrote:
> Hi
>
>
>
> I am a DBA at the University of South Australia. For PostgreSQL High
> Availability, we currently have setup a Master/Slave across two datacenters
> using PostgreSQL (WAL) streaming replication. We use an LTM (load balancer)
> server that sits between the application servers and the PostgreSQL server
> that directs connections to the Master (and the Slave if failover occurs).
> We also have watchdog processes on the PostgreSQL servers that polls the
> LTM to determine who is Master and perform automatic failover if required.
> I am looking at options to improve our high availability.
>
> I would like to know how other organizations in different industries
> (other than education) setup High Availability on their PostgreSQL
> environments.
>
Below is the approach we have followed, to achieve the maximum HA with
async streaming replication.
1. Create an instance "I" with "N" number of nodes.
2. Set up the replication among the "N" nodes as "N-1" nodes points to 1
master.
3. Configured 2 physical replication slots to each "N-1" nodes.
4. One replication slot is to receive the archives, and one is for doing
the replication. (Suspected recovery process is slower than the receiver
process)
5. Configured a parallel WAL uploader (Customized program) on master to
wal-backup server. (We needed this for the PITR)
6. Implemented a quorum on "N-1" slaves as one should become as master in
worst cases. (Guaranteed data availability as per RTO settings)
7. Watchdog process which update the pgbouncer configuration from master to
the latest master.
8. Used consul service discovery for identifying the master, slave heart
beats.
9. Once Failover is completed, "N-1"(including old master) follows the new
master by doing a fresh refresh. (Planning to use pg_rewind)
10. Covered the split brain problems by removing the service discovery keys
from consul. (It's delivering the promising results, but need to spend more
time on this).
The above mentioned approach what we have done is similar to your's, but we
needed to handle with multiple slaves rather single one. In case, if you
are looking for any open source tools to implement in your production
servers, then prefer to add repmgr, pgHA, PAF tools into your list. These
open source tools are great and deliver the results as demonstrated.
> What tools do you use. Are they commercial licensed products? How is the
> architecture setup and how do you do recovery of new slave.
>
> Your information is greatly appreciated.
>
>
>
> Regards
>
> Dylan
>
>
>
> *Dylan Luong*
>
> *Information Strategy & Technology Services*
>
> University of South Australia
>
> A Building, Room E2-07, Mawson Lakes Campus
>
> MAWSON LAKES
>
> South Australia 5095
>
>
>
> Email: *dylan.luong@unisa.edu.au <dylan.luong@unisa.edu.au>*
>
> Phone: +61 8 83023629 <+61%208%208302%203629>
>
> Fax: +61 8 83023577 <+61%208%208302%203577>
>
> WWW: http://www.unisa.edu.au
>
>
>
--
Regards,
Dinesh
manojadinesh.blogspot.com
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2017-02-24 18:03 kbrannen@pwhome.com
0 siblings, 0 replies; 16+ messages in thread
From: kbrannen@pwhome.com @ 2017-02-24 18:03 UTC (permalink / raw)
To: pgsql-general
Julyanto Sutandang <julyanto@equnix.id> wrote:
> Talking about High Availability, we should understand the basic concept of HA, it is avoiding SPOF (Single Point of Failure). When we use a Loadbalancer (LTM) and that load balancer is single, then you may get HA only for the PostgreSQL but there are another single point of failure, it is the LTM it self. In overall that topology is not HA.
>
> The best configuration for HA i know is using Linux-HA to watch between 2 servers and doing failover VIP (Virtual IP) when Master is down or out of service. The best configuration for HA, Servers should be on the same site and uses direct cable connection to ensure dedicated private bandwidth and there are no Single Point of Failure.
> LinuxHA or pacemaker or corosync will do the Virtual IP swing over from master host to slave host and promote the replica database in slave host become master.
>
> There is no single point of failure.
I'll agree with most of this, especially that avoiding SPOF is the goal.
However, I will point out that if you put both servers in the same site that you've created a SPOF. If you lose power at that site, or construction workers takes out the network cable to the building, or any other thing that can happen to take the whole site down, any of that will cause total failure.
If you really want to avoid that, then the 2 servers need to sit multiple miles/kilometers apart and be served by a dedicated connection or else 2 different network providers (I've heard differing opinions on the best way) that is 100Mb or higher to adequately deal with the various replication issues that must be addressed. If the load is high enough, you may need multiple lines to be bonded or else even Gb.
Of course, the OP may not need that level of HA, but it is something that should be asked and answered by him and his organization.
It's something we deal with for our larger customers. We currently solve the replication with DRBD (for the DB) and csync2 (for the application code and logs). We are slowly considering the question if we'd be better off abandoning DRBD and using Pg's builtin replication, but the jury is still out on that as we haven't had enough time to fully figure it out. We'd considered ZFS replication for a while, but found ZFS to be too slow for the DB despite it's other useful features like replication (at least for the hardware that we had).
Personally, I find HA easy to understand but hard to implement well -- especially without a large budget. :)
HTH,
Kevin
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 16+ messages in thread
* Postgres HA
@ 2018-01-05 19:07 Azimuddin Mohammed <azimeiu@gmail.com>
0 siblings, 3 replies; 16+ messages in thread
From: Azimuddin Mohammed @ 2018-01-05 19:07 UTC (permalink / raw)
To: pgsql-admin@postgresql.org; pgsql-general
Hello,
I am little confused with how HA works in postgres. Reading the article
which state as below "*If the primary server fails and the standby server
becomes the new primary, and then the old primary restarts, you must have a
mechanism for informing the old primary that it is no longer the primary.
This is sometimes known as STONITH (Shoot The Other Node In The Head),
which is necessary to avoid situations where both systems think they are
the primary, which will lead to confusion and ultimately data loss.*
*Many failover systems use just two systems, the primary and the standby,
connected by some kind of heartbeat mechanism to continually verify the
connectivity between the two and the viability of the primary. It is also
possible to use a third system (called a witness server) to prevent some
cases of inappropriate failover, but the additional complexity might not be
worthwhile unless it is set up with sufficient care and rigorous testing.*
*PostgreSQL does not provide the system software required to identify a
failure on the primary and notify the standby database server. Many such
tools exist and are well integrated with the operating system facilities
required for successful failover, such as IP address migration."*
Can someone explain how the HA failback will take place and what open
source tools we can use to make sure once the primary server which failed
over to slave will mark itself as slave.
Appreciate your response in advance.
--
Regards,
Azim
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&...;
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&...;
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-05 19:18 Scott Marlowe <scott.marlowe@gmail.com>
parent: Azimuddin Mohammed <azimeiu@gmail.com>
2 siblings, 0 replies; 16+ messages in thread
From: Scott Marlowe @ 2018-01-05 19:18 UTC (permalink / raw)
To: Azimuddin Mohammed <azimeiu@gmail.com>; +Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>; pgsql-general
On Fri, Jan 5, 2018 at 12:07 PM, Azimuddin Mohammed <azimeiu@gmail.com> wrote:
>
> Hello,
> I am little confused with how HA works in postgres. Reading the article which state as below "If the primary server fails and the standby server becomes the new primary, and then the old primary restarts, you must have a mechanism for informing the old primary that it is no longer the primary. This is sometimes known as STONITH (Shoot The Other Node In The Head), which is necessary to avoid situations where both systems think they are the primary, which will lead to confusion and ultimately data loss.
>
> Many failover systems use just two systems, the primary and the standby, connected by some kind of heartbeat mechanism to continually verify the connectivity between the two and the viability of the primary. It is also possible to use a third system (called a witness server) to prevent some cases of inappropriate failover, but the additional complexity might not be worthwhile unless it is set up with sufficient care and rigorous testing.
>
> PostgreSQL does not provide the system software required to identify a failure on the primary and notify the standby database server. Many such tools exist and are well integrated with the operating system facilities required for successful failover, such as IP address migration."
>
> Can someone explain how the HA failback will take place and what open source tools we can use to make sure once the primary server which failed over to slave will mark itself as slave.
>
There are LOTS of ways to implement HA.
Here's a book on the subject that's 537 pages long, and is only $4.99 right now:
https://www.packtpub.com/big-data-and-business-intelligence/postgresql-high-availability-cookbook-se...
I've been reading it a bit, seems to be a good resource.
--
To understand recursion, one must first understand recursion.
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-05 19:32 Rui DeSousa <rui.desousa@icloud.com>
parent: Azimuddin Mohammed <azimeiu@gmail.com>
2 siblings, 0 replies; 16+ messages in thread
From: Rui DeSousa @ 2018-01-05 19:32 UTC (permalink / raw)
To: Azimuddin Mohammed <azimeiu@gmail.com>; +Cc: pgsql-admin@postgresql.org; pgsql-general
There are many different solutions; but I would recommend and use a least a three node cluster using synchronous replication where one of the nodes is acting as the witness — at a minimum (actual have more replicas). The witness node need not be a full Postgres instance; it can also be achieved by using pg_recievexlog as the witness instead. This setup avoids a the split brain situation by making sure there is only one writable instance and that is the one that the witness is following.
I use CARP (Common Address Redundancy Protocol) to manage the HA IP address (very platform specific); when the address flips over to a replica it automatically promotes the replica and witness follows the HA address thus signing off on the self promotion.
The old primary then needs to be reconfigured as a replia which can be done using pg_rewind or other numerous other solutions; i.e. snapshots, backup, etc.
I have not personally used this solution; but you could look at 2ndQuadrant repmgr product if you’re looking a packaged solution.
https://www.2ndquadrant.com/en/resources/repmgr/installation-instructions/
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-05 21:00 Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
parent: Azimuddin Mohammed <azimeiu@gmail.com>
2 siblings, 1 reply; 16+ messages in thread
From: Jehan-Guillaume (ioguix) de Rorthais @ 2018-01-05 21:00 UTC (permalink / raw)
To: Azimuddin Mohammed <azimeiu@gmail.com>; +Cc: pgsql-admin@postgresql.org; pgsql-general
On Fri, 5 Jan 2018 13:07:10 -0600
Azimuddin Mohammed <azimeiu@gmail.com> wrote:
> Hello,
> I am little confused with how HA works in postgres. Reading the article
> which state as below "*If the primary server fails and the standby server
> becomes the new primary, and then the old primary restarts, you must have a
> mechanism for informing the old primary that it is no longer the primary.
> This is sometimes known as STONITH (Shoot The Other Node In The Head),
> which is necessary to avoid situations where both systems think they are
> the primary, which will lead to confusion and ultimately data loss.*
>
> *Many failover systems use just two systems, the primary and the standby,
> connected by some kind of heartbeat mechanism to continually verify the
> connectivity between the two and the viability of the primary. It is also
> possible to use a third system (called a witness server) to prevent some
> cases of inappropriate failover, but the additional complexity might not be
> worthwhile unless it is set up with sufficient care and rigorous testing.*
> *PostgreSQL does not provide the system software required to identify a
> failure on the primary and notify the standby database server. Many such
> tools exist and are well integrated with the operating system facilities
> required for successful failover, such as IP address migration."*
>
> Can someone explain how the HA failback will take place
The failback need either to rebuild the old master as a standby (rsync,
pg_basebackup, restore PITR, ...) or to use pg_rewind to rewind the old master
to a point where it can catch up with the new master.
Some tools tries to automate failback using pg_rewind (patroni, repmgr), but I
have no experience with them.
> and what open source tools we can use to make sure once the primary server
> which failed over to slave will mark itself as slave.
There's a lot of open source tools to build some HA around PgSQL: Repmgr,
Patroni (based on etcd or zookeeper), PAF (based on Pacemaker), etc. You will
have to spend a lot of time to make extensive tests, understand them, pick one
and document your cluster.
Regards,
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-06 01:07 John Scalia <jayknowsunix@gmail.com>
parent: Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
0 siblings, 1 reply; 16+ messages in thread
From: John Scalia @ 2018-01-06 01:07 UTC (permalink / raw)
To: Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>; +Cc: Azimuddin Mohammed <azimeiu@gmail.com>; pgsql-admin@postgresql.org; pgsql-general
What he said, and you also may want to look at pgpool-II. I’ve had fairly good luck with that and Tatsuo (the author) hangs out here occasionally too.
—
Jay
Sent from my iPad
> On Jan 5, 2018, at 4:00 PM, Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr> wrote:
>
> On Fri, 5 Jan 2018 13:07:10 -0600
> Azimuddin Mohammed <azimeiu@gmail.com> wrote:
>
>> Hello,
>> I am little confused with how HA works in postgres. Reading the article
>> which state as below "*If the primary server fails and the standby server
>> becomes the new primary, and then the old primary restarts, you must have a
>> mechanism for informing the old primary that it is no longer the primary.
>> This is sometimes known as STONITH (Shoot The Other Node In The Head),
>> which is necessary to avoid situations where both systems think they are
>> the primary, which will lead to confusion and ultimately data loss.*
>>
>> *Many failover systems use just two systems, the primary and the standby,
>> connected by some kind of heartbeat mechanism to continually verify the
>> connectivity between the two and the viability of the primary. It is also
>> possible to use a third system (called a witness server) to prevent some
>> cases of inappropriate failover, but the additional complexity might not be
>> worthwhile unless it is set up with sufficient care and rigorous testing.*
>> *PostgreSQL does not provide the system software required to identify a
>> failure on the primary and notify the standby database server. Many such
>> tools exist and are well integrated with the operating system facilities
>> required for successful failover, such as IP address migration."*
>>
>> Can someone explain how the HA failback will take place
>
> The failback need either to rebuild the old master as a standby (rsync,
> pg_basebackup, restore PITR, ...) or to use pg_rewind to rewind the old master
> to a point where it can catch up with the new master.
>
> Some tools tries to automate failback using pg_rewind (patroni, repmgr), but I
> have no experience with them.
>
>> and what open source tools we can use to make sure once the primary server
>> which failed over to slave will mark itself as slave.
>
> There's a lot of open source tools to build some HA around PgSQL: Repmgr,
> Patroni (based on etcd or zookeeper), PAF (based on Pacemaker), etc. You will
> have to spend a lot of time to make extensive tests, understand them, pick one
> and document your cluster.
>
> Regards,
>
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-06 02:09 Tatsuo Ishii <ishii@sraoss.co.jp>
parent: John Scalia <jayknowsunix@gmail.com>
0 siblings, 1 reply; 16+ messages in thread
From: Tatsuo Ishii @ 2018-01-06 02:09 UTC (permalink / raw)
To: jayknowsunix@gmail.com; +Cc: ioguix@free.fr; azimeiu@gmail.com; pgsql-admin@postgresql.org; pgsql-general
Hi,
Yes, definitely I am hanging out here.
If you have more specific questions to Pgpool-II, you are encouraged
to be subscribed to the Pgpool-II mailing list.
https://www.pgpool.net/mailman/listinfo/pgpool-general
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
> What he said, and you also may want to look at pgpool-II. I$B!G(Bve had fairly good luck with that and Tatsuo (the author) hangs out here occasionally too.
> $B!=(B
> Jay
>
> Sent from my iPad
>
>> On Jan 5, 2018, at 4:00 PM, Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr> wrote:
>>
>> On Fri, 5 Jan 2018 13:07:10 -0600
>> Azimuddin Mohammed <azimeiu@gmail.com> wrote:
>>
>>> Hello,
>>> I am little confused with how HA works in postgres. Reading the article
>>> which state as below "*If the primary server fails and the standby server
>>> becomes the new primary, and then the old primary restarts, you must have a
>>> mechanism for informing the old primary that it is no longer the primary.
>>> This is sometimes known as STONITH (Shoot The Other Node In The Head),
>>> which is necessary to avoid situations where both systems think they are
>>> the primary, which will lead to confusion and ultimately data loss.*
>>>
>>> *Many failover systems use just two systems, the primary and the standby,
>>> connected by some kind of heartbeat mechanism to continually verify the
>>> connectivity between the two and the viability of the primary. It is also
>>> possible to use a third system (called a witness server) to prevent some
>>> cases of inappropriate failover, but the additional complexity might not be
>>> worthwhile unless it is set up with sufficient care and rigorous testing.*
>>> *PostgreSQL does not provide the system software required to identify a
>>> failure on the primary and notify the standby database server. Many such
>>> tools exist and are well integrated with the operating system facilities
>>> required for successful failover, such as IP address migration."*
>>>
>>> Can someone explain how the HA failback will take place
>>
>> The failback need either to rebuild the old master as a standby (rsync,
>> pg_basebackup, restore PITR, ...) or to use pg_rewind to rewind the old master
>> to a point where it can catch up with the new master.
>>
>> Some tools tries to automate failback using pg_rewind (patroni, repmgr), but I
>> have no experience with them.
>>
>>> and what open source tools we can use to make sure once the primary server
>>> which failed over to slave will mark itself as slave.
>>
>> There's a lot of open source tools to build some HA around PgSQL: Repmgr,
>> Patroni (based on etcd or zookeeper), PAF (based on Pacemaker), etc. You will
>> have to spend a lot of time to make extensive tests, understand them, pick one
>> and document your cluster.
>>
>> Regards,
>>
>
^ permalink raw reply [nested|flat] 16+ messages in thread
* Re: Postgres HA
@ 2018-01-06 02:30 Azimuddin Mohammed <azimeiu@gmail.com>
parent: Tatsuo Ishii <ishii@sraoss.co.jp>
0 siblings, 0 replies; 16+ messages in thread
From: Azimuddin Mohammed @ 2018-01-06 02:30 UTC (permalink / raw)
To: Tatsuo Ishii <ishii@sraoss.co.jp>; +Cc: jayknowsunix@gmail.com; ioguix@free.fr; pgsql-admin@postgresql.org; pgsql-general
Thank you..I have subscribed to the list..
On Jan 5, 2018 8:09 PM, "Tatsuo Ishii" <ishii@sraoss.co.jp> wrote:
> Hi,
>
> Yes, definitely I am hanging out here.
>
> If you have more specific questions to Pgpool-II, you are encouraged
> to be subscribed to the Pgpool-II mailing list.
> https://www.pgpool.net/mailman/listinfo/pgpool-general
>
> Best regards,
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese:http://www.sraoss.co.jp
>
> > What he said, and you also may want to look at pgpool-II. I’ve had
> fairly good luck with that and Tatsuo (the author) hangs out here
> occasionally too.
> > ―
> > Jay
> >
> > Sent from my iPad
> >
> >> On Jan 5, 2018, at 4:00 PM, Jehan-Guillaume (ioguix) de Rorthais <
> ioguix@free.fr> wrote:
> >>
> >> On Fri, 5 Jan 2018 13:07:10 -0600
> >> Azimuddin Mohammed <azimeiu@gmail.com> wrote:
> >>
> >>> Hello,
> >>> I am little confused with how HA works in postgres. Reading the article
> >>> which state as below "*If the primary server fails and the standby
> server
> >>> becomes the new primary, and then the old primary restarts, you must
> have a
> >>> mechanism for informing the old primary that it is no longer the
> primary.
> >>> This is sometimes known as STONITH (Shoot The Other Node In The Head),
> >>> which is necessary to avoid situations where both systems think they
> are
> >>> the primary, which will lead to confusion and ultimately data loss.*
> >>>
> >>> *Many failover systems use just two systems, the primary and the
> standby,
> >>> connected by some kind of heartbeat mechanism to continually verify the
> >>> connectivity between the two and the viability of the primary. It is
> also
> >>> possible to use a third system (called a witness server) to prevent
> some
> >>> cases of inappropriate failover, but the additional complexity might
> not be
> >>> worthwhile unless it is set up with sufficient care and rigorous
> testing.*
> >>> *PostgreSQL does not provide the system software required to identify a
> >>> failure on the primary and notify the standby database server. Many
> such
> >>> tools exist and are well integrated with the operating system
> facilities
> >>> required for successful failover, such as IP address migration."*
> >>>
> >>> Can someone explain how the HA failback will take place
> >>
> >> The failback need either to rebuild the old master as a standby (rsync,
> >> pg_basebackup, restore PITR, ...) or to use pg_rewind to rewind the old
> master
> >> to a point where it can catch up with the new master.
> >>
> >> Some tools tries to automate failback using pg_rewind (patroni,
> repmgr), but I
> >> have no experience with them.
> >>
> >>> and what open source tools we can use to make sure once the primary
> server
> >>> which failed over to slave will mark itself as slave.
> >>
> >> There's a lot of open source tools to build some HA around PgSQL:
> Repmgr,
> >> Patroni (based on etcd or zookeeper), PAF (based on Pacemaker), etc.
> You will
> >> have to spend a lot of time to make extensive tests, understand them,
> pick one
> >> and document your cluster.
> >>
> >> Regards,
> >>
> >
>
^ permalink raw reply [nested|flat] 16+ messages in thread
end of thread, other threads:[~2018-01-06 02:30 UTC | newest]
Thread overview: 16+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 22:58 Postgres HA Dylan Luong <Dylan.Luong@unisa.edu.au>
2017-02-23 00:26 ` Andrew Sullivan <ajs@crankycanuck.ca>
2017-02-23 01:36 ` Julyanto Sutandang <julyanto@equnix.id>
2017-02-23 04:38 ` Venkata B Nagothi <nag1010@gmail.com>
2017-02-23 06:00 ` JD <venkijd@gmail.com>
2017-02-23 06:08 ` John R Pierce <pierce@hogranch.com>
2017-02-23 08:28 ` Jehan-Guillaume de Rorthais <ioguix@free.fr>
2017-02-23 08:36 ` dinesh kumar <dineshkumar02@gmail.com>
2017-02-24 18:03 Re: Postgres HA kbrannen@pwhome.com
2018-01-05 19:07 Postgres HA Azimuddin Mohammed <azimeiu@gmail.com>
2018-01-05 19:18 ` Scott Marlowe <scott.marlowe@gmail.com>
2018-01-05 19:32 ` Rui DeSousa <rui.desousa@icloud.com>
2018-01-05 21:00 ` Jehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
2018-01-06 01:07 ` John Scalia <jayknowsunix@gmail.com>
2018-01-06 02:09 ` Tatsuo Ishii <ishii@sraoss.co.jp>
2018-01-06 02:30 ` Azimuddin Mohammed <azimeiu@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox