2

I am trying to set up a standby server and keep getting this error. My primary server has more than enough connections to handle the load:

listen_addresses = '*'
wal_level = hot_standby
max_wal_senders = 10
max_connections=100
checkpoint_segments = 8
wal_keep_segments = 8
archive_mode = on
archive_command = 'cp %p /var/lib/postgresql/archive/%f'

This is the command that fails on the standby server:

pg_basebackup -h ${MASTER_PORT_5432_TCP_ADDR} -D ${PGDATA} -U ${REP_USER} -vPw --xlog-method=stream

I don't understand why this happens.

  • 1
    Check pg_roles.rolconnlimit for rolname='replication' – Daniel Vérité Apr 8 '15 at 23:31
  • you're right. The value is set to 1. But how do I change it? It's a view and not writable! – picardo Apr 8 '15 at 23:39
7

Per comments, pg_roles.rolconnlimit is set to 1 for that role so it needs to be increased a bit to allow for several simultaneous connections.

Choose a more reasonable value, say 5 (or -1 for unlimited) and issue as superuser:

ALTER ROLE replication CONNECTION LIMIT 5;

...or connect with a different database user for pg_basebackup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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