立即注册 登录
About云-梭伦科技 返回首页

pig2的个人空间 https://www.aboutyun.com/?61 [收藏] [复制] [分享] [RSS]

日志

openstack【juno】入门 【swift篇】二十五:验证安装(控制节点)

热度 1已有 2835 次阅读2015-2-26 18:07




问题导读
1.swift stat的作用是什么?
2.swift如何上传一个文件?
3.如何查看swift列表?






控制节点执行下面命令:
1.环境变量生效
  1. source demo-openrc.sh



2.显示服务状态

  1. swift stat


输出下面信息
  1.       Account: AUTH_bfb31e69f05b44cd89e1336c09042e2f
  2.      Containers: 0
  3.         Objects: 0
  4.           Bytes: 0
  5.    Content-Type: text/plain; charset=utf-8
  6.     X-Timestamp: 1424577028.33577
  7.      X-Trans-Id: tx0163866e80294069b81d3-0054e95204
  8. X-Put-Timestamp: 1424577028.33577


 


3.上传一个测试文件

这里创建了一个testSwift文件
  1. swift upload demo-container1 testSwift

 


4.列出容器

  1. swift list

 



5.下载文件

  1. swift download demo-container1 testSwift







遇到问题

执行命令:
  1. swift list



产生如下错误:
  1. Traceback (most recent call last):
  2.   File "/usr/bin/swift", line 10, in <module>
  3.     sys.exit(main())
  4.   File "/usr/lib/python2.7/dist-packages/swiftclient/shell.py", line 1287, in main
  5.     globals()['st_%s' % args[0]](parser, argv[1:], output)
  6.   File "/usr/lib/python2.7/dist-packages/swiftclient/shell.py", line 492, in st_stat
  7.     stat_result = swift.stat()
  8.   File "/usr/lib/python2.7/dist-packages/swiftclient/service.py", line 427, in stat
  9.     raise SwiftError('Account not found', exc=err)
  10. swiftclient.service.SwiftError: 'Account not found'



不能定位错误,使用--debug,如下命令
  1. swift --debug stat



输出下面信息
  1. DEBUG:keystoneclient.auth.identity.v2:Making authentication request to http://controller:5000/v2.0/tokens
  2. INFO:urllib3.connectionpool:Starting new HTTP connection (1): controller
  3. DEBUG:urllib3.connectionpool:Setting read timeout to None
  4. DEBUG:urllib3.connectionpool:"POST /v2.0/tokens HTTP/1.1" 200 2799
  5. DEBUG:iso8601.iso8601:Parsed 2015-02-20T05:52:16Z into {'tz_sign': None, 'second_fraction': None, 'hour': u'05', 'daydash': u'20', 'tz_hour': None, 'month': None, 'timezone': u'Z', 'second': u'16', 'tz_minute': None, 'year': u'2015', 'separator': u'T', 'monthdash': u'02', 'day': None, 'minute': u'52'} with default timezone <iso8601.iso8601.Utc object at 0x7f0ddb06ba10>
  6. DEBUG:iso8601.iso8601:Got u'2015' for 'year' with default None
  7. DEBUG:iso8601.iso8601:Got u'02' for 'monthdash' with default 1
  8. DEBUG:iso8601.iso8601:Got 2 for 'month' with default 2
  9. DEBUG:iso8601.iso8601:Got u'20' for 'daydash' with default 1
  10. DEBUG:iso8601.iso8601:Got 20 for 'day' with default 20
  11. DEBUG:iso8601.iso8601:Got u'05' for 'hour' with default None
  12. DEBUG:iso8601.iso8601:Got u'52' for 'minute' with default None
  13. DEBUG:iso8601.iso8601:Got u'16' for 'second' with default None
  14. INFO:urllib3.connectionpool:Starting new HTTP connection (1): controller
  15. DEBUG:urllib3.connectionpool:Setting read timeout to None
  16. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  17. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  18. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  19. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:16 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'txf9179cecb3f84d2d89515-0054e6bd80')]
  20. DEBUG:urllib3.connectionpool:Setting read timeout to None
  21. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  22. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  23. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  24. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:17 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx564066dbdf9c479a80317-0054e6bd81')]
  25. DEBUG:urllib3.connectionpool:Setting read timeout to None
  26. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  27. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  28. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  29. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:19 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx8026db12471043108f8aa-0054e6bd83')]
  30. DEBUG:urllib3.connectionpool:Setting read timeout to None
  31. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  32. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  33. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  34. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:23 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx672d65e6e5cc4bcb81a99-0054e6bd87')]
  35. DEBUG:urllib3.connectionpool:Setting read timeout to None
  36. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  37. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  38. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  39. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:31 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx3b40cb1889c7403494571-0054e6bd8f')]
  40. DEBUG:urllib3.connectionpool:Setting read timeout to None
  41. DEBUG:urllib3.connectionpool:"HEAD /v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f HTTP/1.1" 503 0
  42. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  43. INFO:swiftclient:RESP STATUS: 503 Internal Server Error
  44. INFO:swiftclient:RESP HEADERS: [('date', 'Fri, 20 Feb 2015 04:52:47 GMT'), ('content-length', '0'), ('content-type', 'text/html; charset=UTF-8'), ('x-trans-id', 'tx38758acf7fe74c5cb1597-0054e6bd9f')]
  45. ERROR:swiftclient:Account HEAD failed: http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f 503 Internal Server Error
  46. Traceback (most recent call last):
  47.   File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 1236, in _retry
  48.     rv = func(self.url, self.token, *args, **kwargs)
  49.   File "/usr/lib/python2.7/dist-packages/swiftclient/client.py", line 521, in head_account
  50.     http_response_content=body)
  51. ClientException: Account HEAD failed: http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f 503 Internal Server Error
  52. Traceback (most recent call last):
  53.   File "/usr/bin/swift", line 10, in <module>
  54.     sys.exit(main())
  55.   File "/usr/lib/python2.7/dist-packages/swiftclient/shell.py", line 1287, in main
  56.     globals()['st_%s' % args[0]](parser, argv[1:], output)
  57.   File "/usr/lib/python2.7/dist-packages/swiftclient/shell.py", line 492, in st_stat
  58.     stat_result = swift.stat()
  59.   File "/usr/lib/python2.7/dist-packages/swiftclient/service.py", line 427, in stat
  60.     raise SwiftError('Account not found', exc=err)
  61. swiftclient.service.SwiftError: 'Account not found'


