vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 411 forks source link

intsall type A show status as Active: active (exited) #434

Closed miketwais closed 1 year ago

miketwais commented 1 year ago

i have install postgres_cluster follow as readme introduce, and use 'service postgresql status' see that status was "Active: active (exited)", and i can't connect postgres cluster use : psql -h localhost -p 5000 -U pgbouncer

error show i can't connect to the master,how can i do?

vitabaks commented 1 year ago

Hi

Please give more details, what is the error?

vitabaks commented 1 year ago

Please try (not using the pgbouncer user)

psql -h <vip_or_balancer_ip> -p 5000 -U postgres

Example:

postgres@pgnode01:~$ grep -A2 "listen master" /etc/haproxy/haproxy.cfg 
listen master
    bind 10.172.0.20:5000
    maxconn 10000
postgres@pgnode01:~$ psql -h 10.172.0.20 -p 5000 -U postgres
Password for user postgres: 
psql (15.3 (Ubuntu 15.3-1.pgdg22.04+1), server 14.8 (Ubuntu 14.8-1.pgdg22.04+1))
Type "help" for help.

postgres=# \l+
                                                                                   List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges   |  Size   | Tablespace |                Description                 
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------+---------+------------+--------------------------------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |                       | 8553 kB | pg_default | default administrative connection database
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +| 8401 kB | pg_default | unmodifiable empty database
           |          |          |             |             |            |                 | postgres=CTc/postgres |         |            | 
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +| 8553 kB | pg_default | default template for new databases
           |          |          |             |             |            |                 | postgres=CTc/postgres |         |            | 
(3 rows)

postgres=# \q
vitabaks commented 1 year ago

@miketwais please update the status of the issue, is the problem still relevant?

vitabaks commented 1 year ago

P.S. haproxy does not listen to localhost, only VIP if it is defined or local IPv4 address