OperationalError: ERROR: pgbouncer cannot connect to server - postgresql

I'm trying to do python manage.py syncdb on a Django installation, but I keep getting OperationalError: ERROR: pgbouncer cannot connect to server. pgbouncer.log contains lines such as:
2017-09-19 19:44:15.107 1128 LOG C-0x8a9930: mydb/myuser#unix:6432 closing because: pgbouncer cannot connect to server (age=0)
2017-09-19 19:44:15.107 1128 WARNING C-0x8a9930: mydb/myuser#unix:6432 Pooler Error: pgbouncer cannot connect to server
2017-09-19 19:44:15.107 1128 LOG S-0x8c72e0: mydb/myuser#35.154.149.188:5432 new connection to server
2017-09-19 19:44:15.107 1128 LOG C-0x8a9930: mydb/myuser#unix:6432 login failed: db=mydb user=myuser
2017-09-19 19:44:30.108 1128 LOG S-0x8c72e0: mydb/myuser#35.154.149.188:5432 closing because: connect failed (age=15)
In case needed, ps -aef | grep pgbouncer yields:
postgres 1128 1 0 18:38 ? 00:00:00 /usr/sbin/pgbouncer -d /etc/pgbouncer/pgbouncer.ini
myuser 1919 1533 0 19:45 pts/0 00:00:00 grep --color=auto pgbouncer
Moreover, grep port /etc/pgbouncer/pgbouncer.ini results in:
;; dbname= host= port= user= password=
mydb = host=xx.xxx.xxx.xxx port=5432 dbname=mydb
;forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1'
listen_port = 6432
Lastly, the relevant parts of settings.py contain:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydb',
'USER': 'myuser',
'PASSWORD': 'mypassword',
'HOST': '/var/run/postgresql',
'PORT': '6432',
}
I turned log_connections to on in postgresql.conf, restarted PG and tried again. Here's the relevant lines:
2017-09-20 07:50:59 UTC LOG: database system is ready to accept connections
2017-09-20 07:50:59 UTC LOG: autovacuum launcher started
2017-09-20 07:51:00 UTC LOG: connection received: host=[local]
2017-09-20 07:51:00 UTC LOG: incomplete startup packet
2017-09-20 07:51:00 UTC LOG: connection received: host=[local]
2017-09-20 07:51:00 UTC LOG: connection authorized: user=postgres database=postgres
2017-09-20 07:51:01 UTC LOG: connection received: host=[local]
2017-09-20 07:51:01 UTC LOG: connection authorized: user=postgres database=postgres
2017-09-20 07:51:01 UTC LOG: connection received: host=[local]
2017-09-20 07:51:01 UTC LOG: connection authorized: user=postgres database=postgres
It seems the connection is going through, but the user and database name is postgres. Those credentials aren't what I supplied in pgbouncer.ini.
However, explicitly adding myuser in the connection string described in pgbouncer.ini leads to:
2017-09-20 09:37:37 UTC FATAL: Peer authentication failed for user "myuser"
2017-09-20 09:37:37 UTC DETAIL: Connection matched pg_hba.conf line 90: "local all all peer"
Totally stumped.

It seems the mis-configuration emanated from this line in settings.py:
'PORT': '6432',
I commented it and pgbouncer started working.
Though I'm not sure 'why'.
Maybe there's a collision on this port; Pgbouncer and PG coexist on a single server in my case. I've set them up over different VMs in the past without a hitch (and without needing to comment 'PORT': '6432',)

Related

Postgresql shutdown by itself

