这是本人的一些学习笔记,如果有错误的地方或者更好的解决方法,欢迎提出!!
glance是openstack镜像服务,主要用来注册,登陆和检索虚拟机镜像
1.glance服务的安装
[root@openstack01 ~]# yum install -y openstack-glance
验证glance镜像服务是否正确安装
root@openstack01 ~]# cat /etc/passwd | grep glance
glance:x:161:161:OpenStack Glance Daemons:/var/lib/glance:/sbin/nologin
[root@openstack01 ~]# cat /etc/group | grep glance
glance:x:161:
2.修改glance镜像服务的配置文件
生成备份文件
[root@openstack01 ~]# cp /etc/glance/glance-api.conf /etc/glance/glance-api.conf.bak
去除空行注释,生成新的配置文件,方便修改
[root@openstack01 ~]# grep -Ev '^$|#' /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
打开去除空行注释的配置文件进行修改
[root@openstack01 ~]# cd /etc/glance/
[root@openstack01 glance]# vi glance-api.conf
[root@openstack01 glance]# cat glance-api.conf
[DEFAULT]
[cinder]
[cors]
[database]
connection=mysql+pymysql://glance:000000@openstack01/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
default_store=file
firesystem_store_datadir=/var/lib/glance/images/
[image_format]
[keystone_authtoken]
auth_url=http://openstack01:5000
memcached_servers=openstack01:11211
auth_type=passdword
username=glance
password=000000
user_domain_name=Default
project_domain_name=Default
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[paste_deploy]
flavor=keystone
[profiler]
[store_type_location_strategy]
[task]
[taskflow_executor]
[root@openstack01 glance]#
3.创建glance服务的数据库并授权
MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> use glance;
Database changed
MariaDB [glance]> grant all privileges on glance.* to 'glance'@'localhost' identified by '000000';
Query OK, 0 rows affected (0.002 sec)
MariaDB [glance]> grant all privileges on glance.* to 'glance'@'%' identified by '000000';
Query OK, 0 rows affected (0.001 sec)
4.初始化数据库
[root@openstack01 ~]# su glance -s /bin/sh -c 'glance-manage db_sync'
进入数据库查看是否同步成功
5.glance组件初始化
导入环境变量
[root@openstack01 ~]# . admin-login
在openstack云计算平台中创建glance用户
[root@openstack01 ~]# openstack user create glance --password 000000 --domain default
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | fbe3efdf54ed4700a7df58550b575778 |
| name | glance |
| options | {} |
| password_expires_at | None |
为用户glance分配管理员角色
[root@openstack01 ~]# openstack role add admin --project project --user glance
创建glance服务
[root@openstack01 ~]# openstack service create --name glance image
+---------+----------------------------------+
| Field | Value |
+---------+----------------------------------+
| enabled | True |
| id | abb8518a68bb439b8920054555e45aec |
| name | glance |
| type | image |
+---------+----------------------------------+
创建glance对外服务端点
[root@openstack01 ~]# openstack endpoint create --region RegionOne glance public http://openstack01:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 437b1d2a113444b681dd5ecb6e26e063 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | abb8518a68bb439b8920054555e45aec |
| service_name | glance |
| service_type | image |
| url | http://openstack01:9292 |
+--------------+----------------------------------+
创建glance对内服务端点
[root@openstack01 ~]# openstack endpoint create --region RegionOne glance internal http://openstack01:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 8f946107e15c4500841243fd1be4291d |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | abb8518a68bb439b8920054555e45aec |
| service_name | glance |
| service_type | image |
| url | http://openstack01:9292 |
+--------------+----------------------------------+
创建glance对管理员访问的端点
[root@openstack01 ~]# openstack endpoint create --region RegionOne glance admin http://openstack01:9292
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | ab7d4fe966a94b3784d217d2fe92b275 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | abb8518a68bb439b8920054555e45aec |
| service_name | glance |
| service_type | image |
| url | http://openstack01:9292 |
+--------------+----------------------------------+
6.启动glance服务
[root@openstack01 ~]# systemctl start openstack-glance-api
[root@openstack01 ~]# systemctl enable openstack-glance-api
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
7.验证glance服务是否开启
[root@openstack01 glance]# ss -lntpu | grep 9292
tcp LISTEN 0 128 *:9292 *:* users:(("glance-api",pid=8837,fd=4),("glance-api",pid=8836,fd=4),("glance-api",pid=8835,fd=4),("glance-api",pid=8834,fd=4),("glance-api",pid=8822,fd=4))
至此,openstack的glance镜像服务配置完成
标签:--,api,openstack,OpenStack,glance,root,openstack01,store From: https://blog.csdn.net/m0_75109484/article/details/140747398