2


I used this https://github.com/tianon/docker-postgres-upgrade to upgrade postgres from 11 to 12 version & facing issue while upgrade, got error - "postmaster servicing the old cluster"

Here using docker container for 11 & 12 in separately, also scale down docker service before that upgarde, but not sure why this postmaster issue came & how to fix this.??

docker run --rm \
    -v aip-pgs-data:/var/lib/postgresql/$OLD/data \
    -v aip-pg12-data:/var/lib/postgresql/$NEW/data \
    "tianon/postgres-upgrade:$OLD-to-$NEW"

Above docker run cmd part of logs:--

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/12/data -l logfile start


There seems to be a postmaster servicing the old cluster.
Please shutdown that postmaster and try again.
Failure, exiting
0a5839ad7309d6256510fe89513774a16c4f26ec6a827f9f0089fd8cc10254cb

Thank you in advance.

4

2 回答 2

1

The problem is that the postgres server isn't shutting down cleanly before docker kills it, but stopping the process will also restart the container.

Another option is to disable restarts

docker update --restart=no $CONTAINER_ID

then exec into the container

docker exec -it $CONTAINER_ID bash

find the pg_ctl binary, su to the postgres user, then run pg_ctl stop

# which pg_ctl
/usr/lib/postgresql/12/bin/pg_ctl
# su postgres
$ /usr/lib/postgresql/12/bin/pg_ctl stop
于 2021-02-25T19:52:29.840 回答
0

I tried a longer stop_grace_period so that postgresql server will have enough time to stop everything when it receives the SIGTERM (postgresql.org/docs/11/server-shutdown.html). Then postgres stopped

于 2019-11-08T08:03:59.053 回答