目录

  • OpenStack-cinder 组件部署
    • 创建数据库实例和角色
    • 创建用户、修改配置文件
    • 在计算节点c2配置Cinder(存储节点)
    • 验证,ct上查看卷列表
  • 总结

OpenStack-cinder 组件部署

继Dashboard部署完成后,继续部署cinder组件

创建数据库实例和角色

[root@ct ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 247
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 cinder;
Query OK, 1 row affected (0.001 sec)MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.006 sec)MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.004 sec)MariaDB [(none)]> exit
Bye

创建用户、修改配置文件

1. 创建cinder用户,密码设置为CINDER_PASS

[root@ct ~]# openstack user create --domain default --password CINDER_PASS cinder
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 9ed2fe5930fd4bff96163acdaff555ae |
| name                | cinder                           |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

2. 把cinder用户添加到service服务中,并授予admin权限

[root@ct ~]# openstack role add --project service --user cinder admin

3. cinder有v2和v3两个并存版本的API,所以需要创建两个版本的service实例

[root@ct ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 86fc46058bc14d60b9777e593d293662 |
| name        | cinderv2                         |
| type        | volumev2                         |
+-------------+----------------------------------+
[root@ct ~]# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Block Storage          |
| enabled     | True                             |
| id          | 83e6439a228045dc8896ffdbfd8975a7 |
| name        | cinderv3                         |
| type        | volumev3                         |
+-------------+----------------------------------+

4. 给v2和v3版本的api创建endpoint

[root@ct ~]# openstack endpoint create --region RegionOne volumev2 public http://ct:8776/v2/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0ec81284bd524e48aa43392f898a4fd2 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 86fc46058bc14d60b9777e593d293662 |
| service_name | cinderv2                         |
| service_type | volumev2                         |
| url          | http://ct:8776/v2/%(project_id)s |
+--------------+----------------------------------+
[root@ct ~]#  openstack endpoint create --region RegionOne volumev2 internal http://ct:8776/v2/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | de006d8ec4f7411ca603b3ff36f23e35 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 86fc46058bc14d60b9777e593d293662 |
| service_name | cinderv2                         |
| service_type | volumev2                         |
| url          | http://ct:8776/v2/%(project_id)s |
+--------------+----------------------------------+
[root@ct ~]#  openstack endpoint create --region RegionOne volumev2 admin http://ct:8776/v2/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | dcdc92299cdb402e9f99ca938bb21218 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 86fc46058bc14d60b9777e593d293662 |
| service_name | cinderv2                         |
| service_type | volumev2                         |
| url          | http://ct:8776/v2/%(project_id)s |
+--------------+----------------------------------+
[root@ct ~]#  openstack endpoint create --region RegionOne volumev3 public http://ct:8776/v3/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | c5000ebf4818462ea492388b26a52da2 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 83e6439a228045dc8896ffdbfd8975a7 |
| service_name | cinderv3                         |
| service_type | volumev3                         |
| url          | http://ct:8776/v3/%(project_id)s |
+--------------+----------------------------------+
[root@ct ~]#  openstack endpoint create --region RegionOne volumev3 internal http://ct:8776/v3/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 9cafd83a6a3e4a6b98bf93da8b83569c |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 83e6439a228045dc8896ffdbfd8975a7 |
| service_name | cinderv3                         |
| service_type | volumev3                         |
| url          | http://ct:8776/v3/%(project_id)s |
+--------------+----------------------------------+
[root@ct ~]#  openstack endpoint create --region RegionOne volumev3 admin http://ct:8776/v3/%\(project_id\)s
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 627bed52185c43339f27098b05ff7967 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 83e6439a228045dc8896ffdbfd8975a7 |
| service_name | cinderv3                         |
| service_type | volumev3                         |
| url          | http://ct:8776/v3/%(project_id)s |
+--------------+----------------------------------+

5. yum 安装cinder 服务

[root@ct ~]# yum -y install openstack-cinder

6. 修改cinder 配置文件

  • 修改配置文件
[root@ct ~]# cp /etc/cinder/cinder.conf{,.bak}
[root@ct ~]# grep -Ev '#|^$' /etc/cinder/cinder.conf.bak>/etc/cinder/cinder.conf
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@ct
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://ct:5000
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://ct:5000
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers ct:11211
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password CINDER_PASS
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.100.10
[root@ct ~]# openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp
  • 查看配置文件
[root@ct ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@ct         //配置rabbitmq连接
auth_strategy = keystone                       //认证方式
my_ip = 192.168.100.11                     //内网IP[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors][database]                            //对接数据库
connection = mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder[fc-zone-manager]
[healthcheck]
[key_manager][keystone_authtoken]                       //配置keystone认证信息
www_authenticate_uri = http://ct:5000                  //keystone地址
auth_url = http://ct:5000
memcached_servers = ct:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder                          //指定通过cinder账号到keystone做认证(用户名、密码)
password = CINDER_PASS[nova][oslo_concurrency]
lock_path = /var/lib/cinder/tmp                    //配置锁路径[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]

7. 同步cinder数据库(填充块存储数据库)

[root@ct ~]# su -s /bin/sh -c "cinder-manage db sync" cinder
Deprecated: Option "logdir" from group "DEFAULT" is deprecated. Use option "log-dir" from group "DEFAULT".

8. 修改 Nova 配置文件,并重启服务

[root@ct ~]# openstack-config --set /etc/nova/nova.conf cinder os_region_name RegionOne
[root@ct ~]# systemctl restart openstack-nova-api.service

9. 配置Cinder服务

[root@ct ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service to /usr/lib/systemd/system/openstack-cinder-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service to /usr/lib/systemd/system/openstack-cinder-scheduler.service.
[root@ct ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

10. 配置控制节点验证

[root@ct ~]# cinder service-list
+------------------+------+------+---------+-------+----------------------------+---------+-----------------+---------------+
| Binary           | Host | Zone | Status  | State | Updated_at                 | Cluster | Disabled Reason | Backend State |
+------------------+------+------+---------+-------+----------------------------+---------+-----------------+---------------+
| cinder-scheduler | ct   | nova | enabled | up    | 2021-02-19T06:08:04.000000 | -       | -               |               |
+------------------+------+------+---------+-------+----------------------------+---------+-----------------+---------------+

在计算节点c2配置Cinder(存储节点)

1. 安装cinder及依赖文件,并设置开机自启

[root@c2 ~]# yum -y install openstack-cinder targetcli python-keystone
[root@c2 ~]# yum -y install lvm2 device-mapper-persistent-data
[root@c2 ~]# systemctl enable lvm2-lvmetad.service
[root@c2 ~]# systemctl start lvm2-lvmetad.service

2. 创建lvm物理卷和卷组
注:如若没有sdc则创建一个硬盘并重启

[root@c2 ~]# pvcreate /dev/sdcPhysical volume "/dev/sdc" successfully created.
[root@c2 ~]# vgcreate cinder-volumes /dev/sdcVolume group "cinder-volumes" successfully created

3. 修改lvm配置文件(指定使用sdc磁盘)

[root@c2 ~]# vim /etc/lvm/lvm.conf
141         filter = [ "a/sdc/","r/.*/" ]      //取消前面#注释符并修改
  • a表示允许,r表示拒绝
  • 只允许lvm服务访问sdc中的数据,不允许lvm服务访问其他磁盘,这也间接实现了openstack创建的虚拟机只能访问sdb中的数据,不能访问其他磁盘
  • 设置只允许实例访问sdc逻辑卷中的数据;如果不配置的话,本机的其他服务也有可能会访问sdc逻辑卷中的数据

4. 重启lvm服务

[root@c2 ~]# systemctl restart lvm2-lvmetad.service

5. 配置cinder模块

  • 修改cinder.conf配置
[root@c2 ~]# cp /etc/cinder/cinder.conf{,.bak}
[root@c2 ~]# grep -Ev '#|^$' /etc/cinder/cinder.conf.bak>/etc/cinder/cinder.conf
[root@c2 ~]#
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  database  connection mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  DEFAULT transport_url rabbit://openstack:RABBIT_PASS@ct
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  DEFAULT auth_strategy keystone
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  DEFAULT my_ip 192.168.100.12    //c2内网ip
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  DEFAULT enabled_backends lvm
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  DEFAULT glance_api_servers http://ct:9292
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken www_authenticate_uri http://ct:5000
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken auth_url http://ct:5000
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken memcached_servers ct:11211
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken auth_type password
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken project_domain_name default
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken user_domain_name default
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken project_name service
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken username cinder
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  keystone_authtoken password CINDER_PASS
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  lvm volume_group cinder-volumes
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  lvm target_protocol iscsi
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  lvm target_helper lioadm
[root@c2 ~]# openstack-config --set /etc/cinder/cinder.conf  oslo_concurrency lock_path /var/lib/cinder/tmp
  • 查看修改内容
[root@c2 ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@ct
auth_strategy = keystone
my_ip = 192.168.100.12
enabled_backends = lvm
glance_api_servers = http://ct:9292
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@ct/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://ct:5000
auth_url = http://ct:5000
memcached_servers = ct:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
[nova]
[oslo_concurrency]         //配置锁路径
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault][lvm]                            //为LVM后端配置LVM驱动程序
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver  //指定LVM驱动程序;即通过指定的驱动创建LVM
volume_group = cinder-volumes              //指定卷组(vg)
target_protocol = iscsi                    //pv使用的是iscsi协议,可以提供块存储服务
target_helper = lioadm                 //iscsi管理工具#volume_backend_name=Openstack-lvm              //选择:当后端有多个不同类型的存储时,可以在openstack中调用指定的存储;
给当前存储指定个名称,用于后期区分多个不同的存储

6. 开启cinder卷服务,并设置开机自启

[root@c2 ~]# systemctl enable openstack-cinder-volume.service target.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-volume.service to /usr/lib/systemd/system/openstack-cinder-volume.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.
[root@c2 ~]# systemctl start openstack-cinder-volume.service target.service

验证,ct上查看卷列表

[root@ct ~]# openstack volume service list
+------------------+--------+------+---------+-------+----------------------------+
| Binary           | Host   | Zone | Status  | State | Updated At                 |
+------------------+--------+------+---------+-------+----------------------------+
| cinder-scheduler | ct     | nova | enabled | up    | 2021-02-19T06:36:04.000000 |
| cinder-volume    | c2@lvm | nova | enabled | up    | 2021-02-19T06:36:04.000000 |
+------------------+--------+------+---------+-------+----------------------------+

至此,cinder组件部署完成,openstack全部部署成功

总结

Cinder配置思路:

  • 创建管理、对接的用户、密码、服务和endpoint

修改配置文件:

  • 主要内容为 向keystone对接认证授权、组件之间通讯模块、配置所在的域等
  • 配置计算节点中虚拟机所用的卷

超详细Openstack核心组件——cinder部署相关推荐

  1. 超详细Openstack核心组件——Placement部署

    目录 OpenStack-Placement组件部署 创建数据库实例和数据库用户 创建Placement服务用户和API的endpoint 总结 OpenStack-Placement组件部署 继之前 ...

  2. Docker最新超详细教程——安装与部署

    Docker最新超详细教程--安装与部署 安装Docker CentOS安装Docker 1. 卸载(可选) 2. 安装yum工具 3. 更新本地镜像源 4. 安装docker 5. 注意事项 关闭防 ...

  3. nohup 输出日志到文件_超详细的EFK安装部署教程--filebeat日志数据采集

    概述 Filebeat是本地文件的日志数据采集器. 作为服务器上的代理安装,Filebeat监视日志目录或特定日志文件,tail file,并将它们转发给Elasticsearch或Logstash进 ...

  4. 超详细Office Online Server部署

    简介 Office Online Server 提供 Word.PowerPoint.Excel 和 OneNote 的基于浏览器的版本,它为 Office 文件提供基于浏览器的文件查看和编辑服务.O ...

  5. 超详细版企业离线部署CDH6.10集群与配置使用

    进入大数据行业数载,也从一个开发小白走到了今天,期间也历经过一摸番着石头过河的探索,到如今的胸有点墨:玩过demo,使用过负责过上千节点的大数据集群开发与使用:被人面虐过,也面跪过一些人.如今,趁着自 ...

  6. Centos7 搭建Nginx图片服务超详细新手小白教程

    简介:以上文章讲述的是[Centos7超详细的安装与部署应用MySQL,Redis]接下来我总结一下[Centos7 搭建Nginx图片服务超详细教程].觉得我还可以的可以加群一起督促学习探讨技术.Q ...

  7. k8s核心组件详细介绍教程(配超详细实例演示)

    本文实验环境基于上篇文章手把手从零开始搭建k8s集群超详细教程 本文根据B站课程云原生Java架构师的第一课K8s+Docker+KubeSphere+DevOps学习总结而来 k8s核心组件介绍 1 ...

  8. 二进制安装部署 4 kubernetes集群---超详细教程

    二进制安装部署kubernetes集群---超详细教程 前言:本篇博客是博主踩过无数坑,反复查阅资料,一步步搭建完成后整理的个人心得,分享给大家~~~ 本文所需的安装包,都上传在我的网盘中,需要的可以 ...

  9. centos7根据端口查进程_记录一次CentOs7下Nginx+WSGI部署Django项目(超详细)

    记录一次Django部署的文章,不是很熟悉Linux系统,踩了不少坑,本篇文章相当于是一个总结,我会在本文中详细介绍,部署单个Django项目和多个Django的方法,如读者有更好的方法,欢迎留言一起 ...

最新文章

  1. 双重指针作为函数参数的妙用
  2. RollingFileAppender
  3. python3 ssl.CertificateError: hostname manifest.googlevideo.com doesn t match either
  4. FCN-TensorFlow完整代码Github
  5. 腾讯十周年,看看你的QQ是什么时候注册的?
  6. Hadoop实战 -- IO
  7. uni-app实现上传多张照片
  8. vector 查找结构体对象_面试大厂回来,我狠补了一把算法和数据结构
  9. ElasticSearch Java SpringBoot根据时间范围分组求和
  10. kubeadm部署K8S集群并使用containerd做容器运行时
  11. Python操作MySQL(二) ORM篇
  12. NCS8801S:RGB/LVDS转EDP芯片功能汇总及设计注意事项
  13. 云服务器更换系统要钱吗,云服务器可以更换系统吗
  14. vim 显示/取消行号
  15. 概率论与环境数理统计 20210222
  16. java_math_BigInteger
  17. win7操作系统练习题(带答案,有问题可直接在博客或公众号中问)
  18. Kafka 麒麟先生_近百位超人气嘉宾出席元旦萤火虫 重磅新企划蓄势待发!
  19. 头条推荐越来越少是否还要坚持下去
  20. 操作系统学习笔记:操作系统基础知识

热门文章

  1. 读书感想20221218
  2. Security:在 SIEM 上运用 Elastic Security
  3. P2918 [USACO08NOV]Buying Hay S(买干草)(ssl 2895)
  4. 简述适配器的概念、作用以及主机适配器的概念
  5. mysql日常管理事件
  6. linux之bound网络配置
  7. python多显卡支持是什么意思_用blenderpython控制显卡渲图,多显卡用户福音
  8. 读书计划--2009年1月
  9. 机器人仿生控制方法研究
  10. Alpine linux 小内存版,Alpine Linux系统-Alpine Linux系统【轻量级Linux】下载v3.11.0 最新版-西西软件下载...