Open
Description
There doesn't seem to be a good way to upgrade between major versions of postgres. When sharing the volume with a new container with a newer version of postgres it won't run as the data directory hasn't been upgraded. pg_upgrade
on the other hand requires (?) old installation binary files, so upgrading the data files from new server container is also difficult.
It would be nice if there was some suggested way of doing this in the readme. Maybe even some meta container which does the upgrading from version to version?
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
md5 commentedon Nov 23, 2014
The "Usage" section of this document describes what
pg_upgrade
does: http://www.postgresql.org/docs/9.4/static/pgupgrade.htmlroosmaa commentedon Nov 23, 2014
I guess my concern does not communicate well in the first comment... Lets try again.
pg_upgrade
functionality is perfectly clear: you need to have both postgres [old] and [new] versions installed at the same time to upgrade the data structures on disk. But what is not clear is the best way of going about the upgrade when using containers, since every container only has a single version of postgres available/installed.It would be fairly useful to have a section in the Readme regarding how to approach this. (And what to avoid?)
tianon commentedon Nov 23, 2014
I've been wondering about/looking out for a good way to handle this
myself. If someone's got a good flow that works well for them, I'm very
interested in getting something documented (and "transition images" added
if that's what's necessary here -- this is a common enough thing IMO that
it doesn't really make sense to have everyone create their own for their
one-off needs).
Perhaps for each "supported" version, we could add a variant that also
installs the latest major release, and then we document how to create your
own one-off transition container if you need a transition more esoteric
than that?
md5 commentedon Nov 23, 2014
@roosmaa: my comment wasn't so much directed at you as intended as background.
kajmagnus commentedon Jan 13, 2015
+1 for major version upgrade instructions.
Yet another alternative, for smaller databases (?), should be that the old container runs
pg_dumpall
and saves the dump somewhere in the volume. Then one stops the container, starts a new one with the new major version, and it imports the dump.mpe commentedon Mar 20, 2015
Yeah this is a major pain ... at the moment. Would be great to get some official way to do it.
belak commentedon Jun 16, 2015
Yeah, just nuked my postgres install on accident with an upgrade. Are there any plans for this?
mkarg commentedon Dec 29, 2015
I am not a docker guru, but I could imagine that it is possible to add some script to the container that is started when the container starts. That script should check the database files, and when it detects the correct version, simply startup the postgresql engine. If not, it should decide to run pgupgrade or dump/reload. Shouldn't be rocket science?
tianon commentedon Dec 29, 2015
dcbishop commentedon Jan 31, 2016
+1.
I'm just going to nuke what I have since it's just a personal server I don't really use, but this seems like a major pain maintenance wise.
Dirbaio commentedon Feb 5, 2016
I've had success upgrading launching another postgres instance with the new version, and then using dumpall and psql to move all the data piping:
It's rather simple :)
pg_upgrade is supposed to be faster though, I'm interested if someone has an easy way of using it.
asprega commentedon Mar 8, 2016
I was attempting to hack up a bash script to manage the upgrade process between two containers of different versions by using
pg_upgrade
, but I hit a roadblock:the idea is a bit convoluted, because I'm extracting the binaries from the old version and mounting them into a new temporary container created from the same image of the container with the new version, along with data volumes from existing containers (the old and the new ones).
My idea was then to use that container to run pg_upgrade, then throw it away (and data would have been migrated through the two volumes).
When running the script, though, I get the following error:
Any ideas?
donnykurnia commentedon Mar 11, 2016
I'm using @Dirbaio tricks to dump all data from old container and restore it into the new container. Of course, this needs separate data volume and run fast with small data sets. I hope that pr_upgrade can be more 'intelligent', even better if the Postgres itself could do the upgrade by itself. I mean, when installing the new version, the apps should also know how old version format looks like. Maybe also include a necessary old version binary to do the data 'upgrade' then after the upgrade finished, just delete that old version binary.
julienmathevet commentedon Apr 8, 2016
+1
171 remaining items