初识OpenStack三-----glance

2023-12-05 19:58
文章标签 初识 openstack glance

本文主要是介绍初识OpenStack三-----glance,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

第一步创建数据库实例和数据库用户

[root@ct ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.20-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.001 sec)MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS'; 
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)]> exit
Bye
创建用户,修改配置文件
[root@ct ~]# openstack user create --domain default --password GLANCE_PASS glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 94c49d095adb439297ddabad218f66e2 |
| name                | glance                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
[root@ct ~]# openstack role add --project service --user glance admin
[root@ct ~]# openstack service create --name glance --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | 1d7e9fd5a0ca4c99bdfa483c19300101 |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
创建镜像服务API端点 admin,internal,public
[root@ct ~]#  openstack endpoint create --region RegionOne image public http://ct:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b8b01f835033460db1c639313754a9ac |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1d7e9fd5a0ca4c99bdfa483c19300101 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://ct:9292                   |
+--------------+----------------------------------+
[root@ct ~]# openstack endpoint create --region RegionOne image internal http://ct:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0b741c44c0af4b3c9ab57f001c4992a0 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1d7e9fd5a0ca4c99bdfa483c19300101 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://ct:9292                   |
+--------------+----------------------------------+
[root@ct ~]# openstack endpoint create --region RegionOne image admin http://ct:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7d9bcebbfb804f28a11c8e3fdb6836f9 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1d7e9fd5a0ca4c99bdfa483c19300101 |
| service_name | glance                           |
| service_type | image                            |
| url          | http://ct:9292                   |
+--------------+----------------------------------+

安装工OpenStack-glance软件包
yum -y install openstack-glance
修改glance配置文件
/etc/glance/glance-api.conf
/etc/glance/glance-registry.conf

[root@ct ~]# cp -a /etc/glance/glance-api.conf{,.bak}
[root@ct ~]# grep -Ev '^$|#' /etc/glance/glance-api.conf.bak > /etc/glance/glance-api.conf
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:GLANCE_DBPASS@ct/glance
k-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password GLANCE_PASS
openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http
openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
openstack-config --set /etc/glance/glance-api.conf glance_store filesys[root@ct ~]# openstack-config --settp://ct:5000/glance-api.conf keystone_authtoken www_authenticate_uri h 
tem_store_datadir /var/lib/glance/images/
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://ct:5000
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers ct:11211
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_type password
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password GLANCE_PASS
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf glance_store default_store file
[root@ct ~]# openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
[root@ct glance]# cp -a /etc/glance/glance-registry.conf{,.bak}
[root@ct glance]# grep -Ev '^$|#' /etc/glance/glance-registry.conf.bak > /etc/glance/glance-registry.conf
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf database connection  mysql+pymysql://glance:GLANCE_DBPASS@t/glance
et /etc/glance/glance-registry.conf keystone_authtoken auth_url  http://ct:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers  ct:11211
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type  password
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name  Default
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name  Default
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name  service
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username  glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password  GLANCE_PASS
openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor  keystone
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken www_authenticate_uri   http://ct:5000
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url  http://ct:5000
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers  ct:11211
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type  password
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name  Default
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name  Default
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name  service
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username  glance
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password  GLANCE_PASS
[root@ct glance]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor  keystone

初始化glance数据库,生成相关表结构

su -s /bin/sh -c “glance-manage db_sync” glance 初始化glance数据库
在这里插入图片描述
开启服务,查看端口

[root@ct glance]# systemctl enable openstack-glance-api.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
[root@ct glance]# systemctl start openstack-glance-api.service
[root@ct glance]# netstat -natp | grep 9292
tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN      16680/python2       

赋予OpenStack-glance-api。service服务对存储设备的读写权限

[root@ct glance]#  chown -hR glance:glance /var/lib/glance/
[root@ct ~]# rz -E
rz waiting to receive.
[root@ct ~]# openstack image create --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public cirros
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                      |
+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | f8ab98ff5e73ebab884d80c9dc9c7290               
 查看镜像的方式

在这里插入图片描述

小结

因为OpenStack上创建虚拟机需要镜像支持,所以先行进行部署
部署思路:
1、创建数据库、授权
2、创建openstack用户、授权、管理
3、修改配置文件(glance-api.conf、glance-registry.conf)
4、初始化数据库、上传实例镜像

这篇关于初识OpenStack三-----glance的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/458933

相关文章

零基础STM32单片机编程入门(一)初识STM32单片机

文章目录 一.概要二.单片机型号命名规则三.STM32F103系统架构四.STM32F103C8T6单片机启动流程五.STM32F103C8T6单片机主要外设资源六.编程过程中芯片数据手册的作用1.单片机外设资源情况2.STM32单片机内部框图3.STM32单片机管脚图4.STM32单片机每个管脚可配功能5.单片机功耗数据6.FALSH编程时间,擦写次数7.I/O高低电平电压表格8.外设接口

C语言入门系列:初识函数

文章目录 一,C语言函数与数学函数的区别1,回忆杀-初中数学2,C语言中的函数 二, 函数的声明1,函数头1.1,函数名称1.2,返回值类型1.3,参数列表 2,函数体2.1,函数体2.2,return语句 三,main函数四,函数的参数与传递方式1,实参和形参1.1,函数定义(含形参)1.2,函数调用(使用实参) 2,参数传递方式2.1,值传递2.2,引用传递 五,函数原型与预声明1,

任务5.1 初识Spark Streaming

实战概述:使用Spark Streaming进行词频统计 1. 项目背景与目标 背景: Spark Streaming是Apache Spark的流处理框架,用于构建可伸缩、高吞吐量的实时数据处理应用。目标: 实现一个实时词频统计系统,能够处理流式数据并统计文本中的单词出现频率。 2. 技术要点 Spark Streaming集成: 与Spark生态的其他组件如Spark SQL、ML

初识 SpringMVC,运行配置第一个Spring MVC 程序

1. 初识 SpringMVC,运行配置第一个Spring MVC 程序 文章目录 1. 初识 SpringMVC,运行配置第一个Spring MVC 程序1.1 什么是 MVC 2. Spring MVC 概述2.1 Spring MVC 的作用: 3. 运行配置第一个 Spring MVC 程序3.1 第一步:创建Maven模块3.2 第二步:添加 web 支持3.3 第三步:配置 w

测试辅助工具(抓包工具)的使用1 之初识抓包工具(fiddler)

1.什么是抓包? 说明:客户端向服务器发送请求以及服务器响应客户端的请求,都是以数据包来传递的。 抓包(packet capture):通过工具拦截客户端与服务器交互的数据包。 抓包后可以修改数据包的内容  2.为什么要抓包? 确定bug是前端研发人员的还是后端研发人员的 3.如何抓包? 1)使用抓包工具Fiddler 2)Fiddler介绍: Fiddl

UDP编程初识

复习: TCP     每个TCP套接字都有一个发送区,我们可以使用SO_SNDBUF来更改缓冲区的大小,当进程调用write时,内核从该应用进程的缓冲区中复制所有数据到套接字的缓冲区。如果该套接字的发送缓冲区容不下该应用进程的所有数据(或是应用进程的缓冲区大于套接字的发送缓冲区,或是套接字的发送缓冲区已有其他数据),该应用进程将被投入睡眠(这里的套接字是阻塞的),内核将不从write系统

第十六章(二) 套接字初识

 数据传输:  尽管可以通过 read 和 write 交换数据,但这就是这两个函数所能作的一切。但是如果想要指定选项,从多个客户端接收数据包,或者发送带外数据,就需要使用6个为数据传递而设计的套接字函数。  三个传送数据的套接字函数: <span style="color:#000000;">ssize_t send(int sockfd, void *buf, size_t n

第十六章(一) 套接字初识

 地址格式  一个地址标识一个特定通信域的套接字端点,地址格式与这个特定的通信域相关。为使不同的格式地址能够传入到套接字函数,地址会被强制转化成一个通用的地址结构: struct sockaddr{sa_family_t sa_family; //address familychar sa_data[]; //variable-length address...};

Libevent源码分析之event结构体初识

I/O框架库以库函数的形式,封装了较为底层的系统调用,给应用程序提供了一组更为便捷的接口 各种I/O框架库的实现原理基本相似,要么以Reactor模式实现,要么以Proactor模式实现,要么同时用这两种模式。 拿基于Reactor模式的I/O框架库来说,包含以下几个组件: 1、句柄     I/O框架库要处理的对象,即I/O事件、信号和定时事件,统一称为事件源。一个事件源通常和

【Web3初识系列】如何连接 Binance Smart Chain通过交易对绘制 k 线?

连接 Binance Smart Chain通过交易对绘制 k 线 安装 web3 pip install web3 连接到 Binance Smart Chain 使用公共的 BSC 节点 URL。 from web3 import Web3# 连接到 BSC 公共节点bsc_url = "https://bsc-dataseed.binance.org/"web3 = Web3