CentOS7安装OpenStack(Queens版)——(七)cinder存储服务

cinder存储服务

安装配置(控制节点

  1. 创建cinder数据库并授权,自定义帐号密码cinder/cinder
mysql -uroot -p

MariaDB [(none)]> CREATE DATABASE cinder;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
MariaDB [(none)]> FLUSH PRIVILEGES;
  1. 加载临时环境变量
. keystonerc_admin
  1. 创建服务凭据
    • 创建cinder用户,自定义密码为cinder
[root@controller-01 ~]# openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 586034dc84fa427baec593ed32501d28 |
| name                | cinder                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
  • 给cinder用户添加admin角色,命令不输出结果
openstack role add --project service --user cinder admin
  • 创建cinderv2和cinderv3服务实体:
[root@controller-01 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 08c72135ddcb46fda290c6ec94b270ed |
| name        | cinderv2                         |
| type        | volumev2                         |
+-------------+----------------------------------+

[root@controller-01 ~]# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 671d97addc654760be943446f9c158f6 |
| name        | cinderv3                         |
| type        | volumev3                         |
+-------------+----------------------------------+
  1. 创建块存储服务API端点:
[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev2 public http://controller-01:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 7a53221557e04a619dc0c32f8c7317d0            |
| interface    | public                                      |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 08c72135ddcb46fda290c6ec94b270ed            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller-01:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev2 internal http://controller-01:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 09a252a768084d889d512fcc9d2a654a            |
| interface    | internal                                    |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 08c72135ddcb46fda290c6ec94b270ed            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller-01:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev2 admin http://controller-01:8776/v2/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | b9f21f762ce841bba9d54611bd2ecd42            |
| interface    | admin                                       |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 08c72135ddcb46fda290c6ec94b270ed            |
| service_name | cinderv2                                    |
| service_type | volumev2                                    |
| url          | http://controller-01:8776/v2/%(project_id)s |
+--------------+---------------------------------------------+
[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev3 public http://controller-01:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | d7e6dffcafbb4c4f807808c834af160a            |
| interface    | public                                      |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 671d97addc654760be943446f9c158f6            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller-01:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev3 internal http://controller-01:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | ac3c4e5395cc4b82b0ffa3af5548c69c            |
| interface    | internal                                    |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 671d97addc654760be943446f9c158f6            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller-01:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne volumev3 admin http://controller-01:8776/v3/%\(project_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | a6479e61952b4e7a85719195c4ac5728            |
| interface    | admin                                       |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 671d97addc654760be943446f9c158f6            |
| service_name | cinderv3                                    |
| service_type | volumev3                                    |
| url          | http://controller-01:8776/v3/%(project_id)s |
+--------------+---------------------------------------------+

继续阅读“CentOS7安装OpenStack(Queens版)——(七)cinder存储服务”

CentOS7安装OpenStack(Queens版)——(六)horizon dashboard服务

horizon dashboard服务安装(控制节点

系统要求

Queens版本horizon具有以下依赖:
– Python 2.7
– Django 1.11
– Django 1.8 to 1.10 也是支持的,他们的支持将在Rocky后被移除。
– 一个可访问的 keystone 端点服务
– 所有其他服务都是可选的。从 Queens 版本开始,Horizo​​n 支持以下服务。如果配置了服务的 keystone 端点,horizo​​n 会检测到它并自动启用它的支持。
– cinder: Block Storage
– glance: Image Management
– neutron: Networking
– nova: Compute
– swift: Object Storage
– Horizon also supports many other OpenStack services via plugins. For more information, see the Plugin Registry.

安装并且配置

  1. 安装包
yum install openstack-dashboard
  1. 编辑/etc/openstack-dashboard/local_settings文件,修改如下配置:
OPENSTACK_HOST = "controller-01"
ALLOWED_HOSTS = ['horizon.example.com', 'localhost']   # 主机也可以填写为'*',但是存在安全风险

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

CACHES = {
    'default': {
         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
         'LOCATION': 'controller-01:11211',
    }
}

OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 2,
}

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "Default"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_NEUTRON_NETWORK = {
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_vpn': False,
    'enable_fip_topology_check': False,
}

TIME_ZONE = "TIME_ZONE"     # TIME_ZONE替换为具体时区,比如Asia/Shanghai
  1. 编辑/etc/httpd/conf.d/openstack-dashboard.conf文件,添加如下行:
WSGIApplicationGroup %{GLOBAL}

最后

  • 重启web服务与session存储服务
systemctl restart httpd.service memcached.service
systemctl status httpd.service memcached.service

验证操作(本机

  • 本机编辑hosts文件(Linux在/etc/hosts,Windows在C:\Windwos\System32\drivers\etc\hosts),添加测试的域名解析
192.168.1.10    horizon.example.com    # IP填写控制节点controller-01的IP,域名填写上面配置ALLOWED_HOSTS对应域名

本机浏览器打开http://horizon.example.com/dashboard访问,出现dashboard登录页面,Domain填写default,分别输入admindemo对应的帐号密码登录验证

参考文档

https://docs.openstack.org

CentOS7安装OpenStack(Queens版)——(五)neutron网络服务

neutron网络服务

控制节点

  1. 创建neutron数据库,自定义用户密码设置为neutron/neutron
mysql -uroot -proot
MariaDB [(none)]> CREATE DATABASE neutron;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'neutron';
MariaDB [(none)]> FLUSH PRIVILEGES;
  1. 加载admin临时环境变量
source keystonerc_admin
  1. 在keystone上创建neutron用户,密码自定义为neutron
[root@controller-01 ~]# openstack user create --domain default --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 6dba19fbf1e44fc5b38d81315ecd141e |
| name                | neutron                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
  1. 给neutron用户添加admin角色权限,执行结果无输出
openstack role add --project service --user neutron admin
  1. 创建neutron服务实体
[root@controller-01 ~]# openstack service create --name neutron --description "OpenStack Networking" network
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Networking             |
| enabled     | True                             |
| id          | 6d99c27e4ca74b4b80db2ea15d1214e1 |
| name        | neutron                          |
| type        | network                          |
+-------------+----------------------------------+
  1. 创建网络服务API端点(endpoint)
[root@controller-01 ~]# openstack endpoint create --region RegionOne network public http://controller-01:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | eaa491b4812a4f22892f8e31179e035b |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 6d99c27e4ca74b4b80db2ea15d1214e1 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller-01:9696        |
+--------------+----------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne network internal http://controller-01:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 071f2a4a84404310b10f9cb610766e4f |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 6d99c27e4ca74b4b80db2ea15d1214e1 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller-01:9696        |
+--------------+----------------------------------+

[root@controller-01 ~]# openstack endpoint create --region RegionOne network admin http://controller-01:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 34016fc444894a7c887e0ae62ca264cf |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 6d99c27e4ca74b4b80db2ea15d1214e1 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://controller-01:9696        |
+--------------+----------------------------------+

配置网络选项

您可以使用选项1和2表示的两种体系结构之一来部署网络服务。

  • 选项1、部署了最简单的架构,它只支持将实例附加到提供商(外部)网络。没有自助服务(专用)网络、路由器或浮动IP地址。只有admin特权用户或其他特权用户可以管理提供商网络。
  • 选项2、增加了选项1的第3层服务支持将实例附加到自助服务网络。该demo用户或其他非特权用户可以管理自助服务网络,包括在自助服务网络和提供商网络之间提供连接的路由器。此外,浮动IP地址使用来自外部网络(例如 Internet)的自助服务网络提供与实例的连接。

自助服务网络通常使用覆盖网络。诸如 VXLAN 之类的覆盖网络协议包括额外的标头,这些标头会增加开销并减少可用于有效负载或用户数据的空间。在不了解虚拟网络基础结构的情况下,实例会尝试使用 1500 字节的默认以太网最大传输单元 (MTU) 发送数据包。网络服务通过 DHCP 自动为实例提供正确的 MTU 值。但是,某些云映像不使用 DHCP 或忽略 DHCP MTU 选项,需要使用元数据或脚本进行配置。

根据自己需求,这里我选择的选项2自助服务网络。

这里开始网络组件可以选择linuxbridge或者openvswitch,根据需要选择其中一种

继续阅读“CentOS7安装OpenStack(Queens版)——(五)neutron网络服务”