昨天介紹swift服務啓動架構的時候,談到了proxy啓動的時候,根據proxy-server.conf配置文件依次啓動服務,下面來看一下個人proxy-server.conf文件python
[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,例如:swift
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對請求作相應的處理 而後返回。app