My steps:
- run the final
pg_dumpallon a serverprod-server-old - Shut down
prod-server-oldfor ever. - copy the output to a different server (
prod-server-new) - Restore the db there.
- All traffic goes to
prod-server-newnow
How can I avoid modification to the database during pg_dumpall (between step1 and step2), so that modifications during this time cannot be lost?
In my case it is 100% OK to have a small down time.
There are several databases in the "cluster" (btw, I do not like the word "cluster". I guess most people think a "cluster" is a group of several computers, but in this case it means one Postgres server, which holds several databases).
My question was marked as possible duplicate to "Make Postgres database temporarily read-only (for performing volume snapshots)". I don't think it is a duplicate, since in my case is different since I don't ask for a temporary read-only state.