2017-07-05 4 views
0

J'ai récemment installé Galera Cluster sur deux serveurs Red Hat 7 et l'avoir correctement configuré. Cependant, je n'arrive pas à faire fonctionner HAProxy. Je reçois juste des erreurs.Impossible d'obtenir haproxy pour charger balanace Galera nœuds de cluster

1 nœud a une adresse IP de 1.1.1.1 et tout le trafic est ouvert. SELinux a mysql mis à permissive.

Node 2 a une adresse IP de 2.2.2.2 et tout le trafic est ouvert. SELinux a mysql mis à permissive.

HAProxy a une adresse IP de 3.3.3.3 et tout le trafic est ouvert. SELinux a été désactivé.

Tous les nœuds sont sur des serveurs distincts. La seule chose que Node 3 a installé est HAProxy et le client mysql.

donc par la documentation Galera, installer HAProxy et cette portion au fond du fichier de configuration:

# Load Balancing for Galera Cluster 
listen galera 3.3.3.3:3306 
    balance roundrobin 
    mode tcp 
    option tcpka 
    option mysql-check user haproxy 
    server node1 1.1.1.1:3306 check weight 1 
    server node2 2.2.2.2:3306 check weight 1 

Mais quand je vérifie l'état de HAProxy je reçois ces erreurs:

[[email protected] haproxy]# service haproxy restart 
Redirecting to /bin/systemctl restart haproxy.service 
[[email protected] haproxy]# service haproxy status 
Redirecting to /bin/systemctl status haproxy.service 
● haproxy.service - HAProxy Load Balancer 
    Loaded: loaded (/usr/lib/systemd/system/haproxy.service; disabled; vendor preset: disabled) 
    Active: failed (Result: exit-code) since Tue 2017-07-04 20:18:50 EDT; 3s ago 
    Process: 11773 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS (code=exited, status=1/FAILURE) 
Main PID: 11773 (code=exited, status=1/FAILURE) 

Jul 04 20:18:50 nodemgr systemd[1]: Started HAProxy Load Balancer. 
Jul 04 20:18:50 nodemgr systemd[1]: Starting HAProxy Load Balancer... 
Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /ru...pid -Ds 
Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: [WARNING] 184/201850 (11774) : parsing [/etc/haproxy/haproxy.cfg:45] : 'option httplog'...cplog'. 
Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: [WARNING] 184/201850 (11774) : config : 'option forwardfor' ignored for proxy 'galera' ...P mode. 
Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: [ALERT] 184/201850 (11774) : Starting proxy galera: cannot bind socket [3.3.3.3:3306] 
Jul 04 20:18:50 nodemgr systemd[1]: haproxy.service: main process exited, code=exited, status=1/FAILURE 
Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: haproxy-systemd-wrapper: exit, haproxy RC=1 
Jul 04 20:18:50 nodemgr systemd[1]: Unit haproxy.service entered failed state. 
Jul 04 20:18:50 nodemgr systemd[1]: haproxy.service failed. 
Hint: Some lines were ellipsized, use -l to show in full. 

Je suppose que mon problème est ici:

Jul 04 20:18:50 nodemgr haproxy-systemd-wrapper[11773]: [ALERT] 184/201850 (11774) : Starting proxy galera: cannot bind socket [3.3.3.3:3306] 

mais après la désactivation de SELinux je ne pas kno w quoi d'autre je dois faire. Toute aide est grandement appréciée!

fichier de configuration complète est haproxy ici:

#--------------------------------------------------------------------- 
# Example configuration for a possible web application. See the 
# full configuration options online. 
# 
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt 
# 
#--------------------------------------------------------------------- 

#--------------------------------------------------------------------- 
# Global settings 
#--------------------------------------------------------------------- 
global 
    # to have these messages end up in /var/log/haproxy.log you will 
    # need to: 
    # 
    # 1) configure syslog to accept network log events. This is done 
    # by adding the '-r' option to the SYSLOGD_OPTIONS in 
    # /etc/sysconfig/syslog 
    # 
    # 2) configure local2 events to go to the /var/log/haproxy.log 
    # file. A line like the following can be added to 
    # /etc/sysconfig/syslog 
    # 
    # local2.*      /var/log/haproxy.log 
    # 
    log   127.0.0.1 local2 

    chroot  /var/lib/haproxy 
    pidfile  /var/run/haproxy.pid 
    maxconn  4000 
    user  haproxy 
    group  haproxy 
    daemon 

    # turn on stats unix socket 
    stats socket /var/lib/haproxy/stats 

#--------------------------------------------------------------------- 
# common defaults that all the 'listen' and 'backend' sections will 
# use if not designated in their block 
#--------------------------------------------------------------------- 
defaults 
    mode     http 
    log      global 
    option     httplog 
    option     dontlognull 
    option http-server-close 
    option forwardfor  except 127.0.0.0/8 
    option     redispatch 
    retries     3 
    timeout http-request 10s 
    timeout queue   1m 
    timeout connect   10s 
    timeout client   1m 
    timeout server   1m 
    timeout http-keep-alive 10s 
    timeout check   10s 
    maxconn     3000 

#--------------------------------------------------------------------- 
# main frontend which proxys to the backends 
#--------------------------------------------------------------------- 
frontend main *:5000 
    acl url_static  path_beg  -i /static /images /javascript /stylesheets 
    acl url_static  path_end  -i .jpg .gif .png .css .js 

    use_backend static   if url_static 
    default_backend    app 

#--------------------------------------------------------------------- 
# static backend for serving up images, stylesheets and such 
#--------------------------------------------------------------------- 
backend static 
    balance  roundrobin 
    server  static 127.0.0.1:4331 check 
#--------------------------------------------------------------------- 
# round robin balancing between the various backends 
#--------------------------------------------------------------------- 
backend app 
    balance  roundrobin 
    server app1 127.0.0.1:5001 check 
    server app2 127.0.0.1:5002 check 
    server app3 127.0.0.1:5003 check 
    server app4 127.0.0.1:5004 check 

# Load Balancing for Galera Cluster 
listen galera 3.3.3.3:3306 
    balance roundrobin 
    mode tcp 
    option tcpka 
    option mysql-check user haproxy 
    server node1 1.1.1.1:3306 check weight 1 
    server node2 2.2.2.2:3306 check weight 1 
+0

'netstat -a -n | grep ': 3306'' ... quelque chose qui montre? Est-ce que 'ifconfig' montre une interface réelle avec 3.3.3.3 lié? –

+0

Après des heures de gratter ma tête, je trouve cette étape au travail: vi /etc/sysctl.conf et ajoutez « net.ipv4.ip_nonlocal_bind = 1 » en bas du fichier – user3299633

+0

Cela ne devrait pas avoir été nécessaire. 'écouter galera: 3306 aurait probablement accompli ce que vous vouliez. –

Répondre

0

vi /etc/sysctl.conf et ajoutez « net.ipv4.ip_nonlocal_bind = 1 » en bas du fichier a fini par faire ce que je avais besoin.