Hi there
I am setting up Percona-Xtradb-Cluster 5.7 with HAproxy version 2.6.7 and
heartbeat with two vms for percona cluster
Below are the details about both VMs (Virtual Machines) both use ubuntu
20.04 LTS
*Vm1: *
With Private IP 10.0.0.4
*Percona configuration /etc/mysql/percona-xtradc-cluster.cnf is *
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-xtradb-cluster.conf.d/
[mysqld]
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://10.0.0.4,10.0.0.5
wsrep_node_name=vm1
wsrep_node_address=10.0.0.4
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=use**:*******
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind_address=10.0.0.4
*configuration for HAproxy on /etc/haproxy/haproxy.cfg is *
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
******
defaults
log global
mode http
mode tcp
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen sql-frontend
bind 10.0.0.100:3307
mode tcp
#option mysql-check user haproxy_check
#default_backend sql-backend
#backend sql-backend
option mysql-check user haproxy_check
balance roundrobin
server vm1 10.0.0.4:3306 check
server vm2node 10.0.0.5:3306 check
listen stats
bind 10.0.0.100:9999
mode http
stats enable
stats refresh 30s
stats show-node
stats hide-version
stats uri /haproxy?stats
stats auth statadmin:statadminpass
*and configuration for Heartbeat /etc/ha.d/ha.cf <http://ha.cf>*
# keepalive: how many seconds between heartbeats
#
keepalive 2
#
# deadtime: seconds-to-declare-host-dead
#
deadtime 10
#
# What UDP port to use for udp or ppp-udp communication?
#
udpport 694
bcast eth0
mcast eth0 225.0.0.1 694 1 0
ucast eth0 10.0.0.4
# What interfaces to heartbeat over?
udp eth0
#
# Facility to use for syslog()/logger (alternative to log/debugfile)
#
logfacility local0
#
# Tell what machines are in the cluster
# node nodename ... -- must match uname -n
node vm1
node vm2node
*in /etc.ha.d/haresources is *
vm1 10.0.0.100
*Vm2:*
With private ip 10.0.0.5
*Percona configuration for mysql cluster
/etc/mysql/percona-xtradc-cluster.cnf is *
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/percona-xtradb-cluster.conf.d/
[mysqld]
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://10.0.0.4,10.0.0.5
wsrep_node_name=vm2node
wsrep_node_address=10.0.0.5
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=***:****
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind_address=10.0.0.5
*configuration for HAproxy on /etc/haproxy/haproxy.cfg is *
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
mode tcp
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen sql-frontend
bind 10.0.0.100:3307
mode tcp
option mysql-check user haproxy_check
balance roundrobin
server vm1 10.0.0.4:3306 check
server vm2node 10.0.0.5:3306 check
listen stats
bind 10.0.0.100:9999
mode http
stats enable
stats refresh 30s
stats show-node
stats hide-version
stats uri /haproxy?stats
stats auth statadmin:statadminpass
*and configuration for Heartbeat /etc/ha.d/ha.cf <http://ha.cf>*
# keepalive: how many seconds between heartbeats
#
keepalive 2
#
# deadtime: seconds-to-declare-host-dead
#
deadtime 10
#
# What UDP port to use for udp or ppp-udp communication?
#
udpport 694
bcast eth0
mcast eth0 225.0.0.1 694 1 0
ucast eth0 10.0.0.5
# What interfaces to heartbeat over?
udp eth0
#
# Facility to use for syslog()/logger (alternative to log/debugfile)
#
logfacility local0
#
# Tell what machines are in the cluster
# node nodename ... -- must match uname -n
node vm1
node vm2node
*and /etc/ha.d/haresources is *
vm1 10.0.0.100
*So when I *
when I telnet 10.0.0.4 from vm2node with ip 10.0.0.5 and vice versa it
shows response
*Trying 10.0.0.4...*
*Connected to 10.0.0.04.*
*Escape character is '^]'.*
*T*
*5.7.39-42-57-log*
* /g*
*Y*
* E9*
*`^\@Amysql_native_password*
Which is good I think
But the issue is when I
I have a third client vm in the same subnet with private ip 10.0.0.8
When I try telnet 10.0.0.100 3307
the response is
Trying 10.0.0.100...
Cannot connect
kindly check if my configuration is correct or not , and why it's not
working