<div dir="ltr"><span style="font-size:12.8px">Hi,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have set up Highly Available HAProxy Servers with Keepalived and Floating IP.  I have the below details </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><b>Master Node keepalived.conf</b></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div style="font-size:12.8px">global_defs {</div><div style="font-size:12.8px"># Keepalived process identifier</div><div style="font-size:12.8px">#lvs_id haproxy_DH</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"># Script used to check if HAProxy is running</div><div style="font-size:12.8px">vrrp_script check_haproxy {</div><div style="font-size:12.8px">script "/usr/bin/killall -0 haproxy"</div><div style="font-size:12.8px">interval 2</div><div style="font-size:12.8px">weight 2</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"># Virtual interface</div><div style="font-size:12.8px"># The priority specifies the order in which the assigned interface to take over in a failover</div><div style="font-size:12.8px">vrrp_instance VI_01 {</div><div style="font-size:12.8px">state MASTER</div><div style="font-size:12.8px">interface eth0</div><div style="font-size:12.8px">virtual_router_id 51</div><div style="font-size:12.8px">priority 200</div><div style="font-size:12.8px"># The virtual ip address shared between the two loadbalancers</div><div style="font-size:12.8px">virtual_ipaddress {</div><div style="font-size:12.8px"><b><a href="http://172.16.0.75/32" target="_blank">172.16.0.75/32</a></b></div><div style="font-size:12.8px">}</div><div style="font-size:12.8px">track_script {</div><div style="font-size:12.8px">check_haproxy</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div style="font-size:12.8px"><b>Slave Node keepalived.conf</b></div><div><br></div></div><div><div><span style="font-size:12.8px">global_defs {</span></div><div><span style="font-size:12.8px"># Keepalived process identifier</span></div><div><span style="font-size:12.8px">#lvs_id haproxy_DH_passive</span></div><div><span style="font-size:12.8px">}</span></div><div><span style="font-size:12.8px"># Script used to check if HAProxy is running</span></div><div><span style="font-size:12.8px">vrrp_script check_haproxy {</span></div><div><span style="font-size:12.8px">script "/usr/bin/killall -0 haproxy"</span></div><div><span style="font-size:12.8px">interval 2</span></div><div><span style="font-size:12.8px">weight 2</span></div><div><span style="font-size:12.8px">}</span></div><div><span style="font-size:12.8px"># Virtual interface</span></div><div><span style="font-size:12.8px"># The priority specifies the order in which the assigned interface to take over in a failover</span></div><div><span style="font-size:12.8px">vrrp_instance VI_01 {</span></div><div><span style="font-size:12.8px">state BACKUP</span></div><div><span style="font-size:12.8px">interface eth0</span></div><div><span style="font-size:12.8px">virtual_router_id 51</span></div><div><span style="font-size:12.8px">priority 100</span></div><div><span style="font-size:12.8px"># The virtual ip address shared between the two loadbalancers</span></div><div><span style="font-size:12.8px">virtual_ipaddress {</span></div><div><span style="font-size:12.8px"><a href="http://172.16.0.75/32" target="_blank">172.16.0.75/32</a></span></div><div><span style="font-size:12.8px">}</span></div><div><span style="font-size:12.8px">track_script {</span></div><div><span style="font-size:12.8px">check_haproxy</span></div><div><span style="font-size:12.8px">}</span></div><div><span style="font-size:12.8px">}</span></div></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">HAProxy Node 1 has two IP Addresses</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">eth0 :- 172.16.0.20 LAN IP of the box Master Node</div><div style="font-size:12.8px">eth0 :- 172.16.0.75 Virtual IP<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">eth0 :- 172.16.0.21 <span style="font-size:12.8px">LAN IP of the box Slave Node</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">In MySQL server, i have given access for the Floating IP :- 172.16.0.75</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><b>GRANT USAGE ON *.* TO 'haproxy_check'@'172.16.0.75';<br></b></div><div style="font-size:12.8px"><b>GRANT ALL PRIVILEGES ON *.* TO 'haproxy_root'@'172.16.0.75' IDENTIFIED BY PASSWORD '*7A3F28E9F3E3AEFDFF87BCFE119D<wbr>CF830101DD71' WITH GRANT OPTION;</b><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">When i try to connect to the MySQL server using floating IP :- 172.16.0.75,</div><div style="font-size:12.8px">I get access denied inspite of giving grant access as per the above mentioned command. When i try to use the static IP to connect to the MySQL server using LAN IP :- 172.16.0.20, it works as expected. is it because eth0 has two IPs :- 172.16.0.20 and 172.16.0.75?<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Please do let me know if you need any additional information.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Regards,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Kaushal</div></div>