在 O 版本的 OpenStack 中,利用了 uWSGI 服务器作为 Apache 服务器和 Keystone 服务之间的桥梁。关于 uWSGI 与 CGI、FastCGI、WSGI 之间的区别,可参考博文网关协议学习:CGI、FastCGI、WSGI。
对于 Keystone 服务启动,源码的 DOC 目录下就有一个文件(doc/source/apache-httpd.rst)说明如何启动 Keystone 服务:
1
2
3
4
5
6
7
8
9
10
11Now configure and start the uwsgi services. Copy the
`httpd/keystone-uwsgi-admin.ini` and `httpd/keystone-uwsgi-public.ini` files to
`/etc/keystone`. Update the files to match your system configuration (for
example, you'll want to set the number of processes and threads for the public
and admin servers).
Start up the keystone servers using uwsgi::
$ sudo pip install uwsgi
$ uwsgi /etc/keystone/keystone-uwsgi-admin.ini
$ uwsgi /etc/keystone/keystone-uwsgi-public.ini
需要注意的是,uWSGI 服务器并不直接向外提供服务,而是由 Apache 或 Nginx 这种专门服务器向外接收请求,然后转发给 uWSGI 服务器。
从上边说明,我们也可以看到,Keystone 服务是分成 admin 和 public 两种的。下边我们以 admin 为例来进行说明。首先,先看一下 keystone-uwsgi-admin.ini 的内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25[uwsgi]
wsgi-file = /usr/local/bin/keystone-wsgi-admin# 服务入口
# Versions of mod_proxy_uwsgi>=2.0.6 should use a UNIX socket, see
# http://uwsgi-docs.readthedocs.org/en/latest/Apache.html#mod-proxy-uwsgi
uwsgi-socket = 127.0.0.1:35358