openstack安装(16)

2021-05-06 10:36:07 浏览数 (1)

部署需求:安装和配置镜像服务之前,必须创建创建一个数据库、服务凭证和API端点。

[root@controller ~]# mysql -u root -p123456 #创建数据并授权

MariaDB [(none)]> CREATE DATABASE glance;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '123456';

Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '123456';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> q

Bye

[root@controller ~]# source admin-openrc.sh #获得 admin 凭证来获取只有管理员能执行命令的访问权限

[root@controller ~]# openstack user create --domain default --password-prompt glance #创建 glance 用户

User Password: #密码为123456

Repeat User Password:

----------- ----------------------------------

| Field | Value |

----------- ----------------------------------

| domain_id | default |

| enabled | True |

| id | 87a0389545e54e6697db202744c736b6 |

| name | glance |

----------- ----------------------------------

[root@controller ~]# openstack role add --project service --user glance admin #添加 admin 角色到 glance 用户和 service 项目上,命令没有输出

[root@controller ~]# openstack service create --name glance --description "OpenStack Image service" image #创建glance服务实体

------------- ----------------------------------

| Field | Value |

------------- ----------------------------------

| description | OpenStack Image service |

| enabled | True |

| id | b4c7005fde9b4c0085e2fc5874f02f34 |

| name | glance |

| type | image |

------------- ----------------------------------

创建镜像服务的 API 端点

[root@controller ~]# openstack endpoint create --region RegionOne image public http://controller:9292

-------------- ----------------------------------

| Field | Value |

-------------- ----------------------------------

| enabled | True |

| id | 589466fdddf447b9b7e273954c2b7987 |

| interface | public |

| region | RegionOne |

| region_id | RegionOne |

| service_id | b4c7005fde9b4c0085e2fc5874f02f34 |

| service_name | glance |

| service_type | image |

| url | http://controller:9292 |

-------------- ----------------------------------

[root@controller ~]# openstack endpoint create --region RegionOne image internal http://controller:9292

-------------- ----------------------------------

| Field | Value |

-------------- ----------------------------------

| enabled | True |

| id | f67a5c559caf4580aee84304d1a2f37d |

| interface | internal |

| region | RegionOne |

| region_id | RegionOne |

| service_id | b4c7005fde9b4c0085e2fc5874f02f34 |

| service_name | glance |

| service_type | image |

| url | http://controller:9292 |

-------------- ----------------------------------

[root@controller ~]# openstack endpoint create --region RegionOne image admin http://controller:9292

-------------- ----------------------------------

| Field | Value |

-------------- ----------------------------------

| enabled | True |

| id | fb54cd8ff23b4ea0872f1a5db7182d8e |

| interface | admin |

| region | RegionOne |

| region_id | RegionOne |

| service_id | b4c7005fde9b4c0085e2fc5874f02f34 |

| service_name | glance |

| service_type | image |

| url | http://controller:9292 |

-------------- ----------------------------------

0 人点赞