每 2 秒创建一次会话文件。在 openshift Laravel PHP nginx haproxy 上运行

每 2 秒创建一次会话文件。在 openshift Laravel PHP nginx haproxy 上运行

服务器启动时无法访问是什么原因造成的?

我已经运行rhc tail我的应用程序来监控新日志。

这是我的日志 http://laravel.io/bin/Dez4o


当我使用启动应用程序时rhc app-start

应用程序根目录/日志/php-fpm-error.log

[26-Jul-2016 21:53:00] NOTICE: [pool www] 'user' directive is ignored     
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: [pool www] 'group' directive is ignored
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: fpm is running, pid 33590
[26-Jul-2016 21:53:00] NOTICE: ready to handle connections

应用程序根目录/日志/haproxy.log

[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 207/215259 (33493) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 207/215259 (33493) : proxy 'express' has no server available!

应用程序根目录/日志/haproxy_ctld.log

I, [2016-07-26T21:52:59.962585 #33508]  INFO -- : Starting haproxy_ctld

nginx/日志/错误日志

2016/07/26 21:53:03 [warn] 36575#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2

应用程序根目录/日志/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:06 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:08 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:10 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

应用程序根目录/日志/haproxy.log

[WARNING] 207/215310 (33493) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 69ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.

应用程序根目录/日志/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:12 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:14 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:16 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:18 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:20 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:22 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

然后我尝试访问我的网站根目录

(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  200 "GET /login HTTP/1.1" 1422 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/bootstrap/css/bootstrap.min.css HTTP/1.1" 23930 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/plugins/font-awesome/css/font-awesome.min.css HTTP/1.1" 6734 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
... other assets

但加载后日志继续

(my.sever.ip.address) - - [26/Jul/2016:21:53:26 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:29 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:31 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:33 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

然后我执行了rhc app-stop停止服务器

这些是执行“stop”后的日志

应用程序根目录/日志/php-fpm-error.log

[26-Jul-2016 21:53:55] NOTICE: Terminating ...
[26-Jul-2016 21:53:55] NOTICE: exiting, bye-bye!

nginx/日志/错误日志

2016/07/26 21:53:55 [warn] 37102#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2
2016/07/26 21:53:55 [notice] 37102#0: signal process started

access logs

答案1

所描述的行为与 haproxy 的 http 健康检查相符。由于 haproxy 在健康检查之间不保留 cookie,因此会创建新会话,因此您的应用程序 (Laravel) 会将该请求视为新浏览会话的第一个请求。

您可以将健康检查网址重新配置为不使用会话的网址,以避免创建会话文件,但这意味着即使会话功能中断,健康检查也会通过。

“inter”参数设置两次连续健康检查之间的间隔(以毫秒为单位)。如果未指定,则延迟默认为 2000 毫秒。

来源:http://cbonte.github.io/haproxy-dconv/1.6/snapshot/configuration.html#inter

相关内容