昨天介绍swift服务启动架构的时候,谈到了proxy启动的时候,根据proxy-server.conf配置文件依次启动服务,下面来看一下我的proxy-server.conf文件
[DEFAULT]
bind_port = 8080
bind_ip = 192.168.4.87
user = swift
log_level = DEBUG
log_facility = LOG_LOCAL3
[pipeline:main]
pipeline = healthcheck cache authtoken keystone proxy-server
[app:proxy-server]
use = egg:swift#proxy
all_account_management = true
account_autocreate = true
[filter:keystone]
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
operator_roles = admin, swiftoperator
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
delay_auth_decision =1
auth_port = 35357
auth_host = 192.168.4.87
auth_protocol = http
admin_token = zhoubing
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.4.87:11211
其服务启动顺序 会根据 pipeline 逆序启动,但是当请求来的时候,会调用按照顺序调用filter,例如:
pipeline = filter1 filter2 filter2 myapp
这样会先调用 filter1.__call__(env, start_response)然后是filter2._call__(env, start_response),依次下去最后是myapp.__call__(env,start_response)。 对于Swift来说,主要的流程在于请求来了->auth_token->swift_auth->handle_request,其中每个filter对请求做相应的处理 然后返回。