The glance service reports an error HTTPInternalServerError (HTTP 500)

Problem report:

Glance generates an HTTPInternalServerError (HTTP 500) error when uploading an image file.
This error occurred when uploading the image file

Analyze the cause && solve the problem:

The glance service needs to control the database and synchronize the database before uploading the image file. At the same time, in order to perform mirroring services, you need to edit the configuration file.

1. Configure the database

  1. Create database
mysql -u root -popenstack
create database glance;
  1. Create glance user
grant all privileges on glance.* to 'glance'@'localhost' identified by 'openstack';
grant all privileges on glance.* to 'glance'@'%' identified by 'openstack';

Two, configure the mirroring service

  1. Edit the /etc/glance/glance-registry.conf configuration file and add the following content under [DEFAULT]:
rabbit_host=localhost 
rabbit_port=5672
rabbit_use_ssl=false
rabbit_userid=guest
rabbit_password=guest
rabbit_virtual_host=/
rabbit_notification_exchange=glance
rabbit_notification_topic=notifications
rabbit_durable_queues=false`
  1. Restart glance-registry and glance-api services
sudo restart glance-registry
sudo restart glance-api
  1. Synchronize the database, and do not allow the glance service to control the database version
sudo glance-manage db_sync
sudo glance-manage db_version_control 0
  1. If the following error occurs during the execution, edit the /etc/mysql/my.cnf configuration file and add the following content to the [mysqld] field

glance ValueError: Tables “migrate_version” have non utf8 collation,
please make sure all tables are CHARSET=utf8

collation-server = utf8_general_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Then log in to glance database and use the following statement to change the charset attribute of the table

alter table migrate_version convert to character set 'utf8';
  1. Attention please! !
    If the above error occurs, you need to perform the third step again after the fourth step. In this way, after synchronizing the database, the (HTTP500) problem that occurs when uploading mirror files can be solved.

Guess you like

Origin blog.csdn.net/weixin_43824348/article/details/109206924