tianon / docker-postgres-upgrade

a PoC for using "pg_upgrade" inside Docker -- learn from it, adapt it for your needs; don't expect it to work as-is!
https://hub.docker.com/r/tianon/postgres-upgrade/
MIT License
1.04k stars 114 forks source link

10-to12: connection to database failed: could not connect to server: No such file or directory #31

Closed adacaccia closed 3 years ago

adacaccia commented 4 years ago

Directory structure under /mnt/ocfs2/timescaledb: find /mnt/ocfs2/timescaledb/ -mindepth 2 -maxdepth 2 /mnt/ocfs2/timescaledb/10/data /mnt/ocfs2/timescaledb/12/data

Command run: docker run --rm -v /mnt/ocfs2/timescaledb:/var/lib/postgresql tianon/postgres-upgrade:10-to-12 --check -O "-c timescaledb.restoring='on'"

Results in following output:

Performing Consistency Checks on Old Live Server

Checking cluster versions ok connection to database failed: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? Failure, exiting

It is just impossible to get to a Unix socket in another running container! Moreover, the 10-to-12 image downloads and installs the 10 version package, so in theory could run it locally; this would lead to:

yosifkit commented 4 years ago

I would guess that --check doesn't start the temporary servers that just pg_upgrade does when actually doing the upgrade, so it likely doesn't work in a container (but maybe PGHOST to your running container would make it work).

jicki commented 3 years ago

pls How to solve this problem.

9.6 to 12

connection to database failed: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/lib/postgresql/.s.PGSQL.50432"?

Solution:

cat pg_upgrade_server.log

    LOG:  invalid value for parameter "lc_monetary":  "zh_CN.UTF-8"

update lc_monetary": "zh_CN.UTF-8" to lc_monetary": "en.US.UTF-8"

cobolbaby commented 3 years ago

@jicki

I also met the same question, but the reason is that I didn't specify the env PGDATAOLD which is different from the default value.

Besides, I'd like to know how to check the pg_upgrade_server.log after the pg_upgrade container exit?

theAkito commented 3 years ago

I'd like to know how to check the pg_upgrade_server.log after the pg_upgrade container exit?

You could, for example, put it into a host volume.