pg_easy_replicate: "connection failed" trying to use account not specified in config

During bootstrap phase, pg_easy_replicate fails with

Unable to bootstrap: PG::ConnectionBad: connection to server at "10.7.0.10", port 25432 failed: SSL error: certificate verify failed
connection to server at "10.7.0.10", port 25432 failed: FATAL:  password authentication failed for user "pger_su"

message. That is strange, because postgres://postgres:secret@10.7.0.10:25432/database credentials are used.

How can this error be fixed?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 30 (20 by maintainers)

Most upvoted comments

Hi! I’m back to this task, and any help will be appreciated.

oh interesting! can you clarify a bit more on the back to square one ? Is it throwing password auth issues again? Is it reaching till start_sync, as mentioned here: https://github.com/shayonj/pg_easy_replicate/issues/16#issuecomment-1605606337 Also any logs will be super helpful

I re-created target db from scratch, and doing everything more or less ‘clean slate’. Target DB connectr correcly, on the side of Source DB I had to drop pg_easy_replicate user and schema manually. After that I got following output:

{"name":"pg_easy_replicate","hostname":"db-postgres1z1","pid":1976223,"level":30,"time":"2023-07-04T21:31:59.267+00:00","v":0,"msg":"Setting up schema","version":"0.1.7"}
{"name":"pg_easy_replicate","hostname":"db-postgres1z1","pid":1976223,"level":30,"time":"2023-07-04T21:31:59.323+00:00","v":0,"msg":"Setting up replication user on source database","version":"0.1.7"}
{"name":"pg_easy_replicate","hostname":"db-postgres1z1","pid":1976223,"level":30,"time":"2023-07-04T21:31:59.394+00:00","v":0,"msg":"Setting up replication user on target database","version":"0.1.7"}
Unable to bootstrap: Unable to create user: PG::DependentObjectsStillExist: ERROR:  role "pger_su_h1a4fb" cannot be dropped because some objects depend on it
DETAIL:  privileges for database saas_db

db-postgres1z1 is the name of TargetDB.

What logs can be useful?

…and thank you for the tool and help!

ok got it, thank you for all the debugging messages! I have bunch of fixes planned for 0.1.4, so this will get fixed in it!

Thank you for the debug logs! Super helpful. And yes, I think I see the issue. We are not parsing the special chars in the password when creating a new user, like ! or '. I will have a fix for it tomorrow/weekend, in 0.1.4 version.

I have released 0.1.2, if you’d like to try it out. Please note that the gem also created pger_su before. Its possible it collided with a user you already had, but the error message, seemed to indicate otherwise. You can try out the new version 0.1.2 and feel free to re-open the issue if you run into the same problem.

https://github.com/shayonj/pg_easy_replicate/releases/tag/v0.1.2