hapostgres / pg_auto_failover

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

duplicate key value violates unique constraint "node_formationid_nodename_key" #955

Closed lkgGitHub closed 1 year ago

lkgGitHub commented 1 year ago

when citus pod restart in kubernetes, It Startup failed.

ERROR Monitor ERROR:  duplicate key value violates unique constraint "node_formationid_nodename_key"
DimCitus commented 1 year ago

Hi @lkgGitHub ; this constraint violation means that you are registering a node with the same name as another node in the same formation. To me it looks like you're restarting an existing node with the same config as when it was created, or the same command line; but without the internal pg_autoctl state files around.

See our usage of XDG_CONFIG_HOME and XDG_DATA_HOME in the docs (e.g. https://pg-auto-failover.readthedocs.io/en/main/ref/pg_autoctl_create_postgres.html#environment) and make sure that you have those locations on the same storage as PGDATA, so that pg_autoctl finds its internal file when a pod restart.