2021-11-03 07:15:23.704 UTC [354507] postgres#postgres FATAL: password authentication failed for user "postgres"
2021-11-03 07:15:23.704 UTC [354507] postgres#postgres DETAIL: Password does not match for user "postgres".
Connection matched pg_hba.conf line 105: "host all all 0.0.0.0/0 md5"
2021-11-03 07:33:29.904 UTC [354788] pgsql#postgres FATAL: password authentication failed for user "pgsql"
2021-11-03 07:33:29.904 UTC [354788] pgsql#postgres DETAIL: Role "pgsql" does not exist.
Connection matched pg_hba.conf line 105: "host all all 0.0.0.0/0 md5"
2021-11-03 07:52:40.628 UTC [355083] pgsql#postgres FATAL: password authentication failed for user "pgsql"
2021-11-03 07:52:40.628 UTC [355083] pgsql#postgres DETAIL: Role "pgsql" does not exist.
Connection matched pg_hba.conf line 105: "host all all 0.0.0.0/0 md5"
2021-11-03 07:53:02.963 UTC [327839] LOG: received smart shutdown request
2021-11-03 07:53:02.976 UTC [327839] LOG: background worker "logical replication launcher" (PID 327846) exited with exit code 1
2021-11-03 07:53:02.980 UTC [327841] LOG: shutting down
2021-11-03 07:53:03.011 UTC [327839] LOG: database system is shut down
I am hosting PostgreSQL on a DigitalOcean droplet and since this server is just for my toy project only so I have all the ports open. I understand this is bad practice but from my understanding, unless the hacker somehow gains access to my username and password the DB will be safe.
But last month and yesterday my Postgre just shut down itself and according to the log, it seems it was shut down after a shutdown request?
I am using "postgres" as my user name and from the log, I can see someone keep trying to log with the username "pgsql"?
So I want to know am I being hacked or I did something stupid and somehow shut down the server by myself?

How to use SCRAM-SHA-256 based authentication for user with TLS config in POSTGRESQL server?

