昨天介绍swift服务启动架构的时候,谈到了proxy启动的时候,根据proxy-server.conf配置文件依次启动服务,下面来看一下我的proxy-server.conf文件
[DEFAULT]bind_port = 8080bind_ip = 192.168.4.87user = swiftlog_level = DEBUGlog_facility = LOG_LOCAL3[pipeline:main]pipeline = healthcheck cache authtoken keystone proxy-server[app:proxy-server]use = egg:swift#proxyall_account_management = trueaccount_autocreate = true[filter:keystone]paste.filter_factory = keystone.middleware.swift_auth:filter_factoryoperator_roles = admin, swiftoperator[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factorydelay_auth_decision =1auth_port = 35357auth_host = 192.168.4.87auth_protocol = httpadmin_token = zhoubing[filter:healthcheck]use = egg:swift#healthcheck[filter:cache]use = egg:swift#memcachememcache_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对请求做相应的处理 然后返回。