Openstack Queens版本双节点架构笔记4,Glance安装:

Glance:

安装和配置

 

本节介绍如何在控制器节点上安装和配置代号为glance的Image服务。为简单起见,此配置将图像存储在本地文件系统上。

先决条件

在安装和配置映像服务之前,必须创建数据库,服务凭据和API端点。

要创建数据库,请完成以下步骤:

使用数据库访问客户端以root用户身份连接到数据库服务器:

$ mysql -u root -p

创建glance数据库:

MariaDB [(none)]> CREATE DATABASE glance;

授予对glance数据库的适当访问权限:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \

  IDENTIFIED BY 'GLANCE_DBPASS';

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \

  IDENTIFIED BY 'GLANCE_DBPASS';

替换GLANCE_DBPASS为合适的密码。

退出数据库访问客户端。

>exit

来源admin凭据来访问仅管理员CLI命令:

$ . admin-openrc

要创建服务凭据,请完成以下步骤:

创建glance用户:

$ openstack user create --domain default --password-prompt glance

User Password:

Repeat User Password:

+---------------------+----------------------------------+

| Field               | Value                            |

+---------------------+----------------------------------+

| domain_id           | default                          |

| enabled             | True                             |

| id                  | 3f4e777c4062483ab8d9edd7dff829df |

| name                | glance                           |

| options             | {}                               |

| password_expires_at | None                             |

+---------------------+----------------------------------+

Add the admin role to the glance user and service project:

$ openstack role add --project service --user glance admin

Create the glance service entity:

$ openstack service create --name glance \

  --description "OpenStack Image" image

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | OpenStack Image                  |

| enabled     | True                             |

| id          | 8c2c7f1b9b5049ea9e63757b5533e6d2 |

| name        | glance                           |

| type        | image                            |

+-------------+----------------------------------+

Create the Image service API endpoints:

$ openstack endpoint create --region RegionOne \

  image public http://controller:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 340be3625e9b4239a6415d034e98aace |

| interface    | public                           |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |

| service_name | glance                           |

| service_type | image                            |

| url          | http://controller:9292           |

+--------------+----------------------------------+

$ openstack endpoint create --region RegionOne \

  image internal http://controller:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | a6e4b153c2ae4c919eccfdbb7dceb5d2 |

| interface    | internal                         |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |

| service_name | glance                           |

| service_type | image                            |

| url          | http://controller:9292           |

+--------------+----------------------------------+

$ openstack endpoint create --region RegionOne \

  image admin http://controller:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | 0c37ed58103f4300a84ff125a539032d |

| interface    | admin                            |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   | 8c2c7f1b9b5049ea9e63757b5533e6d2 |

| service_name | glance                           |

| service_type | image                            |

| url          | http://controller:9292           |

+--------------+----------------------------------+

安装和配置组件

 注意

默认配置文件因分发而异。您可能需要添加这些部分和选项,而不是修改现有的部分和选项。此外,...配置片段中的省略号()表示您应保留的潜在默认配置选项。

安装包:

# yum install openstack-glance

Edit the /etc/glance/glance-api.conf file and complete the following actions:

In the [database] section, configure database access:

[database]

# ...

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance

Replace GLANCE_DBPASS with the password you chose for the Image service database.

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:

[keystone_authtoken]

# ...

auth_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 = GLANCE_PASS

[paste_deploy]

# ...

flavor = keystone

Replace GLANCE_PASS with the password you chose for the glance user in the Identity service.

 Note

Comment out or remove any other options in the [keystone_authtoken] section.

In the [glance_store] section, configure the local file system store and location of image files:

[glance_store]

# ...

stores = file,http

default_store = file

filesystem_store_datadir = /var/lib/glance/images/

Edit the /etc/glance/glance-registry.conf file and complete the following actions:

In the [database] section, configure database access:

[database]

# ...

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance

Replace GLANCE_DBPASS with the password you chose for the Image service database.

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:

