我目前正在尝试使用这些说明来自 graphite wiki。本质上,它使用 apache 和 mod_wsgi 来为 graphite 提供前端。
一切似乎都进展顺利,只是 apache / graphite webapp 似乎从未向 Web 浏览器返回响应(浏览器不断等待加载页面)。我已打开 graphite 调试信息,但日志文件中唯一的消息是此消息,在 info.log 中反复出现(pid 始终在变化):
2012 年 2 月 23 日星期四 01:59:38 :: graphite.wsgi - pid 4810 - 重新加载搜索索引
这些说明之前曾帮助我在 Ubuntu 机器上设置 graphite。我怀疑 mod_wsgi 快要不行了,但我确认 mod_wsgi 在不为 graphite webapp 提供服务时可以正常工作。
这是我的 graphite.conf vhost 文件的样子:
WSGISocketPrefix /etc/httpd/wsgi/
<VirtualHost *:80>
ServerName # Server name
DocumentRoot "/opt/graphite/webapp"
ErrorLog /opt/graphite/storage/log/webapp/error.log
CustomLog /opt/graphite/storage/log/webapp/access.log common
# I've found that an equal number of processes & threads tends
# to show the best performance for Graphite (ymmv).
WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
WSGIProcessGroup graphite
WSGIApplicationGroup %{GLOBAL}
WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi
Alias /content/ /opt/graphite/webapp/content/
<Location "/content/">
SetHandler None
</Location>
# XXX In order for the django admin site media to work you
# must change @DJANGO_ROOT@ to be the path to your django
# installation, which is probably something like:
# /usr/lib/python2.6/site-packages/django
Alias /media/ "/usr/lib64/python2.6/site-packages/django/contrib/admin/media/"
<Location "/media/">
SetHandler None
</Location>
# The graphite.wsgi file has to be accessible by apache. It won't
# be visible to clients because of the DocumentRoot though.
<Directory /opt/graphite/conf/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
答案1
不能解决您的问题,但您不需要:
<Location "/content/">
SetHandler None
</Location>
<Location "/media/">
SetHandler None
</Location>
以前只有在使用 mod_python 时才需要使用这样的 SetHandler。使用 mod_wsgi 时则不需要。
我建议您做的是确保在 Apache 下运行代码的用户实际上对应用程序数据文件所需的任何目录具有适当的写访问权限。