在多节点 openstack 环境中部署了单节点 swift,即包含 swift-proxy 和 swift-storage charms。这是我的配置文件:
swift-proxy:
zone-assignment: 'manual'
replicas: 1
swift-hash: 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'
swift-storage:
zone: 1
block-device: /etc/swift/storage.img|10G
(由于这是一个实验性设置,我不需要多个副本)。在循环设备上安装 storage.img 后:
/etc/swift/storage.img /srv/node/loop0 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0
并重新启动swift服务,我能够上传和下载文件,按照http://docs.openstack.org/icehouse/install-guide/install/apt/content/verify-object-storage-installation.html。
目前,问题是从 Horizon 访问 Swift 时,会返回 [HTTP/1.1 500 INTERNAL SERVER ERROR 49ms] 错误,并在 /horizon/project/containers/ 页面上显示“Something went error!”。Horizon 节点上的 apache 服务器日志和 Swift 节点上的 syslog 未传达任何有用的消息:
Apache logs:
...
10.0.0.63 - - [01/Aug/2014:22:47:46 +0000] "GET /horizon/project/containers/ HTTP/1.1" 500 2205 "https://10.0.0.63/horizon/admin/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0"
...
Swift logs:
...
Aug 1 22:52:11 node2 account-replicator: Beginning replication run
Aug 1 22:52:11 node2 account-replicator: Replication run OVER
Aug 1 22:52:11 node2 account-replicator: Attempted to replicate 1 dbs in 0.00824 seconds (121.32638/s)
Aug 1 22:52:11 node2 account-replicator: Removed 0 dbs
Aug 1 22:52:11 node2 account-replicator: 0 successes, 0 failures
Aug 1 22:52:11 node2 account-replicator: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
Aug 1 22:52:27 node2 object-replicator: Starting object replication pass.
Aug 1 22:52:27 node2 object-replicator: 1/1 (100.00%) partitions replicated in 0.00s (274.28/sec, 0s remaining)
Aug 1 22:52:27 node2 object-replicator: 1 suffixes checked - 0.00% hashed, 0.00% synced
Aug 1 22:52:27 node2 object-replicator: Partition times: max 0.0008s, min 0.0008s, med 0.0008s
Aug 1 22:52:27 node2 object-replicator: Object replication complete. (0.00 minutes)
Aug 1 22:52:39 node2 container-replicator: Beginning replication run
Aug 1 22:52:39 node2 container-replicator: Replication run OVER
Aug 1 22:52:39 node2 container-replicator: Attempted to replicate 1 dbs in 0.00803 seconds (124.54721/s)
Aug 1 22:52:39 node2 container-replicator: Removed 0 dbs
Aug 1 22:52:39 node2 container-replicator: 0 successes, 0 failures
Aug 1 22:52:39 node2 container-replicator: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
Aug 1 22:52:40 node2 object-auditor: Begin object audit "forever" mode (ZBF)
Aug 1 22:52:40 node2 object-auditor: Begin object audit "forever" mode (ALL)
Aug 1 22:52:40 node2 object-auditor: Object audit (ZBF) "forever" mode completed: 0.00s. Total quarantined: 0, Total errors: 0, Total files/sec: 639.38, Total bytes/sec: 0.00, Auditing time: 0.00, Rate: 0.63
Aug 1 22:52:40 node2 object-auditor: Object audit (ALL) "forever" mode completed: 0.01s. Total quarantined: 0, Total errors: 0, Total files/sec: 77.42, Total bytes/sec: 14090.95, Auditing time: 0.01, Rate: 0.96
Aug 1 22:52:40 node2 object-auditor: Begin object audit "forever" mode (ZBF)
Aug 1 22:52:40 node2 object-auditor: Object audit (ZBF) "forever" mode completed: 0.00s. Total quarantined: 0, Total errors: 0, Total files/sec: 623.87, Total bytes/sec: 0.00, Auditing time: 0.00, Rate: 0.66
Aug 1 22:52:40 node2 container-updater: Begin container update sweep
Aug 1 22:52:40 node2 container-updater: Container update sweep completed: 0.05s
Aug 1 22:52:41 node2 account-replicator: Beginning replication run
Aug 1 22:52:41 node2 account-replicator: Replication run OVER
Aug 1 22:52:41 node2 account-replicator: Attempted to replicate 1 dbs in 0.00801 seconds (124.78064/s)
Aug 1 22:52:41 node2 account-replicator: Removed 0 dbs
Aug 1 22:52:41 node2 account-replicator: 0 successes, 0 failures
Aug 1 22:52:41 node2 account-replicator: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
Aug 1 22:52:57 node2 object-replicator: Starting object replication pass.
Aug 1 22:52:57 node2 object-replicator: 1/1 (100.00%) partitions replicated in 0.00s (274.42/sec, 0s remaining)
Aug 1 22:52:57 node2 object-replicator: 1 suffixes checked - 0.00% hashed, 0.00% synced
Aug 1 22:52:57 node2 object-replicator: Partition times: max 0.0009s, min 0.0009s, med 0.0009s
Aug 1 22:52:57 node2 object-replicator: Object replication complete. (0.00 minutes)
Aug 1 22:53:09 node2 container-replicator: Beginning replication run
Aug 1 22:53:09 node2 container-replicator: Replication run OVER
Aug 1 22:53:09 node2 container-replicator: Attempted to replicate 1 dbs in 0.00786 seconds (127.24117/s)
Aug 1 22:53:09 node2 container-replicator: Removed 0 dbs
Aug 1 22:53:09 node2 container-replicator: 0 successes, 0 failures
Aug 1 22:53:09 node2 container-replicator: no_change:0 ts_repl:0 diff:0 rsync:0 diff_capped:0 hashmatch:0 empty:0
Aug 1 22:53:10 node2 object-auditor: Begin object audit "forever" mode (ZBF)
Aug 1 22:53:10 node2 object-auditor: Begin object audit "forever" mode (ALL)
Aug 1 22:53:10 node2 object-auditor: Object audit (ZBF) "forever" mode completed: 0.00s. Total quarantined: 0, Total errors: 0, Total files/sec: 283.05, Total bytes/sec: 0.00, Auditing time: 0.00, Rate: 0.68
Aug 1 22:53:10 node2 object-auditor: Object audit (ALL) "forever" mode completed: 0.01s. Total quarantined: 0, Total errors: 0, Total files/sec: 84.08, Total bytes/sec: 15301.85, Auditing time: 0.01, Rate: 0.89
Aug 1 22:53:10 node2 object-auditor: Begin object audit "forever" mode (ZBF)
Aug 1 22:53:10 node2 object-auditor: Object audit (ZBF) "forever" mode completed: 0.00s. Total quarantined: 0, Total errors: 0, Total files/sec: 714.90, Total bytes/sec: 0.00, Auditing time: 0.00, Rate: 0.64
...
需要注意的是,为了使 swift cli 正常工作,我必须使用“--insecure”选项,否则 ssl 验证会失败,例如发出 swift --debug -v -V 2.0 list:
...
DEBUG:iso8601.iso8601:Got u'00' for 'hour' with default None
DEBUG:iso8601.iso8601:Got u'01' for 'minute' with default None
DEBUG:iso8601.iso8601:Got u'35' for 'second' with default None
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): 10.0.0.59
[Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
其中 10.0.0.59 是 Swift 节点的地址;但是,使用“--insecure”选项:
...
DEBUG:iso8601.iso8601:Got u'03' for 'minute' with default None
DEBUG:iso8601.iso8601:Got u'37' for 'second' with default None
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): 10.0.0.59
DEBUG:urllib3.connectionpool:Setting read timeout to <object object at 0x7feea6bd2090>
DEBUG:urllib3.connectionpool:"GET /v1/AUTH_9b508c0ebfb144b596034b3c99cbfcad?format=json HTTP/1.1" 200 46
DEBUG:swiftclient:REQ: curl -i https://10.0.0.59:8080/v1/AUTH_9b508c0ebfb144b596034b3c99cbfcad?format=json -X GET -H "X-Auth-Token: 3161ab12fd4545888e0c42365480e310"
DEBUG:swiftclient:RESP STATUS: 200 OK
DEBUG:swiftclient:RESP HEADERS: [('content-length', '46'), ('accept-ranges', 'bytes'), ('server', 'Apache/2.4.7 (Ubuntu)'), ('x-timestamp', '1406848229.54726'), ('x-trans-id', 'tx50a3a1d09ae145958a6bb-0053dc1cc9'), ('date', 'Fri, 01 Aug 2014 23:03:38 GMT'), ('x-account-bytes-used', '182'), ('x-account-container-count', '1'), ('content-type', 'application/json; charset=utf-8'), ('x-account-object-count', '1')]
DEBUG:swiftclient:RESP BODY: [{"count": 1, "bytes": 182, "name": "myfile"}]
myfile
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): 10.0.0.59
DEBUG:urllib3.connectionpool:Setting read timeout to <object object at 0x7feea6bd2090>
DEBUG:urllib3.connectionpool:"GET /v1/AUTH_9b508c0ebfb144b596034b3c99cbfcad?format=json&marker=myfile HTTP/1.1" 200 2
DEBUG:swiftclient:REQ: curl -i https://10.0.0.59:8080/v1/AUTH_9b508c0ebfb144b596034b3c99cbfcad?format=json&marker=myfile -X GET -H "X-Auth-Token: 3161ab12fd4545888e0c42365480e310"
DEBUG:swiftclient:RESP STATUS: 200 OK
DEBUG:swiftclient:RESP HEADERS: [('content-length', '2'), ('accept-ranges', 'bytes'), ('server', 'Apache/2.4.7 (Ubuntu)'), ('x-timestamp', '1406848229.54726'), ('x-trans-id', 'txd1d511e7f45648338a4a8-0053dc1cca'), ('date', 'Fri, 01 Aug 2014 23:03:38 GMT'), ('x-account-bytes-used', '182'), ('x-account-container-count', '1'), ('content-type', 'application/json; charset=utf-8'), ('x-account-object-count', '1')]
DEBUG:swiftclient:RESP BODY: []
返回了当前列表。我不确定这两者是否相关,但似乎合理。
非常感谢任何帮助。