在VMware Workstation 14 Pro,安装如下配置虚拟机,然后在虚拟式搭建OpenStack Stein版本
主机名 | IP | 配置 | 节点名称 |
---|---|---|---|
controller | 10.0.0.11 | 1vcpu 2GB内存 50GB磁盘 | 控制节点 |
compute | 10.0.0.12 | 1vcpu 2GB内存 50GB磁盘 | 计算节点 |
当我已经安装好控制节点和计算节点的nova后,在控制节点上添加计算节点时出现该错误如下:
[root@controller ~]# openstack compute service list --service nova-compute
Unable to establish connection to http://controller:8774/v2.1/os-services?binary=nova-compute: HTTPConnectionPool(host='controller', port=8774): Max retries exceeded with url: /v2.1/os-services?binary=nova-compute (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused' ,))
通过su - nova -s /bin/bash
和nova-api --config-file /etc/nova/nova.conf
来查看错误,操作如下:
[root@controller ~]# su - nova -s /bin/bash # 切换身份
login: Fri Sep 27 10:05:14 CST 2019 on pts/0
-bash-4.2$ nova-api --config-file /etc/nova/nova.conf #测试nova-api
2019-09-27 10:31:46.532 70191 WARNING nova.service [-] Running nova-osapi_compute using eventlet is deprecated. Deploy with a WSGI server such as uwsgi or mod_wsgi.
/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py:22: PkgResourcesDeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
return pkg_resources.EntryPoint.parse("x=" + s).load(False)
2019-09-27 10:31:48.913 70191 WARNING oslo_config.cfg [-] Deprecated: Option "use_neutron" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2019-09-27 10:31:50.584 70191 WARNING keystonemiddleware.auth_token [-] AuthToken middleware is set with keystone_authtoken.service_token_roles_required set to False. This is backwards compatible but deprecated behaviour. Please set this to True.
2019-09-27 10:31:50.603 70191 WARNING keystonemiddleware.auth_token [-] Configuring www_authenticate_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint
2019-09-27 10:31:51.109 70191 WARNING keystonemiddleware.auth_token [-] AuthToken middleware is set with keystone_authtoken.service_token_roles_required set to False. This is backwards compatible but deprecated behaviour. Please set is to True.
2019-09-27 10:31:51.113 70191 WARNING keystonemiddleware.auth_token [-] Configuring www_authenticate_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint
2019-09-27 10:31:51.176 70191 INFO nova.wsgi [-] osapi_compute listening on 0.0.0.0:8774
2019-09-27 10:31:51.178 70191 INFO oslo_service.service [-] Starting 1 workers
2019-09-27 10:31:51.182 70191 WARNING nova.service [-] Running nova-metadata using eventlet is deprecated. Deploy with a WSGI server such as uwsgi or mod_wsgi.
2019-09-27 10:31:51.323 70191 INFO nova.wsgi [-] metadata listening on 0.0.0.0:8775
2019-09-27 10:31:51.325 70191 INFO oslo_service.service [-] Starting 1 workers
2019-09-27 10:31:51.366 70191 WARNING oslo_config.cfg [-] Deprecated: Option "firewall_driver" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2019-09-27 10:31:52.598 70239 INFO nova.metadata.wsgi.server [req-f276ad52-d446-408a-9de9-3169a87e0d80 - - - - -] (70239) wsgi starting up on http://0.0.0.0:8775
2019-09-27 10:31:52.773 70238 INFO nova.osapi_compute.wsgi.server [req-60836c58-fd81-4a64-b53f-4a2d7b347082 - - - - -] (70238) wsgi starting up on http://0.0.0.0:8774
2019-09-27 10:31:55.685 70191 INFO oslo_service.service [-] Child 70239 killed by signal 9
2019-09-27 10:31:55.725 70191 CRITICAL nova [-] Unhandled error: OSError: [Errno 12] Cannot allocate memory
2019-09-27 10:31:55.725 70191 ERROR nova Traceback (most recent call last):
2019-09-27 10:31:55.725 70191 ERROR nova File "/bin/nova-api", line 10, in <module>
2019-09-27 10:31:55.725 70191 ERROR nova sys.exit(main())
2019-09-27 10:31:55.725 70191 ERROR nova File "/usr/lib/python2.7/site-packages/nova/cmd/api.py", line 69, in main
2019-09-27 10:31:55.725 70191 ERROR nova launcher.wait()
2019-09-27 10:31:55.725 70191 ERROR nova File "/usr/lib/python2.7/site-packages/oslo_service/service.py", line 661, in wait
2019-09-27 10:31:55.725 70191 ERROR nova self._respawn_children()
2019-09-27 10:31:55.725 70191 ERROR nova File "/usr/lib/python2.7/site-packages/oslo_service/service.py", line 648, in _respawn_children
2019-09-27 10:31:55.725 70191 ERROR nova self._start_child(wrap)
2019-09-27 10:31:55.725 70191 ERROR nova File "/usr/lib/python2.7/site-packages/oslo_service/service.py", line 567, in _start_child
2019-09-27 10:31:55.725 70191 ERROR nova pid = os.fork()
2019-09-27 10:31:55.725 70191 ERROR nova OSError: [Errno 12] Cannot allocate memory # 不能分配内存,说明内存不足。
2019-09-27 10:31:55.725 70191 ERROR nova
-bash-4.2$ exit # 退出
[root@controller ~]# free -m
total used free shared buff/cache available
Mem: 1819 1664 69 9 85 16
Swap: 0 0 0
发现内存内存确实不多了。
关闭虚拟机后添加内存,然后开启虚拟机,查看看内存
[root@controller ~]# free -m
total used free shared buff/cache available
Mem: 3771 1892 1569 11 309 1606
Swap: 0 0 0
[root@controller ~]# su - nova -s /bin/bash
-bash-4.2$ nova-api --config-file /etc/nova/nova.conf
2019-09-27 11:00:27.503 11397 WARNING nova.service [-] Running nova-osapi_compute using eventlet is deprecated. Deploy with a WSGI server such as uwsgi or mod_wsgi.
/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py:22: PkgResourcesDeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
return pkg_resources.EntryPoint.parse("x=" + s).load(False)
2019-09-27 11:00:28.540 11397 WARNING oslo_config.cfg [-] Deprecated: Option "use_neutron" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2019-09-27 11:00:28.907 11397 WARNING keystonemiddleware.auth_token [-] AuthToken middleware is set with keystone_authtoken.service_token_roles_required set to False. This is backwards compatible but deprecated behaviour. Please set this to True.
2019-09-27 11:00:28.913 11397 WARNING keystonemiddleware.auth_token [-] Configuring www_authenticate_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint
2019-09-27 11:00:29.387 11397 WARNING keystonemiddleware.auth_token [-] AuthToken middleware is set with keystone_authtoken.service_token_roles_required set to False. This is backwards compatible but deprecated behaviour. Please set this to True.
2019-09-27 11:00:29.392 11397 WARNING keystonemiddleware.auth_token [-] Configuring www_authenticate_uri to point to the public identity endpoint is required; clients may not be able to authenticate against an admin endpoint
2019-09-27 11:00:29.437 11397 INFO nova.wsgi [-] osapi_compute listening on 0.0.0.0:8774
2019-09-27 11:00:29.438 11397 INFO oslo_service.service [-] Starting 2 workers
2019-09-27 11:00:29.450 11397 WARNING nova.service [-] Running nova-metadata using eventlet is deprecated. Deploy with a WSGI server such as uwsgi or mod_wsgi.
2019-09-27 11:00:29.734 11397 INFO nova.wsgi [-] metadata listening on 0.0.0.0:8775
2019-09-27 11:00:29.735 11397 INFO oslo_service.service [-] Starting 2 workers
2019-09-27 11:00:29.893 11397 WARNING oslo_config.cfg [-] Deprecated: Option "firewall_driver" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2019-09-27 11:00:30.847 11410 INFO nova.osapi_compute.wsgi.server [req-832b4ada-9a5e-44b3-a290-f3e4d2166a00 - - - - -] (11410) wsgi starting up on http://0.0.0.0:8774
2019-09-27 11:00:31.110 11411 INFO nova.osapi_compute.wsgi.server [req-41feee3d-0a8f-40f9-bb4f-7fe4801144aa - - - - -] (11411) wsgi starting up on http://0.0.0.0:8774
2019-09-27 11:00:31.140 11414 INFO nova.metadata.wsgi.server [req-52e38269-17d8-4558-9621-f349d7f52722 - - - - -] (11414) wsgi starting up on http://0.0.0.0:8775
2019-09-27 11:00:31.336 11413 INFO nova.metadata.wsgi.server [req-85f6acba-dd94-429b-a2f6-cf9e0ebd5b15 - - - - -] (11413) wsgi starting up on http://0.0.0.0:8775
没有报错了,说明刚刚内存问题已经解决。
[root@controller ~]# openstack compute service list --service nova-compute
+----+--------------+---------+------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+--------------+---------+------+---------+-------+----------------------------+
| 5 | nova-compute | compute | nova | enabled | up | 2019-09-27T03:06:48.000000 |
+----+--------------+---------+------+---------+-------+----------------------------+
已经获取了计算节点,问题已经解决啦