OpenStack T版-Glance组件部署

注意事项!!!

Openstack主要组件安装的顺序

  1. Keystone(apache)
  2. glance
  3. nova
  4. neutron

Controller节点配置

创建数据库和授权用户

创建数据库

[root@controller ~]# mysql -uroot -p000000
MariaDB [(none)]> CREATE DATABASE glance; 
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '000000'; 
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '000000'; 
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

 

创建用户服务和API的endpoint

创建用户服务

[root@controller ~]# openstack user create --domain default --password 000000 glance
#创建glance用户
[root@controller ~]# openstack role add --project service --user glance admin
#将glance用户添加到service项目中,并且针对这个项目拥有admin权限;
[root@controller ~]# openstack service create --name glance --description "OpenStack Image" image
#创建一个service服务,service名称为glance,类型为image;

创建API的endpoint

三种API端点代表三种服务:admin、internal、public

[root@controller ~]# openstack endpoint create --region RegionOne image public http://controller:9292
[root@controller ~]# openstack endpoint create --region RegionOne image internal http://controller:9292
[root@controller ~]# openstack endpoint create --region RegionOne image admin http://controller:9292

 

安装 openstack-glance 软件包

[root@controller ~]# yum -y install openstack-glance

 

修改Glance配置文件

修改glanceapi.conf

[root@controller ~]# cp -a /etc/glance/glance-api.conf{,.bak}
#在保留源文件属性的前提下进行批量复制
[root@controller ~]# grep -Ev '^$|#' /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
# 对glance-api.conf.bak反向过滤掉空格和注释项,覆盖到glance-api.conf
[root@controller ~]# vi /etc/glance/glance-api.conf
[DEFAULT]
[cinder]
[cors]
[database]
connection = mysql+pymysql://glance:000000@controller/glance

[file]
[glance.store.http.store]
[glance.store.rbd.store]
[glance.store.sheepdog.store]
[glance.store.swift.store]
[glance.store.vmware_datastore.store]
[glance_store]
stores = file,http                   #存储类型,file:文件,http:基于api调用的方式,把镜像放到其他存储上
default_store = file                 #默认存储方式
filesystem_store_datadir = /var/lib/glance/images/     #指定镜像存放的本地目录

[image_format]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000          #指定认证的keystone的URI
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service                  #glance用户针对service项目拥有admin权限
username = glance
password = 000000

[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor = keystone                     #指定提供认证的服务器为keystone

[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
:wq

修改glance-registry.conf

[root@controller ~]# cp -a /etc/glance/glance-registry.conf{,.bak}
[root@controller ~]# grep -Ev '^$|#' /etc/glance/glance-registry.conf.bak > /etc/glance/glance-registry.conf
[root@controller ~]# vi /etc/glance/glance-registry.conf
[DEFAULT]
[database]
connection = mysql+pymysql://glance:000000@controller/glance

[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = 000000

[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_policy]
[paste_deploy]
flavor = keystone

[profiler]
:wq

 

初始化glance数据库

生成相关表结构;(不管有多少个controler,只需要初始化一次即可)

[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance

 

开启服务

[root@controller ~]# systemctl enable openstack-glance-api.service
[root@controller ~]# systemctl start openstack-glance-api.service
[root@controller ~]# netstat -natp | grep 9292

 

赋予服务对存储设备的可写权限

[root@controller ~]# chown -hR glance:glance /var/lib/glance/

 

镜像导入

导入一个cirros镜像做验证测试,没有此镜像的点击此链接获取百度云盘 提取码:46mb

[root@controller ~]# openstack image create --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public cirros

查看Openstack现有镜像

方法1:
[root@controller ~]# openstack image lis
方法2:
[root@controller ~]# glance image-list

 

 

作者: 红烧悠鸽
本文采用 CC BY-NC-SA 4.0 协议
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