0

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.

5
  • It is asking for the password of the OS account 'postgres', which is not something you can change with psql. You can do the rsync as root instead, if you don't want to assign a password for 'postgres'.
    – jjanes
    Jun 16, 2021 at 15:41
  • @jjanes when doing as root it still asks me for root password, which I also dont know....
    – rdbmsNoob
    Jun 16, 2021 at 15:45
  • How did you pg_upgrade master in the first place? You need to get file-level access somehow to do that.
    – jjanes
    Jun 16, 2021 at 19:44
  • @jjanes I did pg_upgrade on the master logged into the master, when I go to do rsync against the slave machine as root user requests password for remote root user I assume.
    – rdbmsNoob
    Jun 17, 2021 at 7:02
  • Sorry, should have asked how you set up replication in the first place. You need an OS account you can log on to on the replica to do that, right?
    – jjanes
    Jun 17, 2021 at 13:09

1 Answer 1

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.

1
  • Thanks @laurenz-albe that did the trick.
    – rdbmsNoob
    Jun 17, 2021 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.