D
D
Denis Lysenko2014-10-20 09:35:35
PostgreSQL
Denis Lysenko, 2014-10-20 09:35:35

How to switch between master and slave in Postgres?

There is a task to make a failover cluster, there are two servers in two different DCs, completely identical. If one server crashes, the second should continue to work (for the user, of course, nothing should be noticeable).
At first they wanted to do master - master (active - active), but we were dissuaded. Now the task is to make sure that one is the master, the second is the slave. If the slave falls, we do not change anything, we work only with the master. If the master falls, you need to quickly switch to the slave and make it the master. How can this be done faster?
Is it possible to make both servers be masters, we just choose which one to write to at the application level (so that there is no simultaneous writing to both servers and master-master replication problems do not come out).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
brutal_lobster, 2014-10-20
@brutal_lobster

There is documentation:
www.postgresql.org/docs/9.3/static/high-availabili...
Regarding active-active, you need to understand whether a low RTO is justified, analyze the specific application architecture, determine what is more important - database consistency or its availability.
Look at the fault tree (especially with short-term ones in the network) - you will immediately see that it is not so easy to determine which node to write to - many factors need to be taken into account.
And if consistency is still important, it's better to use a guaranteed failover than to rely on chance :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question