hapostgres / pg_auto_failover

Postgres extension and service for automated failover and high-availability
Other
1.07k stars 112 forks source link

Can't we use databases other than citus to achieve high availability? #967

Closed dblife1024 closed 1 year ago

dblife1024 commented 1 year ago

hi, I use the following architecture to achieve my distributed high availability postgres https://pg-auto-failover.readthedocs.io/en/main/citus-quickstart.html

But I meet a problem,can you help me?

I have two database,as follows:

postgres=# \l
                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-----------+----------+----------+------------+------------+-----------------------
 citus     | postgres | UTF8     | en_US.UTF8 | en_US.UTF8 | 
 postgres  | postgres | UTF8     | en_US.UTF8 | en_US.UTF8 | 
 template0 | postgres | UTF8     | en_US.UTF8 | en_US.UTF8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF8 | en_US.UTF8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 yt        | postgres | UTF8     | en_US.UTF8 | en_US.UTF8 | 

when mdbyt02v node is crash,IN the citus database ,mdbyt02v is unregistered with the coordinator node, and mdbyt03v is registered in its stead. but in the yt database,It didn't happen。

 postgres=# \c yt
 You are now connected to database "yt" as user "postgres".
 yt=# SELECT * FROM citus_get_active_worker_nodes();
              node_name             | node_port 
 -----------------------------------+-----------
  mdbyt02v |     15432
  mdbyt02v |     15433
  mdbyt02v |     15434
 (3 rows)

=======================================================(This state is correct)

 yt=# \c citus
 You are now connected to database "citus" as user "postgres".
 citus=# SELECT * FROM citus_get_active_worker_nodes();
              node_name             | node_port 
 -----------------------------------+-----------
  mdbyt03v |     15432
  mdbyt03v |     15433
  mdbyt03v |     15434
 (3 rows)

why?

DimCitus commented 1 year ago

Hi @dblife1024 ; at the moment pg_auto_failover supports only a single Citus database, the one given as the --dbname option at create time. On the Citus side itself, the current situation with more than one database is unclear, as resource sharing and background workers etc is designed mainly for single database usage, and also as you found out node registration only works per-database.