[keystone_authtoken]

# ...

auth_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 = GLANCE_PASS

[paste_deploy]

# ...

flavor = keystone

Replace GLANCE_PASS with the password you chose for the glance user in the Identity service.

Note

Comment out or remove any other options in the [keystone_authtoken] section.

Populate the Image service database:

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

 Note

Ignore any deprecation messages in this output.

Finalize installation

Start the Image services and configure them to start when the system boots:

# systemctl enable openstack-glance-api.service \

  openstack-glance-registry.service

# systemctl start openstack-glance-api.service \

  openstack-glance-registry.service

验证操作

 

使用CirrOS验证Image服务的操作, CirrOS是一个小型Linux映像,可帮助您测试OpenStack部署。

 注意

控制器节点上执行这些命令。

来源admin凭据来访问仅管理员CLI命令:

$ . admin-openrc

下载源图像:

$ wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img

使用QCOW2磁盘格式,裸 容器格式和公共可见性将图像上载到Image服务 ,以便所有项目都可以访问它:

$ openstack image create "cirros" \

  --file cirros-0.4.0-x86_64-disk.img \

  --disk-format qcow2 --container-format bare \

  --public

+------------------+------------------------------------------------------+

| Field            | Value                                                |

+------------------+------------------------------------------------------+

| checksum         | 133eae9fb1c98f45894a4e60d8736619                     |

| container_format | bare                                                 |

| created_at       | 2015-03-26T16:52:10Z                                 |

| disk_format      | qcow2                                                |

| file             | /v2/images/cc5c6982-4910-471e-b864-1098015901b5/file |

| id               | cc5c6982-4910-471e-b864-1098015901b5                 |

| min_disk         | 0                                                    |

| min_ram          | 0                                                    |

| name             | cirros                                               |

| owner            | ae7a98326b9c455588edd2656d723b9d                     |

| protected        | False                                                |

| schema           | /v2/schemas/image                                    |

| size             | 13200896                                             |

| status           | active                                               |

| tags             |                                                      |

| updated_at       | 2015-03-26T16:52:10Z                                 |

| virtual_size     | None                                                 |

| visibility       | public                                               |

+------------------+------------------------------------------------------+

确认上传图像并验证属性:

$ openstack image list

+--------------------------------------+--------+--------+

| ID                                   | Name   | Status |

+--------------------------------------+--------+--------+

| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros | active |

+--------------------------------------+--------+--------+

Openstack Queens版本双节点架构笔记1,虚拟机环境安装: https://blog.csdn.net/qq_38387984/article/details/83245908 

Openstack Queens版本双节点架构笔记2,Openstack环境安装: https://blog.csdn.net/qq_38387984/article/details/83245941

Openstack Queens版本双节点架构笔记3,Keystone安装:https://blog.csdn.net/qq_38387984/article/details/83274421

Openstack Queens版本双节点架构笔记4,Glance安装:https://blog.csdn.net/qq_38387984/article/details/83274547

Openstack Queens版本双节点架构笔记5,Nova安装:https://blog.csdn.net/qq_38387984/article/details/83274567

Openstack Queens版本双节点架构笔记6,Neutron安装:https://blog.csdn.net/qq_38387984/article/details/83274578

Openstack Queens版本双节点架构笔记7,Dashboard安装:https://blog.csdn.net/qq_38387984/article/details/83274601

Openstack Queens版本双节点架构笔记8,验证Databoard实例 https://blog.csdn.net/qq_38387984/article/details/83502979

Openstack Queens版本双节点架构笔记9,Ceph安装1: https://blog.csdn.net/qq_38387984/article/details/83502996

Openstack Queens版本双节点架构笔记10,Ceph安装2:https://blog.csdn.net/qq_38387984/article/details/83503016

Openstack Queens版本双节点架构笔记11,Ceph安装3:https://blog.csdn.net/qq_38387984/article/details/83503033

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值