openstack(glance镜像服务搭建)

进入数据库
  mysql -u root -p
创建glance数据库
  MariaDB [(none)]> CREATE DATABASE glance;
给glance数据库设置权限
  MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO'glance'@'localhost' \

IDENTIFIED BY ‘GLANCE_DBPASS’;(本地)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO ‘glance’@’%’
IDENTIFIED BY ‘GLANCE_DBPASS’;(远程)
创建glance管理员用户user
#openstack user create --domain default --password-prompt glance

 User Password:
 Repeat User Password:
 +---------------------+----------------------------------+
  | Field               | Value                            |
 +---------------------+----------------------------------+
  | domain_id           | default                          |
  | enabled             | True                             |
  | id                  | 3f4e777c4062483ab8d9edd7dff829df |
  | name                | glance                           |
  | options             | {}                               |
  | password_expires_at | None                             |
 +---------------------+----------------------------------+

将管理员角色admin添加到glance用户和服务项目
  # openstack role add --project service --user glance admin
创建glance服务实体
  # openstack service create --name glance \

–description “OpenStack Image” image

±------------±---------------------------------+
| Field | Value |
±------------±---------------------------------+
| description | OpenStack Image |
| enabled | True |
| id | 8c2c7f1b9b5049ea9e63757b5533e6d2 |
| name | glance |
| type | image |
±------------±---------------------------------+

创建镜像服务API端点
# openstack endpoint create --region RegionOne
image public http://sheng0:9292
image internal http://sheng0:9292
image admin http://sheng0:9292 \

下载镜像glance服务

yum install openstack-glance

修改配置文件
cd /etc/glance/
cp glance-api.conf glance-api.conf.bak
cp glance-registry.conf glance-registry.conf.bak
vim glance-api.conf
vim glance-registry.conf
修改内容参考glance配置文件
导入表到glance数据库中
# su -s /bin/sh -c “glance-manage db_sync” glance
启动服务 设置开机自启
# systemctl enable openstack-glance-api.service
openstack-glance-registry.service
# systemctl start openstack-glance-api.service
openstack-glance-registry.service
上传镜像文件
openstack image create “cirros”
–file cirros-0.3.5-x86_64-disk.img
–disk-format qcow2 --container-format bare
–public
查看镜像文件
openstack image list

glance配置文件

glance配置文件:
vim /etc/glance/glance-api.conf
[DEFAULT]

[cors]

[cors.subdomain]

[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@sheng0/glance

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

[image_format]

[keystone_authtoken]
auth_uri = http://sheng0:5000
auth_url = http://sheng0:35357
memcached_servers = sheng0:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[matchmaker_redis]

[oslo_concurrency]

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[paste_deploy]
flavor = keystone

[profiler]
[store_type_location_strategy]

[task]

[taskflow_executor]

vim /etc/glance/glance-registry.conf
[DEFAULT]

[database]
connection = mysql+pymysql://glance:GLANCE_DBPASS@sheng0/glance

[keystone_authtoken]
auth_uri = http://sheng0:5000
auth_url = http://sheng0:35357
memcached_servers = sheng0:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[matchmaker_redis]

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_policy]

[paste_deploy]
flavor = keystone

[profiler]

猜你喜欢

转载自blog.csdn.net/weixin_44248438/article/details/89419551