openstack O版 配置glance镜像服务

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack O版 配置glance镜像服务相关的知识,希望对你有一定的参考价值。

1.创建glance数据库
[[email protected] ~]# mysql -uroot -pdevops
MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance. TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘devops‘;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.
TO ‘glance‘@‘%‘ IDENTIFIED BY ‘devops‘;
2.创建关于glance的 keystone用户
[[email protected] ~]# source /root/admin-openrc.sh
[[email protected] ~]#openstack user create --domain default glance --password devops技术图片

openstack role add --project service --user glance admin
[[email protected] ~]# openstack service create --name glance --description "OpenStack Image service" image
技术图片
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
技术图片
openstack endpoint create --region RegionOne image admin http://controller:9292
技术图片
[[email protected] ~]# yum -y install openstack-glance 35个包
3.修改/etc/glance/glance-api.conf 配置文件
[[email protected] ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
[[email protected] ~]# >/etc/glance/glance-api.conf
[[email protected] ~]# cat /etc/glance/glance-api.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
[database]
connection = mysql+pymysql://glance:[email protected]/glance
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
username = glance
password = devops
project_name = service
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[[email protected] ~]# cat /etc/glance/glance-api.conf | grep -v "^#" | grep -v "^$"
技术图片

4.修改/etc/glance/glance-registory.conf配置文件
[[email protected] ~]# cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.bak
[[email protected] ~]# >/etc/glance/glance-registry.conf

[[email protected] ~]# cat /etc/glance/glance-registry.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
[database]
connection = mysql+pymysql://glance:[email protected]/glance
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = devops
[paste_deploy]
flavor = keystone
[[email protected] ~]# cat /etc/glance/glance-registry.conf | grep -v "^#" | grep -v "^$"
技术图片
5.创建数据库表,同步数据库
[[email protected] ~]# su -s /bin/sh -c "glance-manage db_sync" glance
6.启动glance服务
[[email protected] ~]#systemctl enable openstack-glance-api.service openstack-glance-registry.service
[[email protected] ~]# systemctl start openstack-glance-api.service
[[email protected] ~]# systemctl start openstack-glance-registry.service
[[email protected] ~]# netstat -anpult | grep 9191 #registry
tcp 0 0 0.0.0.0:9191 0.0.0.0: LISTEN 31349/python2
[[email protected] ~]# netstat -anpult | grep 9292 #api
tcp 0 0 0.0.0.0:9292 0.0.0.0:
LISTEN 31413/python2
7.下载镜像并上传到glance
[[email protected] ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
[[email protected] ~]# openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
技术图片
8.测试是否上传成功
[[email protected] ~]# glance image-list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| cdd53a8d-3bcd-43f4-a8eb-388f1eebc6b5 | cirros |
+--------------------------------------+--------+
9.镜像存放位置
[[email protected] ~]# ll /var/lib/glance/images/
total 12960
-rw-r-----. 1 glance glance 13267968 May 5 08:25 cdd53a8d-3bcd-43f4-a8eb-388f1eebc6b5

所有的配置文件在百度云盘中:
链接:https://pan.baidu.com/s/1CnmKkFMTemv199ctgb5Oig
提取码:27om
复制这段内容后打开百度网盘手机App,操作更方便哦

以上是关于openstack O版 配置glance镜像服务的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack 运维 - 部署Glance组件 [T版]

OpenStack 运维 - 部署Glance组件 [Tarin版]

浅谈OpenStack T版服务组件--Glance镜像服务(#^.^#)

OpenStack---M版---双节点搭建---Glance安装和配置

N版openstack——镜像服务glance

OpenStack Train版-3.安装glance镜像服务