Haproxy 后端访问不通(关闭SELinux 或 AppArmor)

现象

# General socket error (Permission denied)
[root@harbor log]# tail -f /var/log/haproxy.log 
Jan 20 11:41:45 localhost haproxy[13645]: Proxy ceph-rgw started.
Jan 20 11:41:45 localhost haproxy[13645]: Proxy stats started.
Jan 20 11:41:45 localhost haproxy[13645]: Server ceph-rgw/10.30.17.171 is DOWN, reason: Layer4 connection problem, info: "General socket error (Permission denied)", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Jan 20 11:41:47 localhost haproxy[13646]: Server ceph-rgw/10.30.17.172 is DOWN, reason: Layer4 connection problem, info: "General socket error (Permission denied)", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Jan 20 11:41:47 localhost haproxy[13646]: proxy ceph-rgw has no server available!

解决办法

# 后端的端口可以正常访问 
# 但是haproxy配置好之后无法访问到
原因: 需要关闭系统的 selinux 权限

# 暂时
setenforce 0

# 永久
[root@harbor log]# vim /etc/selinux/config 
disabled
[root@harbor log]# tail -f /var/log/haproxy.log 
Jan 20 11:44:16 localhost haproxy[14115]: Proxy ceph-rgw started.
Jan 20 11:44:16 localhost haproxy[14115]: Proxy stats started.
Jan 20 11:44:26 localhost haproxy[14116]: 10.30.10.39:50471 [20/Jan/2025:11:44:26.909] stats stats/<STATS> 0/0/0/0/0 200 15108 - - LR-- 2/2/0/0/0 0/0 "GET /haproxy-status HTTP/1.1"
Jan 20 11:44:27 localhost haproxy[14116]: 10.30.10.39:50471 [20/Jan/2025:11:44:26.910] stats stats/<NOSRV> 103/-1/-1/-1/103 503 212 - - SC-- 1/1/0/0/0 0/0 "GET /favicon.ico HTTP/1.1"

 

posted @ 2025-01-20 11:47  しみずよしだ  阅读(51)  评论(0)    收藏  举报