我的地盘

软件基地,学习乐园

Haproxy 配置文件中 'listen' cannot handle unexpected argument 报错信息

备注:当killall haproxy启动服务后发现配置文件还没有生效,就需要删除pidfile(目录:/var/run/haproxy.pid) 文件就,然后可以启动服务了。

启动haproxy 命令 /usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/haproxy.cfg

如果发现如下错误:

ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:34] : 'listen' cannot handle unexpected argument '0.0.0.0:80'.
[ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:34] : please use the 'bind' keyword for listening addresses.
[ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:40] : 'listen' cannot handle unexpected argument '0.0.0.0:3838'.
[ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:40] : please use the 'bind' keyword for listening addresses.
[ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:46] : 'listen' cannot handle unexpected argument '0.0.0.0:4140'.
[ALERT] 195/134522 (16200) : parsing [/usr/local/haproxy/haproxy.cfg:46] : please use the 'bind' keyword for listening addresses.
[ALERT] 195/134522 (16200) : Error(s) found in configuration file : /usr/local/haproxy/haproxy.cfg
[WARNING] 195/134522 (16200) : config : proxy 'payserver' has no 'bind' directive. Please declare it as a backend if this was intended.
[WARNING] 195/134522 (16200) : config : missing timeouts for proxy 'payserver'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[WARNING] 195/134522 (16200) : config : proxy 'payserver2' has no 'bind' directive. Please declare it as a backend if this was intended.
[WARNING] 195/134522 (16200) : config : missing timeouts for proxy 'payserver2'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[WARNING] 195/134522 (16200) : config : proxy 'payserver3' has no 'bind' directive. Please declare it as a backend if this was intended.
[WARNING] 195/134522 (16200) : config : missing timeouts for proxy 'payserver3'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[ALERT] 195/134522 (16200) : Fatal errors found in configuration.

解决方案:找到自己的haprox.cfg文件,查看文件(备注:网上有人给的是如下这种写法的,不知道为什么运行不报错,反正我的运行报错)
########test配置#################
isten payserver 0.0.0.0:80
 mode http
 stats enable
 balance roundrobin
 server s1 192.168.1.11:6013
 server s2 192.168.1.11:7013
listen payserver2 0.0.0.0:8011
 mode http
 stats enable
 balance roundrobin
 server s1 192.168.1.11:6014
 server s2 192.168.1.11:7014

将上面 listen 后面的内容改为:

listen payserver

  bind 0.0.0.0:80

就可以解决语法错误,让haproxy正常运行

阅读更多
文章标签: Haproxy
个人分类: Haproxy
想对作者说点什么? 我来说一句

mycat 集群实现过程

后续完善中

mchdba mchdba

2016-03-12 21:54:57

阅读数:10031

没有更多推荐了,返回首页

不良信息举报

Haproxy 配置文件中 'listen' cannot handle unexpected argument 报错信息

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