I have created a PostgreSQL 13.1 cluster with 1` where I have 2 standby and 1 primary.
Here I have used scram-sha-256as authentication mode for client where my cluster is config with TLS.
When I started my PostgreSQL server, I got a continuous fatal log.
the log is:
UTC [181] FATAL: expected SASL response, got message type 88
postgresql.conf
wal_level = replica
max_wal_senders = 90
wal_keep_size = 64
wal_log_hints = on
hot_standby = on
password_encryption = scram-sha-256
recovery_target_timeline = 'latest'
primary_conninfo = 'application_name=<application_name> host=<host_name> password=<Postgres_password sslmode=verify-full sslrootcert=<path_to_ca_cert>/ca.crt'
promote_trigger_file = '/run_scripts/tmp/pg-failover-trigger'
...
<some other basic config>
...
pg_hba.conf
#TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 scram-sha-256
local replication all scram-sha-256
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
host all all 0.0.0.0/0 scram-sha-256
host replication postgres 0.0.0.0/0 scram-sha-256
host all all ::/0 scram-sha-256
host replication postgres ::/0 scram-sha-256
Is it possible to add scram-sha-256 for tls config cluster? If yes, then how can I do it?
Here is how I have tried to connect as a client.
$ export PGPASSWORD=<POSTGRES_PASSWORD>
$ export PGUSER=<POSTGRES_USER>
$ psql -w -h <hostname>
psql (13.1)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=#
I don't see any error from my client site but get continuous fatal log.
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/pv/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
sh: locale: not found
2021-03-03 07:43:56.823 UTC [35] WARNING: no usable system locales were found
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D /var/pv/data -l logfile start
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2021-03-03 07:44:03.835 GMT [42] LOG: skipping missing configuration file "/etc/config/user.conf"
2021-03-03 07:44:03.836 GMT [42] LOG: skipping missing configuration file "/etc/config/user.conf"
2021-03-03 07:44:03.996 UTC [42] LOG: starting PostgreSQL 13.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit
2021-03-03 07:44:03.996 UTC [42] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-03-03 07:44:03.996 UTC [42] LOG: listening on IPv6 address "::", port 5432
2021-03-03 07:44:04.073 UTC [42] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-03-03 07:44:04.187 UTC [43] LOG: database system was shut down at 2021-03-03 07:43:59 UTC
2021-03-03 07:44:04.237 UTC [44] FATAL: the database system is starting up
2021-03-03 07:44:04.281 UTC [42] LOG: database system is ready to accept connections
done
server started
ALTER ROLE
/run_scripts/role/start.sh: ignoring /var/initdb/*
waiting for server to shut down...2021-03-03 07:44:04.387 UTC [42] LOG: received fast shutdown request
.2021-03-03 07:44:04.478 UTC [42] LOG: aborting any active transactions
2021-03-03 07:44:04.480 UTC [42] LOG: background worker "logical replication launcher" (PID 51) exited with exit code 1
2021-03-03 07:44:04.482 UTC [45] LOG: shutting down
2021-03-03 07:44:05.169 UTC [56] FATAL: the database system is shutting down
.2021-03-03 07:44:05.702 UTC [57] FATAL: the database system is shutting down
2021-03-03 07:44:05.806 UTC [58] FATAL: the database system is shutting down
2021-03-03 07:44:06.217 UTC [59] FATAL: the database system is shutting down
..2021-03-03 07:44:07.648 UTC [60] FATAL: the database system is shutting down
2021-03-03 07:44:07.853 UTC [61] FATAL: the database system is shutting down
2021-03-03 07:44:08.163 UTC [42] LOG: database system is shut down
done
server stopped
2021-03-03 07:44:08.208 GMT [25] LOG: skipping missing configuration file "/etc/config/user.conf"
2021-03-03 07:44:08.208 GMT [25] LOG: skipping missing configuration file "/etc/config/user.conf"
2021-03-03 07:44:08.487 UTC [25] LOG: starting PostgreSQL 13.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit
2021-03-03 07:44:08.487 UTC [25] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-03-03 07:44:08.487 UTC [25] LOG: listening on IPv6 address "::", port 5432
2021-03-03 07:44:08.688 UTC [25] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-03-03 07:44:08.895 UTC [67] LOG: database system was shut down at 2021-03-03 07:44:07 UTC
2021-03-03 07:44:08.905 UTC [68] FATAL: the database system is starting up
2021-03-03 07:44:08.945 UTC [69] FATAL: the database system is starting up
2021-03-03 07:44:08.946 UTC [70] FATAL: the database system is starting up
2021-03-03 07:44:08.991 UTC [25] LOG: database system is ready to accept connections
2021-03-03 07:44:15.990 UTC [94] FATAL: expected SASL response, got message type 88
2021-03-03 07:44:16.011 UTC [95] FATAL: expected SASL response, got message type 88
2021-03-03 07:44:30.197 UTC [108] FATAL: expected SASL response, got message type 88
2021-03-03 07:44:31.324 UTC [110] FATAL: expected SASL response, got message type 88
2021-03-03 07:44:57.571 UTC [114] FATAL: expected SASL response, got message type 88
2021-03-03 07:44:57.729 UTC [115] FATAL: expected SASL response, got message type 88
2021-03-03 07:45:07.982 UTC [127] FATAL: expected SASL response, got message type 88
2021-03-03 07:45:08.020 UTC [128] FATAL: expected SASL response, got message type 88
2021-03-03 07:45:18.135 UTC [140] FATAL: expected SASL response, got message type 88
2021-03-03 07:45:18.173 UTC [141] FATAL: expected SASL response, got message type 88
The problem was with the go-client i was trying to use to connect my server. The problem was solved when i tried https://github.com/lib/pq client instead of https://github.com/go-pg/pg.

PostgreSQL connection issue after service restart

I have edited my pg_hba file and copied it to server and restarted the services by "sudo service postgresql restart" but after that the server is not connecting.
Showing the below error, Your database returned: "Connection to 138.2xx.1xx.xx:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections."
The Jenkins job and data visualization tools are failing which was working fine previously. What could be the reason.
Getting this in PostgreSQL Log
2019-10-23 07:21:25.829 CEST [11761] LOG: received fast shutdown request
2019-10-23 07:21:25.829 CEST [11761] LOG: aborting any active transactions
2019-10-23 07:21:25.829 CEST [11766] LOG: autovacuum launcher shutting down
2019-10-23 07:21:25.832 CEST [11763] LOG: shutting down
2019-10-23 07:21:25.919 CEST [11761] LOG: database system is shut down
2019-10-23 07:21:27.068 CEST [22633] LOG: database system was shut down at 2019-10-23 07:21:25 CEST
2019-10-23 07:21:27.073 CEST [22633] LOG: MultiXact member wraparound protections are now enabled
2019-10-23 07:21:27.075 CEST [22631] LOG: database system is ready to accept connections
2019-10-23 07:21:27.075 CEST [22637] LOG: autovacuum launcher started
2019-10-23 07:21:27.390 CEST [22639] [unknown]#[unknown] LOG: incomplete startup packet
Below shows no response.
root#Ubuntu-1604-xenial-64-minimal ~ # pg_isready -h localhost -p 5432
localhost:5432 - no response
Below was already added to the postgresql.config file.
listen_addresses = '*'
Do i need to restart the entire server?
Can anyone please help me to resolve this.

Postgres:10 in docker swarm cluster. Database system is shut down

I use postgres:10 (https://hub.docker.com/_/postgres/) image for DB.
It is deployed in docker swarm cluster.
After running DB replica I got database system is shut down in DB's log.
2018-05-11 10:26:53.073 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432,
2018-05-11 10:26:53.073 UTC [1] LOG: listening on IPv6 address "::", port 5432,
2018-05-11 10:26:53.077 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432",
2018-05-11 10:26:53.092 UTC [20] LOG: database system was shut down at 2018-05-11 10:26:20 UTC,
2018-05-11 10:26:53.100 UTC [1] LOG: database system is ready to accept connections,
The files belonging to this database system will be owned by user "postgres".,
This user must also own the server process.,
,
The database cluster will be initialized with locale "en_US.utf8".,
The default database encoding has accordingly been set to "UTF8".,
The default text search configuration will be set to "english".,
,
Data page checksums are disabled.,
,
fixing permissions on existing directory /var/lib/postgresql/data ... ok,
creating subdirectories ... ok,
selecting default max_connections ... 100,
selecting default shared_buffers ... 128MB,
selecting dynamic shared memory implementation ... posix,
creating configuration files ... ok,
running bootstrap script ... ok,
performing post-bootstrap initialization ... ok,
,
WARNING: enabling "trust" authentication for local connections,
You can change this by editing pg_hba.conf or using the option -A, or,
--auth-local and --auth-host, the next time you run initdb.,
syncing data to disk ... ok,
,
Success. You can now start the database server using:,
,
pg_ctl -D /var/lib/postgresql/data -l logfile start,
,
waiting for server to start....2018-05-11 09:39:21.129 UTC [37] LOG: listening on IPv4 address "127.0.0.1", port 5432,
2018-05-11 09:39:21.130 UTC [37] LOG: could not bind IPv6 address "::1": Cannot assign requested address,
2018-05-11 09:39:21.130 UTC [37] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.,
2018-05-11 09:39:21.133 UTC [37] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432",
2018-05-11 09:39:21.147 UTC [38] LOG: database system was shut down at 2018-05-11 09:39:20 UTC,
2018-05-11 09:39:21.152 UTC [37] LOG: database system is ready to accept connections,
done,
server started,
CREATE DATABASE,
,
CREATE ROLE,
,
,
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*,
,
2018-05-11 09:39:21.595 UTC [37] LOG: received fast shutdown request,
waiting for server to shut down....2018-05-11 09:39:21.596 UTC [37] LOG: aborting any active transactions,
2018-05-11 09:39:21.598 UTC [37] LOG: worker process: logical replication launcher (PID 44) exited with exit code 1,
2018-05-11 09:39:21.599 UTC [39] LOG: shutting down,
2018-05-11 09:39:21.613 UTC [37] LOG: database system is shut down,
done,
server stopped,
,
PostgreSQL init process complete; ready for start up.,
,
2018-05-11 09:39:21.706 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432,
2018-05-11 09:39:21.706 UTC [1] LOG: listening on IPv6 address "::", port 5432,
2018-05-11 09:39:21.709 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432",
2018-05-11 09:39:21.724 UTC [64] LOG: database system was shut down at 2018-05-11 09:39:21 UTC,
2018-05-11 09:39:21.729 UTC [1] LOG: database system is ready to accept connections,
2018-05-11 10:26:20.444 UTC [1] LOG: received smart shutdown request,
2018-05-11 10:26:20.449 UTC [1] LOG: worker process: logical replication launcher (PID 70) exited with exit code 1,
2018-05-11 10:26:20.449 UTC [65] LOG: shutting down,
2018-05-11 10:26:20.460 UTC [1] LOG: database system is shut down,
Image :
FROM postgres:10
COPY healthcheck /usr/local/bin/
RUN chmod +x /usr/local/bin/healthcheck
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
CMD healthcheck
Snippet from docker-compose :
db_jackrabbit:
build: ./images/pgsql_jackrabbit
container_name: db_jackrabbit
environment:
- POSTGRES_DB=${JACK_POSTGRES_DB}
- POSTGRES_USER=${JACK_POSTGRES_USER}
- POSTGRES_PASSWORD=${JACK_POSTGRES_PASSWORD}
volumes:
- pgsql_jackrabbit_local:/var/lib/postgresql/data
ports:
- ${PORT_DB_JACKRABBIT}:5432
healthcheck:
#!/bin/bash
set -eo pipefail
host="$(hostname -i || echo '127.0.0.1')"
user="${POSTGRES_USER:-postgres}"
db="${POSTGRES_DB:-$POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"
args=(
# force postgres to not use the local unix socket (test "external" connectibility)
--host "$host"
--username "$user"
--dbname "$db"
--quiet --no-align --tuples-only
)
if select="$(echo 'SELECT 1' | psql "${args[#]}")" && [ "$select" = '1' ]; then
exit 0
fi
exit 1
But DB still alive. It is shutdown periodically and accept connections again (
What it the problem?
Thanks in advance!
Ok, so I solved my issue. This issue helped me.
It seems like Postgres initialization process does stop the initialization process once done, and it is another process which follows up and accepts connexion.
Hence I had:
postgres:
deploy:
restart_policy:
condition: on-failure
window: 15m
and apparently docker received a end-of-process status code, so it stopped without going to the next process so never accepting connexions.
My interpretation may be incorrect, but at least if you face the issue, try removing restart_policy key to see if it fixes it.
I haven't tried to restore healthcheck yet, as it may also have undesired side effects.

repmgr Error: A master must be defined before configuring a slave

I am using the repmgr for replication. I had registered the Master node to repmgr successfully. I had successfully cloned the Master node & Started the Standby server. But the Problem is I cannot register the Standby node in repmgr.
I am using the version repmgr 2.0beta1 (PostgreSQL 9.3.2). Os: Ubuntu 14.04 LTS
While registering the Standby node.
$ repmgr -f /etc/repmgr/repmgr.conf --verbose standby register
Opening configuration file: /etc/repmgr/repmgr.conf
[2015-03-31 11:43:19] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair!
[2015-03-31 11:43:19] [INFO] repmgr connecting to standby database
[2015-03-31 11:43:19] [INFO] repmgr connected to standby, checking its state
[2015-03-31 11:43:19] [INFO] repmgr connecting to master database
[2015-03-31 11:43:19] [INFO] finding node list for cluster 'test'
[2015-03-31 11:43:19] [INFO] checking role of cluster node 'host=127.0.0.1 user=repmgr_usr dbname=repmgr_db'
[2015-03-31 11:43:19] [ERROR] A master must be defined before configuring a slave
Got this error.
On Standby Postgres LOG: (With log_connections=on, log_disconnections=on)
$ tail -f /var/log/postgresql/postgresql-9.3-main.log
2015-03-31 11:38:51 IST LOG: disconnection: session time: 0:00:00.011 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53055
2015-03-31 11:38:51 IST LOG: could not receive data from client: Connection reset by peer
2015-03-31 11:38:51 IST LOG: disconnection: session time: 0:00:00.029 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53054
2015-03-31 11:43:19 IST LOG: connection received: host=127.0.0.1 port=53061
2015-03-31 11:43:19 IST LOG: connection authorized: user=repmgr_usr database=repmgr_db
2015-03-31 11:43:19 IST LOG: connection received: host=127.0.0.1 port=53062
2015-03-31 11:43:19 IST LOG: connection authorized: user=repmgr_usr database=repmgr_db
2015-03-31 11:43:19 IST LOG: disconnection: session time: 0:00:00.008 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53062
2015-03-31 11:43:19 IST LOG: could not receive data from client: Connection reset by peer
2015-03-31 11:43:19 IST LOG: disconnection: session time: 0:00:00.025 user=repmgr_usr database=repmgr_db host=127.0.0.1 port=53061
I got the error in LOG "could not receive data from client: Connection reset by peer"
On Master Postgres LOG:(With log_connections=on, log_disconnections=on)
$tail -f /var/log/postgresql/postgresql-9.3-main.log
2015-03-31 11:25:18 IST LOG: connection authorized: user=postgres database=postgres
2015-03-31 11:25:18 IST LOG: disconnection: session time: 0:00:00.010 user=postgres database=postgres host=[local]
2015-03-31 11:25:19 IST LOG: connection received: host=[local]
2015-03-31 11:25:19 IST LOG: connection authorized: user=postgres database=postgres
2015-03-31 11:25:19 IST LOG: disconnection: session time: 0:00:00.002 user=postgres database=postgres host=[local]
2015-03-31 11:25:19 IST LOG: connection received: host=[local]
2015-03-31 11:25:19 IST LOG: connection authorized: user=postgres database=postgres
2015-03-31 11:25:19 IST LOG: disconnection: session time: 0:00:00.002 user=postgres database=postgres host=[local]
2015-03-31 11:26:14 IST LOG: connection received: host=192.168.1.218 port=40381
2015-03-31 11:26:14 IST LOG: replication connection authorized: user=repmgr_usr
I think no details about the standby connection in this log. (I am not sure bcoz I dont know)
Master repmgr.conf:
cluster=test
node=1
node_name=node1
conninfo='host=127.0.0.1 user=repmgr_usr dbname=repmgr_db'
pg_bindir=/usr/lib/postgresql/9.3/bin
Standby repmgr.conf
cluster=test
node=2
node_name=node2
conninfo='host=localhost user=repmgr_usr dbname=repmgr_db'
pg_bindir='/usr/lib/postgresql/9.3/bin'
master & Standby postgres.conf
listen_addresses='*'
wal_level = 'hot_standby'
archive_mode = on
archive_command = 'cd .'
max_wal_senders = 10
wal_keep_segments = 5000
hot_standby = on
log_connections = on
log_disconnections = on
master & stanby pg_hba.conf
host repmgr_db repmgr_usr 192.168.1.0/24 trust
host replication repmgr_usr 192.168.1.0/24 trust
host repmgr_db repmgr_usr 127.0.0.1/24 trust
host replication repmgr_usr 127.0.0.1/24 trust
Cluster Details in Standby node:
$ repmgr -f /etc/repmgr/repmgr.conf cluster show
[2015-03-31 12:06:17] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair!
Role | Connection String
standby | host=127.0.0.1 user=repmgr_usr dbname=repmgr_db
Cluster Details in Master node:
$ repmgr -f /etc/repmgr/repmgr.conf cluster show
[2015-03-31 12:07:46] [WARNING] pg_bindir//usr/lib/postgresql/9.3/bin: Unknown name/value pair!
Role | Connection String
* master | host=127.0.0.1 user=repmgr_usr dbname=repmgr_db
Please help me in this issue.
Finally I solved that by changing the repmgr.conf file. I have changed the
conninfo='host=localhost user=repmgr_usr dbname=repmgr_db'
with
conninfo='host=192.168.1.205 user=repmgr_usr dbname=repmgr_db'
i.e.. In Config file we have to give the IP address or Name resolved by the cluster.