New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document postgresql upgrade #82739
Document postgresql upgrade #82739
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a couple of nitpicks, but this already is much better than nothing :)
</listitem> | ||
<listitem> | ||
<para> | ||
After upgrade you may want to <literal>ANALYZE</literal> new db. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is worth mentioning the two scripts pg_upgrade
created here in new db dir? (analyze_new_cluster.sh and delete_old_cluster.sh)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For convenience, would you mind referencing the postgresql-manual about ANALYZE here?
</listitem> | ||
<listitem> | ||
<para> | ||
Run <literal>upgrade-pg-cluster</literal>. It will stop old postgresql, initialize new one and migrate old one to new one. You may supply arguments like <literal>--jobs 4</literal> and <literal>--link</literal> to speedup migration process. See <link xlink:href="https://www.postgresql.org/docs/current/pgupgrade.html" /> for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
migrate
usually means the data is converted and old one is removed, but it might be worth saying old data is left in place?
@@ -63,25 +53,83 @@ Type "help" for help. | |||
<title>Upgrading</title> | |||
|
|||
<para> | |||
FIXME: document dump/upgrade/load cycle. | |||
Major PostgreSQL upgrade requires PostgreSQL downtime and a few imperative steps to be called. To simplify this process, use the following NixOS module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to link the upstream docs about upgrading (if any) here. This provides users an easy way to troubleshoot in case something goes wrong.
And it might be useful to remind people reading this to make a backup first :)
## set a custom new dataDir | ||
# dataDir = "/some/data/dir"; | ||
}; | ||
environment.systemPackages = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nitpick) how about linking service options using <link linkend="opt-attr.path">text</link>
?
export OLDBIN="${config.services.postgresql.package}/bin" | ||
export NEWBIN="${newpg.package}/bin" | ||
|
||
install -d -m 0700 -o postgres -g postgres "$NEWDATA" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use ${config.service.postgresql.superUser}
here.
environment.systemPackages = | ||
let newpg = config.containers.temp-pg.config.services.postgresql; | ||
in [ | ||
(pkgs.writeScriptBin "upgrade-pg-cluster" '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering if something like this should be part of the actual postgresql
-module.
</listitem> | ||
<listitem> | ||
<para> | ||
After upgrade you may want to <literal>ANALYZE</literal> new db. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For convenience, would you mind referencing the postgresql-manual about ANALYZE here?
I tried the instructions and it did work, thanks! |
@Ma27 @martinetd This being a doc PR that doesn't appear to include wrong information, and nixos being in a state where any doc is better than no doc, I'm merging and backporting -- would be happy if you sent in PR's/commits with the improvements you listed, though, feel free to poke me (ideally on IRC) about them if need be :) |
Fixes #7454. Rendered:
cc @martinetd @domenkozar @Shados @wizeman are wording/upgrade method instructions clear?