HAProxy ne peut pas bind socket [0.0.0.0:8888]
- Je construire un HAProxy sur CentOS 7 et activer les statistiques de la page avec le port 8080. Il semble fonctionner correctement.
Lorsque j'ai posé le port 8888, HAProxy ne fonctionne pas et me donne de la rétroaction.
Après cela, j'ai essayé de nombreuses façons de résoudre ce problème, mais le problème est toujours là.
Personne ne peut m'aider à surmonter ce problème?
Ici est le système d'information
haprxoy.cfg
/etc/haproxy/haproxy.cfg
Le Port 8080 est fine, 8888 ne fonctionne pas.
# [HAPROXY DASHBOARD]
listen stats :8888
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth haproxy:haproxy
stats refresh 10s
De L'État De Service
service haproxy statut
systemd[1]: Started HAProxy Load Balancer.
haproxy-systemd-wrapper[2358]: haproxy-systemd-wrapper: executing /usr/sbin/haproxy -f /etc/haproxy/haproxy.cf...id -Ds
haproxy-systemd-wrapper[2358]: [ALERT] 012/095413 (2359) : Starting proxy stats: cannot bind socket [0.0.0.0:8888]
haproxy-systemd-wrapper[2358]: haproxy-systemd-wrapper: exit, haproxy RC=256
/etc/sysctl.conf
Quelqu'un a dit que cela pourrait être un IP Virtuelle problème, donc j'ai suivi les instruction et ajouter le paramètre ci-dessous, puis exécutez sysctl -p
net.ipv4.ip_nonlocal_bind=1
Réseau Confgiuration
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:15:5d:0a:09:05 brd ff:ff:ff:ff:ff:ff
inet 192.168.4.117/24 brd 192.168.4.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe0a:905/64 scope link
valid_lft forever preferred_lft forever
Les Ports À L'Écoute
ss-écoute
[root@localhost ~]# ss --listening
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
nl UNCONN 0 0 rtnl:NetworkManager/792 *
nl UNCONN 0 0 rtnl:kernel *
nl UNCONN 0 0 rtnl:avahi-daemon/671 *
nl UNCONN 0 0 rtnl:4195096 *
nl UNCONN 4352 0 tcpdiag:ss/3772 *
nl UNCONN 768 0 tcpdiag:kernel *
nl UNCONN 0 0 6:kernel *
nl UNCONN 0 0 7:kernel *
nl UNCONN 0 0 7:systemd/1 *
nl UNCONN 0 0 7:dbus-daemon/680 *
nl UNCONN 0 0 9:auditd/640 *
nl UNCONN 0 0 9:kernel *
nl UNCONN 0 0 9:systemd/1 *
nl UNCONN 0 0 10:kernel *
nl UNCONN 0 0 11:kernel *
nl UNCONN 0 0 15:iprdump/723 *
nl UNCONN 0 0 15:systemd/1 *
nl UNCONN 0 0 15:-4124 *
nl UNCONN 0 0 15:systemd-logind/679 *
nl UNCONN 0 0 15:NetworkManager/792 *
nl UNCONN 0 0 15:iprinit/713 *
nl UNCONN 0 0 15:-4107 *
nl UNCONN 0 0 15:-4125 *
nl UNCONN 0 0 15:-4119 *
nl UNCONN 0 0 15:iprupdate/710 *
nl UNCONN 0 0 15:-4118 *
nl UNCONN 0 0 15:kernel *
nl UNCONN 0 0 15:-4117 *
nl UNCONN 0 0 15:tuned/676 *
nl UNCONN 0 0 16:kernel *
nl UNCONN 0 0 18:kernel *
u_str LISTEN 0 128 /run/lvm/lvmetad.socket 11542 * 0
u_str LISTEN 0 128 /run/systemd/journal/stdout 6697 * 0
u_dgr UNCONN 0 0 /run/systemd/journal/socket 6700 * 0
u_dgr UNCONN 0 0 /dev/log 6702 * 0
u_dgr UNCONN 0 0 /run/systemd/shutdownd 11321 * 0
u_dgr LISTEN 0 128 /run/udev/control 11338 * 0
u_str LISTEN 0 100 public/flush 18726 * 0
u_str LISTEN 0 100 public/showq 18741 * 0
u_str LISTEN 0 30 /var/run/NetworkManager/private-dhcp 17003 * 0
u_dgr UNCONN 0 0 @/org/freedesktop/systemd1/notify 11259 * 0
u_str LISTEN 0 100 private/tlsmgr 18708 * 0
u_str LISTEN 0 30 /var/run/NetworkManager/private 16518 * 0
u_str LISTEN 0 128 /var/run/avahi-daemon/socket 13986 * 0
u_str LISTEN 0 128 /var/run/dbus/system_bus_socket 13998 * 0
u_str LISTEN 0 100 private/rewrite 18711 * 0
u_str LISTEN 0 100 private/bounce 18714 * 0
u_str LISTEN 0 100 private/defer 18717 * 0
u_str LISTEN 0 100 private/trace 18720 * 0
u_str LISTEN 0 100 private/verify 18723 * 0
u_str LISTEN 0 100 private/proxymap 18729 * 0
u_str LISTEN 0 100 private/proxywrite 18732 * 0
u_str LISTEN 0 100 private/smtp 18735 * 0
u_str LISTEN 0 100 private/relay 18738 * 0
u_str LISTEN 0 100 private/error 18744 * 0
u_str LISTEN 0 100 private/retry 18747 * 0
u_str LISTEN 0 100 private/discard 18750 * 0
u_str LISTEN 0 100 private/local 18753 * 0
u_str LISTEN 0 100 private/virtual 18756 * 0
u_str LISTEN 0 100 private/lmtp 18759 * 0
u_str LISTEN 0 100 private/anvil 18762 * 0
u_str LISTEN 0 100 private/scache 18765 * 0
u_str LISTEN 0 100 public/pickup 18697 * 0
u_str LISTEN 0 100 public/cleanup 18701 * 0
u_str LISTEN 0 100 public/qmgr 18704 * 0
u_str LISTEN 0 30 /run/systemd/private 11261 * 0
u_dgr UNCONN 0 0 * 14733 * 6700
u_dgr UNCONN 0 0 * 15011 * 6702
u_dgr UNCONN 0 0 * 12659 * 12658
u_dgr UNCONN 0 0 * 18818 * 6702
u_dgr UNCONN 0 0 * 15244 * 6702
u_dgr UNCONN 0 0 * 16991 * 6702
u_dgr UNCONN 0 0 * 12644 * 6700
u_dgr UNCONN 0 0 * 12658 * 12659
u_dgr UNCONN 0 0 * 19513 * 6700
u_dgr UNCONN 0 0 * 29994 * 6702
u_dgr UNCONN 0 0 * 13899 * 6702
u_dgr UNCONN 0 0 * 16528 * 6702
u_dgr UNCONN 0 0 * 30457 * 6702
u_dgr UNCONN 0 0 * 18632 * 6702
u_dgr UNCONN 0 0 * 16504 * 6702
raw UNCONN 0 0 :::ipv6-icmp :::*
tcp UNCONN 0 0 *:ipproto-5353 *:*
tcp UNCONN 0 0 *:ipproto-50900 *:*
tcp LISTEN 0 100 127.0.0.1:smtp *:*
tcp LISTEN 0 128 *:ssh *:*
tcp LISTEN 0 100 ::1:smtp :::*
tcp LISTEN 0 128 :::ssh :::*
netstat -anp | grep ":8888"
J'ai déjà vérifié. Ne l'utilisez pas.
Règle de vérification de selinux, voir /var/log/audit/audit.journal
OriginalL'auteur Code Man | 2016-01-14
Vous devez vous connecter pour publier un commentaire.
Merci pour vous les gars au premier abord.
J'ai résolu ce problème en suivant la commande.
setsebool -P haproxy_connect_any=1
Ça marche pour moi!
OriginalL'auteur Code Man
setsebool montre la bonne direction.
C'est un SELinux question. Essayez d'installer la suite d'outils pour SELinux:
yum install policycoreutils policycoreutils-python selinux-policy selinux-policy-ciblées libselinux-utils setroubleshoot-serveur setools setools-console mcstrans
Appuyez sur le "Bouton" en tapant "
selinux permissive
" et essayez de démarrer leservices. Ils échouent.
Alors:
grep haprox /var/log/audit/audit.log | audit2allow -M haproxy
et activer la haproxy autorisations par
Fait!
OriginalL'auteur Jottschi
Ajouter net.ipv4.ip_nonlocal_bind=1 dans /etc/sysctl.conf
sysctl -p
Redémarrer le haproxy service(service de redémarrer haproxy). il va travailler.
OriginalL'auteur Gnanasekar Velu
/etc/sysconfig/selinux
SELINUX=permissive
redémarrage
a fonctionné pour moi
OriginalL'auteur sandejai
Code de la réponse de l'Homme travaille, mais vous pouvez également gérer selinux pour votre port:
OriginalL'auteur nd34567s32e
Je suppose que c'est un SELinux question.
Essayez setenforce 0, puis redémarrez l'HAProxy service. Si HAProxy fonctionne après ce changement, la restauration de l'application de statut avec setenforce 1, puis exécutez setsebool -P haproxy_connect_any pour changer le booléen SELinux qui est probablement affecter ce, et redémarrez à nouveau le service.
OriginalL'auteur Raj Raulo