Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know what is the way to switch the role of 2 servers when using warm standby?

I have 2 servers : S_1 and S_2, and at a time T, S_1 is the master server and S_2 is a warm standby with streaming replication.

At a later moment, I would like to switch S_2 become the master server and S_1 the warm standby.

What do I have to do to switch roles ?

share|improve this question
a warm standby or a hot standby? In Postgres, "warm standby" is usually used to refer to a second server which is keeping up to date, but not accepting connections. – Josh Berkus Dec 3 '12 at 23:36
Yes, the second server is a warm standby, and I like to know what steps are needed to switch master and warm standby mode. – iXô Dec 4 '12 at 13:04

Keep in mind that currently you cannot demote a master to a standby. Doing so will corrupt your database!

The basic documentation for doing this is at:

However the basic thing is you can't switch these other than:

  1. Turn off primary

  2. Promote secondary

  3. Rebuild former primary as new secondary off the new primary.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.