为什么 HAProxy 不会监听 80 端口?
新机器,没有正在运行的http服务器(没有httpd,没有lighttpd,没有nginx)
$ netstat -nat | grep 80 | grep LISTEN
不会产生任何结果...
的原因可能是什么
global
maxconn 72000
daemon
defaults
mode http
timeout connect 4000ms
timeout client 60000ms
timeout server 30000ms
frontend my_frontend
bind *:80
default_backend cdn
backend cdn
server cdn1 10.177.0.17:80 weight 1 maxconn 8192 check
server cdn2 10.177.1.92:80 weight 1 maxconn 8192 check
server cdn3 10.177.1.147:80 weight 1 maxconn 8192 check
server cdn4 10.177.1.202:80 weight 1 maxconn 8192 check
server cdn4 10.177.1.202:80 weight 1 maxconn 8192 check
server cdn5 10.177.1.211:80 weight 1 maxconn 8192 check
server cdn6 10.177.1.93:80 weight 1 maxconn 8192 check
server cdn7 10.177.1.230:80 weight 1 maxconn 8192 check
server cdn8 10.177.0.7:80 weight 1 maxconn 8192 check
server cdn9 10.177.0.196:80 weight 1 maxconn 8192 check
server cdn10 10.177.1.82:80 weight 1 maxconn 8192 check
server cdn11 10.177.0.124:80 weight 1 maxconn 8192 check
server cdn12 10.177.1.142:80 weight 1 maxconn 8192 check
server cdn13 10.177.1.58:80 weight 1 maxconn 8192 check
server cdn14 10.177.1.137:80 weight 1 maxconn 8192 check
server cdn15 10.177.1.169:80 weight 1 maxconn 8192 check
server cdn16 10.177.0.187:80 weight 1 maxconn 8192 check
server cdn17 10.177.1.95:80 weight 1 maxconn 8192 check
server cdn18 10.177.1.123:80 weight 1 maxconn 8192 check
这是我的HAProxy配置,HAProxy不从源代码运行haproxy-1.4.13
。当我尝试启动它时出现此错误
[ALERT] 084/220004 (2409) : Starting frontend my_frontend: cannot bind socket
Fresh machine, no http servers are running (no httpd, no lighttpd, no nginx)
$ netstat -nat | grep 80 | grep LISTEN
yields nothing...
Here's my HAProxy conf, what can be the reason for HAProxy not to
global
maxconn 72000
daemon
defaults
mode http
timeout connect 4000ms
timeout client 60000ms
timeout server 30000ms
frontend my_frontend
bind *:80
default_backend cdn
backend cdn
server cdn1 10.177.0.17:80 weight 1 maxconn 8192 check
server cdn2 10.177.1.92:80 weight 1 maxconn 8192 check
server cdn3 10.177.1.147:80 weight 1 maxconn 8192 check
server cdn4 10.177.1.202:80 weight 1 maxconn 8192 check
server cdn4 10.177.1.202:80 weight 1 maxconn 8192 check
server cdn5 10.177.1.211:80 weight 1 maxconn 8192 check
server cdn6 10.177.1.93:80 weight 1 maxconn 8192 check
server cdn7 10.177.1.230:80 weight 1 maxconn 8192 check
server cdn8 10.177.0.7:80 weight 1 maxconn 8192 check
server cdn9 10.177.0.196:80 weight 1 maxconn 8192 check
server cdn10 10.177.1.82:80 weight 1 maxconn 8192 check
server cdn11 10.177.0.124:80 weight 1 maxconn 8192 check
server cdn12 10.177.1.142:80 weight 1 maxconn 8192 check
server cdn13 10.177.1.58:80 weight 1 maxconn 8192 check
server cdn14 10.177.1.137:80 weight 1 maxconn 8192 check
server cdn15 10.177.1.169:80 weight 1 maxconn 8192 check
server cdn16 10.177.0.187:80 weight 1 maxconn 8192 check
server cdn17 10.177.1.95:80 weight 1 maxconn 8192 check
server cdn18 10.177.1.123:80 weight 1 maxconn 8192 check
running haproxy-1.4.13 from source.
When I try to start it I get this error
[ALERT] 084/220004 (2409) : Starting frontend my_frontend: cannot bind socket
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
添加称为用户或某些权限较低的用户的全局配置参数
。您仍然需要以 root 身份启动,但是在获取端口之后,进程本身会将用户/权限降低到任何人。
add global config parameter called user
or some less privileged user. Still you need to start as root, but after acquiring the port process itself will reduce the user/privileges to nobody.
所以我尝试用root用户启动haproxy,它成功了。
我不确定在 root 下运行它是否是一个好主意。
So I tried starting haproxy with the root user and it worked.
I'm not sure if it's a good idea to run it under root though.
haproxy 可以在其他用户下运行。比如没有人..
haproxy can run under some other user. such as nobody..