PG_upgrade with Rsync 9.6 to 13 on Standby Server – Postgres password prompt issue

All we need is an easy explanation of the problem, so here it is.

I am utilising the pg_upgrade documentation for 9.6 to 13. I can upgrade from 9.6 to 13 with the –link issue without issue on the master server. I have a slave machine which I want to upgrade, instead rebuilding the slave (which will take considerable amount of time) I want to utilise the rsync which is documented in pg_upgrade documentation.

The servers both have the postgres software followed by the custom shared objects etc.

When running rsync it is prompting for the postgres password.

rsync –archive –delete –hard-links –size-only –no-inc-recursive –dry-run /var/lib/pgsql/9.6 /var/lib/pgsql/13 remoteserverIP:/var/lib/pgsql/13 –dry-run

I do not know the postgres password, however I could reset the postgres password within a psql window on the slave machine, is there anyway of bypassing this?

Any help is much apprecaited.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

You should set up SSH keys that allow you to connect to the other machine without a password:

On the primary, become user postgres and run

ssh-keygen

to create an ssh key without password.

Then add the public key generated in ~postgres/.ssh to ~postgres/.ssh/authorized_keys on the standby server.

Now user postgres on the primary should be able to ssh to the standby without a password. Then rsync should work without a password as well.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply