当前位置: 首页>后端>正文

Alma Linux 8 OpenStack入门4--Glance镜像服务构建

服务构建

1.已部署组件

主机名 角色 OS installed组件
controller 控制节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux,mariadb,rabbitmq,memcached,etcd,openstack-keystone,openstack-dashboard,openstack-placement-api,openstack-nova-api,openstack-nova-conductor,openstack-nova-novncproxy,openstack-nova-scheduler,openstack-cinder
compute 计算节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux,openstack-nova-compute,openstack-neutron-linuxbridge,ebtables,ipset
computehci 存储节点 Alma Linux 8.6 chrony,Yoga YUM Repository,enable powertools,python3-openstackclient,openstack-selinux,openstack-cinder,targetcli

2.新部署组件

主机名 角色 OS install组件
controller 控制节点 Alma Linux 8.6
compute 计算节点 Alma Linux 8.6
computehci 存储节点 Alma Linux 8.6

3.安装并配置Glance

操作对象:控制节点

操作内容:

#创建glance数据库及用户
#mysql -u root -p
> CREATE DATABASE glance;
> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'root';
> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'root';
> flush privileges;

#创建glance服务凭证

##在default域创建用户glance
# source admin-openrc
# openstack user create --domain default --password-prompt glance

##绑定用户glance为admin角色
# openstack role add --project service --user glance admin

##创建glance服务实体
# openstack service create --name glance --description "openstack Image" image

#创建glance服务端点
# 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

#安装glance组件
# yum install openstack-glance

#修改glance配置文件glance-api.conf
# vi /etc/glance/glance-api.conf
# grep -Ev "^$|^#" /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:root@controller/glance
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[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 = 123456
[paste_deploy]
flavor = keystone
...

#填充glance数据库
# su -s /bin/sh -c "glance-manage db_sync" glance

#启动服务或重启动服务并设置自启动
# systemctl enable openstack-glance-api.service
# systemctl start openstack-glance-api.service
# systemctl status openstack-glance-api.service

4.验证Glance服务

操作对象:控制节点

操作内容:

# source admin-openrc
# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# glance image-create --name "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility=public
# glance  image-list
+--------------------------------------+--------+
| ID                                   | Name   |
+--------------------------------------+--------+
| d8e54b4c-b88b-47c8-8b4a-70c1eb806b10 | cirros |
+--------------------------------------+--------+

https://www.xamrdz.com/backend/3zt1937628.html

相关文章: