创建openstack镜像的时候报错。HTTP 500 Internal Server Error: The server has either erred or is incapable of performing the requested operation
查看 cat /var/log/glance/api.log日志显示如下。
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi six.reraise(type(de_ref), de_ref)
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi File "<string>", line 3, in reraise
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi DBConnectionError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'controller' ([Errno 111] ECONNREFUSED)") (Background on this error at: http://sqlalche.me/e/e3q8)
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi
2022-02-13 11:18:53.204 5691 INFO eventlet.wsgi.server [req-2e8e6857-0668-4897-93ea-575cf7e17411 d2ba72d0f04a46b19901e84c6700f0ce 7e7143f292c34f1789773405af525239 - default default] 10.10.10.10 - - [13/Feb/2022 11:18:53] "POST /v2/images HTTP/1.1" 500 454 100.407488
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi six.reraise(type(de_ref), de_ref)
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi File "<string>", line 3, in reraise
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi DBConnectionError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'controller' ([Errno 111] ECONNREFUSED)") (Background on this error at: http://sqlalche.me/e/e3q8)
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi
2022-02-13 11:18:53.204 5691 INFO eventlet.wsgi.server [req-2e8e6857-0668-4897-93ea-575cf7e17411 d2ba72d0f04a46b19901e84c6700f0ce 7e7143f292c34f1789773405af525239 - default default] 10.10.10.10 - - [13/Feb/2022 11:18:53] "POST /v2/images HTTP/1.1" 500 454 100.407488
尝试过
(1)重新配置glance-api.conf 和glance-registry.conf文件,
(2)同步数据库 su -s /bin/sh -c "glance-manage db_sync" glance
(3)用root用户更新权限,flush priviledegs
(4)配置cat /etc/httpd/conf.d/wsgi-keystone.conf文件,监听35357和5000端口
(5)重启环境变量admin.sh admin-openrc等
还有其他一些尝试,都不行。
最后我在错误日志里看到主机名和ip,我想会不会是因为公私网的ip顺序不对。
2003, "Can't connect to MySQL server on 'controller' ([Errno 111] ECONNREFUSED)") (Background on this error at: http://sqlalche.me/e/e3q8)
2022-02-13 11:18:53.201 5691 ERROR glance.common.wsgi
2022-02-13 11:18:53.204 5691 INFO eventlet.wsgi.server [req-2e8e6857-0668-4897-93ea-575cf7e17411 d2ba72d0f04a46b19901e84c6700f0ce 7e7143f292c34f1789773405af525239 - default default] 10.10.10.10
我打开/etc/hosts文件
是这样的
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.10 controller
10.10.10.12 compute
192.168.100.101 controller
192.168.100.102 compute
我把顺序调整一下之后。
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.101 controller
192.168.100.102 compute
10.10.10.10 controller
10.10.10.12 compute
运行
openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
成功文章来源:https://www.toymoban.com/news/detail-784881.html
[root@controller ~]# openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --publi
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2022-02-13T03:21:34Z |
| disk_format | qcow2 |
| file | /v2/images/79e12274-4a04-4749-8439-88ee368d64a6/file |
| id | 79e12274-4a04-4749-8439-88ee368d64a6 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | 7e7143f292c34f1789773405af525239 |
| properties | os_hash_algo='sha512', os_hash_value='1b03ca1bc3fafe448b90583c12f367949f8b0e665685979d95b004e48574b953316799e23240f4f739d1b5eb4c4ca24d38fdc6f4f9d8247a2bc64db25d6bbdb2', os_hidden='False' |
| protected | False |
| schema | /v2/schemas/image |
| size | 13287936 |
| status | active |
| tags | |
| updated_at | 2022-02-13T03:21:35Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
文章来源地址https://www.toymoban.com/news/detail-784881.html
到了这里,关于HTTP 500 Internal Server Error: 错误的解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!