repmgr icon indicating copy to clipboard operation
repmgr copied to clipboard

Replication user isn't used in postgresql.auto.conf when doing standby clone with --replication-user option

Open epolkerman opened this issue 5 years ago • 0 comments

Repmgr version 5.0.0 PostgreSQL version 12.1

Standby configuration file: node_id='2' node_name='standby_node_1' conninfo='host=w.x.y.z user=repmgr dbname=repmgr connect_timeout=2' replication_user='repmgr_repl' pg_bindir='/usr/xxxx/postgres/12/bin/' data_directory='/var/xxxx/postgres/12/data' config_directory='/etc/xxxx/postgres/12/data' log_level=INFO log_facility=STDERR log_file='/var/log/xxxx/repmgr/repmgr.log'

For streaming replication a dedicated user is used 'repmgr_repl', which is also in the configuration file of the standby.

Cloned the standby with following command: repmgr -h w.x.y.z -U repmgr -d repmgr --copy-external-config-file=samepath standby clone --superuser xxxx --replication-user repmgr_repl -c

The standby is cloned successfully: NOTICE: destination directory "/var/xxxx/postgres/12/data" provided INFO: connecting to source node DETAIL: connection string is: host=w.x.y.z user=repmgr dbname=repmgr DETAIL: current installation size is 45 MB NOTICE: checking for available walsenders on the source node (2 required) NOTICE: checking replication connections can be made to the source server (2 required) NOTICE: copying external configuration files from upstream node "w.x.y.z" INFO: rsync command line: rsync --archive --checksum --compress --progress --rsh=ssh w.x.y.z:/etc/xxxx/postgres/12/data/postgresql.conf /etc/xxxx/postgres/12/data/postgresql.conf receiving incremental file list INFO: rsync command line: rsync --archive --checksum --compress --progress --rsh=ssh w.x.y.z:/etc/xxxx/postgres/12/data/pg_hba.conf /etc/xxxx/postgres/12/data/pg_hba.conf receiving incremental file list INFO: rsync command line: rsync --archive --checksum --compress --progress --rsh=ssh w.x.y.z:/etc/xxxx/postgres/12/data/pg_ident.conf /etc/xxxx/postgres/12/data/pg_ident.conf receiving incremental file list INFO: checking and correcting permissions on existing directory "/var/xxxx/postgres/12/data" NOTICE: starting backup (using pg_basebackup)... INFO: executing: /usr/xxxx/postgres/12/bin/pg_basebackup -l "repmgr base backup" -D /var/xxxx/postgres/12/data -h w.x.y.z -p 5432 -U repmgr_repl -c fast -X stream NOTICE: standby clone (using pg_basebackup) complete NOTICE: you can now start your PostgreSQL server

As stated in the standby repmgr.conf parameter 'replication_user' is added. However on the command line I have to explicit add option --replication-user to the command otherwise it uses user repmgr. This is not what I expected when reading the example conf file: #replication_user='repmgr' # User to make replication connections with, if not set # defaults to the user defined in "conninfo".

Secondly the replication user isn't added to postgresql.auto.conf: primary_conninfo = 'host=w.x.y.z user=repmgr application_name=standby_node_1 connect_timeout=2'

Again not what I expected by providing the 'replication_user' parameter in the configuration file and providing the option --replication-user on the command line

epolkerman avatar Nov 29 '19 09:11 epolkerman