【问题标题】:What exactly should i do at haproxy.cfg我到底应该在 haproxy.cfg 做什么
【发布时间】:2016-01-02 22:59:21
【问题描述】:

我的 php 应用程序工作正常,但有时我得到了

504 Gateway Time-out 服务器没有及时响应。

即使我重新启动应用程序,我也无法摆脱这个问题。

haproxy 日志:

  [WARNING] 001/175903 (47931) : Server express/local-gear is DOWN, reason: Layer4 timeout, check duration: 2000ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 001/175903 (47931) : proxy 'express' has no server available!
[WARNING] 001/175933 (47931) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 9ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
[WARNING] 001/180043 (47931) : Server express/local-gear is DOWN, reason: Layer4 timeout, check duration: 2001ms. 0 active and 0 backup servers left. 1 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 001/180043 (47931) : proxy 'express' has no server available!
[WARNING] 001/180113 (47931) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 19ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.

我在互联网上找到的解决方案是在haproxy.cfg option httpchk GET 中进行更改,但不知道我到底应该做什么。

我的应用程序位于@/app-root/repo/php 文件夹那里我有 index.php 我也有 api 文件夹来访问我的应用程序 api。

【问题讨论】:

    标签: php openshift haproxy


    【解决方案1】:

    如果您想编辑您的haproxy.cfg,您可以通过rhc ssh &lt;yourApp&gt; 进入您的应用程序,然后编辑~/haproxy/conf/haproxy.cfg 文件。但是,请注意不支持自定义 haproxy 配置,因此我建议您在进行任何更改之前备份文件,以防您需要恢复默认配置。

    进行任何配置更改后,请执行rhc app-restart &lt;yourApp&gt; 以重新启动应用程序。

    【讨论】:

    • 当然可以,但是在 httpchk GET 选项下我应该怎么做?我应该写什么链接
    • 我以为您正在尝试根据上述解决方案中的一些说明找到要更改 URI 的文件(也许您可以在问题中链接这些文件)。我个人没有微调 httpchk 配置值的经验,也许其他人可以发表评论。但是,您是否注意到 504 仅在您的齿轮因不活动而空转后才出现? (只有免费账户的齿轮处于空闲状态)您可以在the web interface->您的应用->状态(空闲/已启动)访问应用程序之前检查齿轮是否空闲。
    猜你喜欢
    • 2016-12-06
    • 1970-01-01
    • 1970-01-01
    • 2013-03-29
    • 2011-10-30
    • 2010-12-30
    • 1970-01-01
    • 2012-11-24
    • 1970-01-01
    相关资源
    最近更新 更多