I'm upgrading an existing dockerized postgres:9.6 to 10. There are plenty of good Q/As on DBA and SO that go the path of pg_upgradecluster
, but it is not working for me.
When I start a vanilla pg:10 instance, whether I mount the old volume or not, pg_lsclusters
is empty.
root@server:# docker run -it -d --name pg10 postgres:10
...
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
...
2018-07-15 05:11:52.569 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2018-07-15 05:11:52.635 UTC [68] LOG: database system was shut down at 2018-07-15 05:11:52 UTC
2018-07-15 05:11:52.651 UTC [1] LOG: database system is ready to accept connections
Connections work:
root@server:# docker exec -it pg10 psql -h localhost -U postgres postgres
psql (10.4 (Debian 10.4-2.pgdg90+1))
Type "help" for help.
postgres=#
But clusters are not found:
root@server:# docker exec -it pg10 su postgres -c pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
(Nothing given.) If that will work, then I'm intending to mount the old db volume as another cluster (via steps listed in https://stackoverflow.com/a/47233300/3358272).
I don't understand enough about the db layout to know why the default postgresql image does not produce its default database as a cluster that can be seen with this utility. Help?
Edit: the current installation lists them just fine, though it's an instance of sameersbn/postgresql
, not the pg-central version:
root@server:# docker-compose exec postgresql pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
The library image defaults to creating a new database under /var/lib/postgresql/data
(no version, no main
).
/var/lib/postgresql/data
looks un-debianDockerfile
asFROM debian:stretch-slim
, and it's the explicit default forPGDATA
in the docker hub library readme (scroll down to the *Enrivonment Variables*/PGDATA
section). How does that even matter, @Jasen?initdb
to create the new database vice usingpg_createclusters
. I'm trying to override that, hoping it'll facilitate the next step.