vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.27k stars 340 forks source link

switchover is happening to cluster but not the Virtual IP #564

Closed kumarashish071092 closed 2 months ago

kumarashish071092 commented 2 months ago

Hi Vitaliy,

I can see that using patronictl that in case of switchover the VIP is not getting assigned to the primary server automatically.

image

but virtual IP is pointing to the wrong IP:

image

what Parameters I need to change to handle this properly ?

vitabaks commented 2 months ago

Are you using a Type A or Type B scheme?

kumarashish071092 commented 2 months ago

Type A : PostgreSQL High-Availability with HAProxy Load Balancing


From: Vitaliy Kukharik @.> Sent: Thursday, February 1, 2024 2:53 PM To: vitabaks/postgresql_cluster @.> Cc: Kumar Ashish @.>; Author @.> Subject: Re: [vitabaks/postgresql_cluster] switchover is happening to cluster but not the Virtual IP (Issue #564)

[Email from a non-Nagarro source: please exercise caution with links and attachments]

Are you using a Type A or Type B scheme?

— Reply to this email directly, view it on GitHubhttps://github.com/vitabaks/postgresql_cluster/issues/564#issuecomment-1920875353, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXUU3V7JZZ7HW6H3JZJ5Q3YRNNILAVCNFSM6AAAAABCUJGEZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQHA3TKMZVGM. You are receiving this because you authored the thread.Message ID: @.***>

vitabaks commented 2 months ago

@kumarashish071092 In the Type A scheme, the keepalived service is installed to ensure high availability of the HAProxy service and VIP is in no way related to the role of the database leader. See components of load balancing

image

This, VIP will always be on one of the (working) load balancers, see haproxy_check In addition, load balancers can be installed on servers separate from databases (optional).

kumarashish071092 commented 2 months ago

so one question :

how can we ensure that our DNS(VIP) is pointing to the primary server only?


From: Vitaliy Kukharik @.> Sent: Thursday, February 1, 2024 4:07 PM To: vitabaks/postgresql_cluster @.> Cc: Kumar Ashish @.>; Mention @.> Subject: Re: [vitabaks/postgresql_cluster] switchover is happening to cluster but not the Virtual IP (Issue #564)

[Email from a non-Nagarro source: please exercise caution with links and attachments]

@kumarashish071092https://github.com/kumarashish071092 In the Tour A scheme, the keepalived service is installed to ensure high availability of the HAProxy service and VIP is in no way related to the role of the database leader. This, VIP will always be on one of the (working) load balancers, see haproxy_checkhttps://github.com/vitabaks/postgresql_cluster/blob/master/roles/keepalived/templates/keepalived.conf.j2#L7 In addition, load balancers can be installed on servers separate from databases (optional).

— Reply to this email directly, view it on GitHubhttps://github.com/vitabaks/postgresql_cluster/issues/564#issuecomment-1921014884, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVXUU3XM2M52EKBTUEEJD5TYRNV5JAVCNFSM6AAAAABCUJGEZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRRGAYTIOBYGQ. You are receiving this because you were mentioned.Message ID: @.***>

vitabaks commented 2 months ago

how can we ensure that our DNS(VIP) is pointing to the primary server only?

@kumarashish071092 test it :)

HAProxy is configured in such a way as to direct traffic only to the server on which the patroni Rest API confirms that it is primary.