HTTP 500 Internal Server Error: 错误的解决方法

43 篇文章 0 订阅
30 篇文章 1 订阅

 创建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

 成功


[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                                                                                                                                                                                     |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值