openstack O版如何配置glance镜像服务

发布时间:2021-11-18 14:20:11 作者:柒染
来源:亿速云 阅读:145

openstack  O版如何配置glance镜像服务,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

1.创建glance数据库
[root@controller ~]# 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用户
[root@controller ~]# source /root/admin-openrc.sh
[root@controller ~]#openstack user create  --domain default glance  --password devopsopenstack  O版如何配置glance镜像服务

openstack role add --project service --user glance admin
[root@controller ~]#  openstack service create --name glance --description "OpenStack Image service" image
openstack  O版如何配置glance镜像服务
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack  O版如何配置glance镜像服务
openstack endpoint create --region RegionOne image admin http://controller:9292
openstack  O版如何配置glance镜像服务
[root@controller ~]# yum -y install openstack-glance           35个包
3.修改/etc/glance/glance-api.conf 配置文件
[root@controller ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
[root@controller ~]# >/etc/glance/glance-api.conf
[root@controller ~]# cat /etc/glance/glance-api.conf
[DEFAULT]
transport_url = rabbit://openstack:devops@controller
[database]
connection = mysql+pymysql://glance:devops@controller/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/
[root@controller ~]# cat /etc/glance/glance-api.conf | grep -v "^#" | grep -v "^$"
openstack  O版如何配置glance镜像服务

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

[root@controller ~]# cat /etc/glance/glance-registry.conf
[DEFAULT]
transport_url = rabbit://openstack:devops@controller
[database]
connection = mysql+pymysql://glance:devops@controller/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
[root@controller ~]# cat /etc/glance/glance-registry.conf | grep -v "^#" | grep -v "^$"
openstack  O版如何配置glance镜像服务
5.创建数据库表,同步数据库
[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
6.启动glance服务
[root@controller ~]#systemctl enable openstack-glance-api.service openstack-glance-registry.service
[root@controller ~]# systemctl start openstack-glance-api.service
[root@controller ~]# systemctl start openstack-glance-registry.service
[root@controller ~]# netstat -anpult | grep 9191    #registry
tcp        0      0 0.0.0.0:9191            0.0.0.0:               LISTEN      31349/python2
[root@controller ~]# netstat -anpult | grep 9292   #api
tcp        0      0 0.0.0.0:9292            0.0.0.0:
              LISTEN      31413/python2      
7.下载镜像并上传到glance
[root@controller ~]# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img  
[root@controller ~]# openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
openstack  O版如何配置glance镜像服务
8.测试是否上传成功
[root@controller ~]# glance image-list
+--------------------------------------+--------+
| ID                                   | Name   |
+--------------------------------------+--------+
| cdd53a8d-3bcd-43f4-a8eb-388f1eebc6b5 | cirros |
+--------------------------------------+--------+
9.镜像存放位置
[root@controller ~]# ll /var/lib/glance/images/
total 12960
-rw-r-----. 1 glance glance 13267968 May  5 08:25 cdd53a8d-3bcd-43f4-a8eb-388f1eebc6b5

关于openstack  O版如何配置glance镜像服务问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

推荐阅读:
  1. OpenStack stein安装(三)glance
  2. Openstack Mitaka安装镜像服务步骤

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

openstack glance

上一篇:怎样进行Docker 镜像管理的分析

下一篇:如何使用PowerShell命令批量初始化OneDrive for Business

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》