ConnectionError:[Errno 111] 连接被拒绝(通过 Puppet 安装 Openstack)

ConnectionError:[Errno 111] 连接被拒绝(通过 Puppet 安装 Openstack)

我刚刚通过 puppet 完成了 Openstack 的安装,经过一些步骤后,我终于可以尝试登录仪表板了。当我这样做时,我看到了“出现错误”页面(发生了意外错误。请尝试刷新页面。如果没有帮助,请联系您当地的管理员。)

我通过 Puppet 安装时遇到的错误包括未创建 horizo​​n 用户、未创建 horizo​​ns.log、allowed_hosts 限制过多以及 /usr/share/openstack_dashboard/openstack_dashboard/local 中的 local_settings.py。目前我已经修复了所有这些问题。

没有任何内容被记录到 apache 日志文件中,但是,这是记录到 horizo​​n.log 中的内容:

    ConnectionError: [Errno 111] Connection refused
    2014-04-17 23:10:37,795 1958 DEBUG openstack_dashboard.api.nova novaclient connection created using token "0c27d608ca94bab56bf6614ddb714286" and url "http://x.x.x.x:8774/v2/64d62e9095bc4e0f81ef9a49e68d2aaa"

    2014-04-17 23:10:37,799 1958 ERROR django.request Internal Server Error: /horizon/admin/
    Traceback (most recent call last):
         File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in      get_response
        response = callback(request, *callback_args, **callback_kwargs)
      File "/usr/lib/python2.7/dist-packages/horizon/decorators.py", line 38, in dec
     return view_func(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/horizon/decorators.py", line 86, in dec
         return view_func(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/horizon/decorators.py", line 54, in dec
         return view_func(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/horizon/decorators.py", line 38, in dec
         return view_func(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/horizon/decorators.py", line 86, in dec
         return view_func(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 48, in view
         return self.dispatch(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in      dispatch
         return handler(request, *args, **kwargs)
       File "/usr/lib/python2.7/dist-packages/horizon/tables/views.py", line 155, in get
         handled = self.construct_tables()
       File "/usr/lib/python2.7/dist-packages/horizon/tables/views.py", line 146, in construct_tables
         handled = self.handle_table(table)
       File "/usr/lib/python2.7/dist-packages/horizon/tables/views.py", line 118, in          handle_table
         data = self._get_data_dict()
       File "/usr/lib/python2.7/dist-packages/horizon/tables/views.py", line 182, in _get_data_dict
         self._data = {self.table_class._meta.name: self.get_data()}
       File "/usr/share/openstack-         dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/overview/views.py", line 41, in get_data
         data = super(GlobalOverview, self).get_data()
       File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/views.py", line 33, in get_data
        self.usage.summarize(*self.usage.get_date_range())
       File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py", line 98, in summarize
         _('Unable to retrieve usage information.'))
       File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py", line 95, in summarize
         self.usage_list = self.get_usage_list(start, end)
      File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py", line 130, in get_usage_list
         return api.nova.usage_list(self.request, start, end)
       File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/api/nova.py", line 474, in usage_list
         novaclient(request).usage.list(start, end, True)]
       File "/usr/lib/python2.7/dist-packages/novaclient/v1_1/usage.py", line 35, in list
         "tenant_usages")
       File "/usr/lib/python2.7/dist-packages/novaclient/base.py", line 62, in _list
         _resp, body = self.api.client.get(url)
       File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 230, in get
         return self._cs_request(url, 'GET', **kwargs)
       File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 217, in _cs_request
         **kwargs)
       File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 199, in _time_request
         resp, body = self.request(url, method, **kwargs)
       File "/usr/lib/python2.7/dist-packages/novaclient/client.py", line 170, in request
         **kwargs)
       File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
         return session.request(method=method, url=url, **kwargs)
       File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 279, in request
         resp = self.send(prep, stream=stream, timeout=timeout, verify=verify,          cert=cert, proxies=proxies)
       File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 374, in send
         r = adapter.send(request, **kwargs)
       File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 206, in send
         raise ConnectionError(sockerr)
     ConnectionError: [Errno 111] Connection refused

我正在尝试直接连接到 keystone,不确定我是否做对了,但这是我收到的错误,我 99.99%确定登录名/密码组合是正确的。

ubuntu@pawn2:~$ keystone --os-username=admin --os-auth-url=http://localhost:35357/v2.0       user-list
 OS Password:
Unable to authorize user

我还找到了这个页面,我使用不需要任何身份验证的命令得到了结果,这让我相信该服务确实正在运行。例如,运行 curlhttp://xxxx:35357给我一些有用的回报。在端口 8774 上使用 curl 也会返回一些信息。

http://docs.openstack.org/developer/keystone/api_curl_examples.html

如果我可以假设服务正在运行,但无法获得授权,则我的密码错误或其他原因阻止我登录。但如果密码错误,我会不会得到错误的登录名/密码组合?此外,密码是通过 puppet 设置的,我仍然可以查看原始文件,而且我的打字技能还不错。我也觉得我已经用尽了我的谷歌技能,没有找到任何有用的东西(我认为)。

我真的不知道从这里去哪里,任何帮助都将不胜感激!

(尽管在我看来主要是 openstack,但我还是用 puppet 标记了这篇文章,以防它以某种方式导致了我的问题)

编辑1:

我设法缩小了问题的范围,看起来概览表不是在 Puppet 安装期间创建的。我在生成的报告中没有看到任何与此相关的内容,但无论如何,这是消息

错误 [glance.registry.db.api] 无法确保数据库连接和一致性。通过运行“glance-manage db_sync”确保数据库配置和权限正确,并且自上次升级以来数据库已迁移

错误 [glance.registry.db.api] (ProgrammingError) (1146,“表‘glance.images’不存在”)‘SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.status AS images_status, images.is_public AS images_is_public, images.location AS images_location, images.checksum AS images_checksum, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected \nFROM images \n LIMIT %s'(1,)

我使用glance-manage db_sync来解决这个问题,但我仍然收到这个错误消息,并且没有任何内容显示在apache或horizo​​n日志中,但这在glance/registry.log中

2014-04-18 14:45:10 727 错误 [glance.registry.db.api] 无法确保数据库连接和一致性。通过运行“glance-manage db_sync”确保数据库配置和权限正确,并且自上次升级以来数据库已迁移

所以我进入并(重新)设置了正确的数据库权限,当我尝试访问仪表板时仍然出现相同的错误,只是现在我甚至没有机会登录。apache/horizo​​n/glance/keystone 日志中没有任何内容。

我刚刚注意到我的系统时间不对,我要解决这个问题,然后继续我的旅程。

編輯2

时间确定了。

nova-api 正在将其连续输出到其 nova.-api.log 文件中。

ERROR nova.service [-] Unhandled exception
TRACE nova.service Traceback (most recent call last):
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 307, in _start_child
TRACE nova.service     self._child_process(wrap.server)
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 284, in _child_process
4321 TRACE nova.service     launcher.run_server(server)
4321 TRACE nova.service   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 148, in run_server
4321 TRACE nova.service     server.wait()
4321 TRACE nova.service   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 666, in wait
4321 TRACE nova.service     self.server.wait()
4321 TRACE nova.service   File "/usr/lib/python2.7/dist-packages/nova/wsgi.py", line 23, in wait
TRACE nova.service     self._server.wait()
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 166, in wait
TRACE nova.service     return self._exit_event.wait()
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
TRACE nova.service     return hubs.get_hub().switch()
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 177, in switch
4321 TRACE nova.service     return self.greenlet.switch()
TRACE nova.service   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 192, in main
TRACE nova.service     result = function(*args, **kwargs)
TRACE nova.service TypeError: server() got an unexpected keyword argument 'url_length_limit'
TRACE nova.service

编辑3

结果是 nova 数据库中没有任何内容,重新创建了它并将继续沿着这条线索进行搜索。

编辑4

当我运行 nova-manage db sync 时,nova 数据库中的表没有被创建,也没有错误消息。试图弄清楚这一点...

最终编辑

我已经偏离了这个问题的轨道,所以我要在这里停下来。

对于我遇到的最后一个问题,我没有解决它,但我尝试从(几乎)相同的安装中复制表并将其导入空的 nova 数据库,但没有任何变化。我就到此为止了,感谢您的阅读!

答案1

最终编辑

不确定上次我做了什么让它工作,但真正导致我不幸的原因是忽略了这个步骤,

http://docs.openstack.org/havana/install-guide/install/apt/content/basics-packages.html

它将指导您完成安装 havana ubuntu 云存档的过程。

谢谢阅读!

旧帖从这里开始

我设法解决了这个问题。

在 keystone 数据库中,端点表更具体地说,在“url”字段中混合了 localhoist/和基于 ip 地址的条目,它们看起来像 xxxx:9292、xxxx:8776/v1/%(tenant_id)s 等等。我在所有情况下都用 localhost 替换了 ip 地址,使其统一,现在我可以从机器本身登录到仪表板。我无法从 localhost 以外的其他位置登录,但我认为这是一个单独的问题,因为我尝试用其他条目替换 localhost(例如公共 ip 地址,我仍然可以通过仪表板从 localhost 登录)。

总而言之,虽然我可能误解了发生的事情,但我认为端点 URL 字段不一致是导致初始连接被拒绝问题的原因。我相信写为 localhost 的特定端点导致了问题,不幸的是我当时没有记下哪个是哪个。

编辑:我尝试使用 chrome 在隐身窗口中从浏览器访问仪表板,我可以毫无问题地登录,我尝试了 Internet Explorer,它运行良好。但即使从 chrome 中清除了所有历史记录/缓存/等,我仍然收到错误。不知道为什么,但至少我缩小了一点范围,而且它有点管用!

相关内容