随笔 - 120  文章 - 0  评论 - 35  阅读 - 85万

照着官网来安装openstack pike之glance安装

镜像服务image service(glance)的安装还是在控制节点上进行:

1、前提条件,数据库为glance创建库和账户密码来连接数据库
1
2
3
4
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE glance;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'IDENTIFIED BY 'glance';

 2、在为glance在keystone上创建用户项目等时,需要先连接keystone,这里使用keystone的admin账号来登录

1
# source  admin-openrc

 然后在创建glance用户:

1
# openstack user create --domain default --password-prompt glance

 输入密码:glance

将admin角色添加到glance用户和service项目中:
1
# openstack role add --project service --user glance admin

 为glance创建服务实体:

1
# openstack service create --name glance --description "OpenStack Image" image

 

为镜像服务创建API endpoints:
1
2
3
# openstack endpoint create --region RegionOne image public http://192.168.101.10:9292
# openstack endpoint create --region RegionOne image internal http://192.168.101.10:9292
# openstack endpoint create --region RegionOne image admin http://192.168.101.10:9292

 安装和配置glance:

1
# yum install openstack-glance

 修改配置文件:/etc/glance/glance-api.conf,在[database]部分:

1
connection = mysql+pymysql://glance:glance@192.168.101.10/glance

 在[keystone_authtoken]和[paste_deploy]分别做如下设置:

1
2
3
4
5
6
7
8
9
10
11
12
13
[keystone_authtoken]
auth_uri = http://192.168.101.10:5000
auth_url = http://192.168.101.10:35357
memcached_servers = 192.168.101.10:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
 
[paste_deploy]
flavor = keystone

 在[glance_store]部分设置一个本地文件系统用来存储本地镜像:

1
2
3
4
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

 修改配置文件:/etc/glance/glance-registry.conf,在[database]配置数据库的连接:

1
connection = mysql+pymysql://glance:glance@192.168.101.10/glance

 在[keystone_authtoken]和[paste_deploy]配置如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
[keystone_authtoken]
auth_uri = http://192.168.101.10:5000
auth_url = http://192.168.101.10:35357
memcached_servers = 192.168.101.10:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance
 
[paste_deploy]
flavor = keystone

 向glance库导入填充数据:

1
# su -s /bin/sh -c "glance-manage db_sync" glance

   Ignore any deprecation messages in this output.

验证glance是否有table?
最后开启glance服务:
1
2
# systemctl enable openstack-glance-api.service openstack-glance-registry.service
# systemctl start openstack-glance-api.service openstack-glance-registry.service

 校验glance:校验image service是否安装成功?

1
2
3
# source admin-openrc
# wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
# openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public

 上传镜像到镜像服务上,使用格式qcow2磁盘格式,权限为public,所有的项目都能访问它

1
# openstack image list    查看镜像列表

 

至此glance的image service组件安装成功

 

贴出glance两个配置文件的配置:

1、/etc/glance/glance-api.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[root@node1 ~]# egrep -v "^$|^#" /etc/glance/glance-api.conf
[DEFAULT]
[cors]
[database]
connection = mysql+pymysql://glance:glance@192.168.101.10/glance
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[image_format]
[keystone_authtoken]
auth_uri = http://192.168.101.10:5000
auth_url = http://192.168.101.10:35357
memcached_servers = 192.168.101.10: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]

 2、配置文件/etc/glance/glance-registry.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@node1 ~]# egrep -v "^$|^#" /etc/glance/glance-registry.conf
[DEFAULT]
[database]
connection = mysql+pymysql://glance:glance@192.168.101.10/glance
[keystone_authtoken]
auth_uri = http://192.168.101.10:5000
auth_url = http://192.168.101.10:35357
memcached_servers = 192.168.101.10: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]

 

posted on   wadeson  阅读(816)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示