下面错误是核心

  1. INFO:swiftclient:REQ: curl -i http://controller:8080/v1/AUTH_bfb31e69f05b44cd89e1336c09042e2f -I -H "X-Auth-Token: e0712594a90d47d398dc3e435648b0f6"
  2. INFO:swiftclient:RESP STATUS: 503 Internal Server Error

意思是:请求服务器资源,不能从服务器获取。
这里面有两方面错误:
要么是
问题可能性
1.账户错误
2.服务器错误
验证:
1.账户错误,创建了另外一个swift 代理节点,结果还是一样。
2.服务器错误
这个有两个节点object1和object2
因此object1和object2是关键。但是并不知道到底是哪里的错误。
因此采用谷歌、百度。
答案如下:
1.配置文件错误,即授权错误
auth_host, auth_port, 和 auth_protocol错误。
auth_host不能访问,本文是10.0.0.11,这个都是相互通信的,如果使用的是私有ip,可能产生问题。
本系列使用下面url来代替上面,使用的是controller
auth_uri = http://controller:5000/v2.0,所以不会这里的问题。

2.object节点发生改变, 下面三个包则需要重新复制到其他节点
account.ring.gz
container.ring.gz
object.ring.gz

上面方案是从百度谷歌得到,但是都没有起作用。
########################################
问题的原因:
由于这里使用的是虚拟机,object1配置完毕,对于object2直接使用的克隆的方式。

所以对object2做了如下核实措施:
1.mac地址重新生成
2.hostname在控制节点、object1和object2节点都必须包含如下内容:
  1. 10.0.0.51        object1
  2. 10.0.0.52        object2

3.配置文件管理ip,都必须替换成10.0.0.52.
再次执行swift stat,问题得到解决。

路过

雷人

握手

鲜花

鸡蛋

发表评论 评论 (2 个评论)

回复 cxt 2015-8-17 21:09
请问我和版主swift stat遇到了一模一样的问题,debug后出现的内容都一模一样,但是我没有克隆虚拟机,hosts也都配置了,请问这个问题怎么解决?
回复 pig2 2015-8-18 04:08
不了解你的环境,一个问题原因可能比较多

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条