【问题标题】:503 service unavailable openshift scalable app with symfony2使用 symfony2 的 503 服务不可用 openshift 可扩展应用程序
【发布时间】:2014-07-23 03:41:50
【问题描述】:

我在 openshift 创建了一个新应用。这是运行 symfony 项目的 PHP 5.4。 我来了

503 Service Unavailable
No server is available to handle this request

APP 墨盒:

  • PHP 5.4 + Web Balancer(使用 1 或 2 个齿轮)
  • MySQL 5.5

我更改了 haproxy.cnf,就像在回答 CodeIgniter (/MyCIapp/) 的相同问题时所说的那样

option httpchk GET /web/

但它没有奏效。我不知道这是否应该是donde,我只是在尝试搜索错误:S

这是我完整的 haproxy.cnf

#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the '-r' option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    #log         127.0.0.1 local2

    maxconn     256

    # turn on stats unix socket
    stats socket /var/lib/openshift/53cf023e500446e8e40000b6/haproxy//run/stats level admin

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    #option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 128

listen stats 127.6.152.3:8080
    mode http
    stats enable
    stats uri /

listen express 127.6.152.2:8080

    cookie GEAR insert indirect nocache
    option httpchk GET /

    balance leastconn
    server local-gear 127.6.152.1:8080 check fall 2 rise 3 inter 2000 cookie local-53cf023e500446e8e40000b6
                                                                                                                                      66,4          Bot

这是 rhc 的尾部结果:

==> app-root/logs/haproxy.log <==
[WARNING] 202/234012 (389054) : Server express/local-gear is DOWN for maintenance.
[WARNING] 202/234013 (389054) : Server express/local-gear is DOWN for maintenance.
[WARNING] 202/234017 (422420) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 202/234017 (422420) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 202/234018 (422420) : Server express/local-gear is DOWN, reason: Layer7 wrong status, code: 404, info: "Not Found", check duration: 905ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 202/234018 (422420) : proxy 'express' has no server available!
[WARNING] 202/234021 (422420) : Server express/local-gear is DOWN for maintenance.
[WARNING] 202/234025 (422420) : Server express/local-gear is UP (leaving maintenance).
[WARNING] 202/234027 (422420) : Server express/local-gear is DOWN, reason: Layer7 wrong status, code: 404, info: "Not Found", check duration: 279ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 202/234027 (422420) : proxy 'express' has no server available!

==> app-root/logs/php.log <==
- - - [22/Jul/2014:23:40:38 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:40 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:42 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:44 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:47 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:49 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:51 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:53 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:55 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:40:58 -0400] "GET / HTTP/1.0" 404 554 "-" "-"

==> app-root/logs/haproxy_ctld.log <==
I, [2014-07-22T20:31:57.655534 #446960]  INFO -- : Starting haproxy_ctld
I, [2014-07-22T23:04:34.918141 #355794]  INFO -- : Starting haproxy_ctld
I, [2014-07-22T23:11:13.815573 #368500]  INFO -- : Starting haproxy_ctld
I, [2014-07-22T23:13:54.502196 #373865]  INFO -- : Starting haproxy_ctld
I, [2014-07-22T23:15:19.110173 #376596]  INFO -- : Starting haproxy_ctld
I, [2014-07-22T23:40:18.395416 #422460]  INFO -- : Starting haproxy_ctld

==> app-root/logs/php.log <==
- - - [22/Jul/2014:23:41:00 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:41:02 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:41:04 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:41:06 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:41:09 -0400] "GET / HTTP/1.0" 404 554 "-" "-"
- - - [22/Jul/2014:23:41:11 -0400] "GET / HTTP/1.0" 404 554 "-" "-"

【问题讨论】:

  • 提供更多关于如何创建 symfony 应用程序的上下文可能是个好主意。例如,您是否使用了快速入门?如果有,是哪一个?如果不是快速入门,那么您采取了哪些步骤来加载 symfony。
  • 我用 composer 创建了一个 symfony 2.5.0 应用程序。添加了 FosUserBundle 和一个要测试的包。然后是:gist.github.com/brunodmt/9571555,就是这样。也许 DocumentRoot 有问题?我没有在 openshift 上更改任何其他内容。我删除了要点上描述的部署钩子的作曲家部分

标签: symfony openshift


【解决方案1】:

问题是:

option httpchk GET /

- - - [22/Jul/2014:23:40:40 -0400] "GET / HTTP/1.0" 404 554 "-" "-"

我的项目没有 / 的路线。

真正的问题是我对 haproxy 一无所知 :)

似乎当 haproxy.cnf 中配置的路由不存在时,它不会启动齿轮,因此无法解析任何其他有效路由。 haproxy_status 页面将其显示为 DOWN。 当我在我的项目中为 / 添加有效路线时,haproxy 状态显示齿轮为 UP 并开始工作。

【讨论】:

  • 我希望这里有更多的解释。我有同样的 503 错误并且 haproxy.cfg 和 haproxy.log 文件是相似的。我只是不明白“/”。
【解决方案2】:

你在正确的轨道上。 SSH 登录并进行编辑后

haproxy/conf/haproxy.cfg

你需要换行

选项 httpchk GET /

这应该是您的应用程序上的状态 URL,当您的应用程序服务器状态正常工作时,它将返回 HTTP 200,否则返回 HTTP 状态 404 或 500 左右。所以你应该在你的应用程序中嵌入一个小的状态页面。让它轻一点,因为 HA 代理会经常调用它——我的只是检查池中是否有实时数据库连接并且不返回任何内容。

然后像这样将相对 url 放在你的 haproxy.cfg 的 httpchk 行中

选项 httpchk GET /my-app/status

【讨论】:

    猜你喜欢
    • 2016-07-29
    • 1970-01-01
    • 2016-11-30
    • 2013-01-02
    • 2014-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多