当前位置:   article > 正文

云计算|OpenStack|社区版OpenStack安装部署文档(八--- 存储服务cinder的安装部署---Rocky版)_deprecated: option "logdir" from group "default" i

deprecated: option "logdir" from group "default" is deprecated. use option

Cinder概述

cinder服务可以提供云磁盘(卷),类似阿里云云盘

OpenStack块存储服务(cinder)为虚拟机添加持久的存储,块存储提供一个基础设施为了管理卷,以及和OpenStack计算服务交互,为实例提供卷。此服务也会激活管理卷的快照和卷类型的功能。

块存储服务通常包含下列组件:

1)cinder-api
接受API请求,并将其路由到``cinder-volume``执行。
2)cinder-volume
与块存储服务和例如``cinder-scheduler``的进程进行直接交互。它也可以与这些进程通过一个消息队列进行交互。``cinder-volume``服务响应送到块存储服务的读写请求来维持状态。它也可以和多种存储提供者在驱动架构下进行交互。
3)cinder-scheduler守护进程
选择最优存储提供节点来创建卷。其与``nova-scheduler``组件类似。
4)cinder-backup守护进程
``cinder-backup``服务提供任何种类备份卷到一个备份存储提供者。就像``cinder-volume``服务,它与多种存储提供者在驱动架构下进行交互。
5)消息队列
在块存储的进程之间路由信息。

那么,cinder的部署和其它服务也基本差不多的,需要在控制节点部署,也需要在一个单独的storage存储服务器部署,本例中由于都是在虚拟机中部署,因此,storage节点增加一个100G的硬盘。

该服务的底层是使用的iscsi技术,后面会详细讲解。

一,

在控制节点(本例是192.168.123.130)上操作,安装部署cinder服务

1,

创建相关数据库

登陆mariadb,执行以下SQL语句:

  1. CREATE DATABASE cinder;
  2. GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';
  3. GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
  4. flush privileges;

2,

在keystone上注册cinder服务

创建用户,绑定到admin角色并加入service项目:

  1. openstack user create --domain default --password=cinder cinder
  2. openstack role add --project service --user cinder admin

输出入下,第二个命令无输出表示正确:

  1. [root@openstack1 ~]# openstack user create --domain default --password=cinder cinder
  2. +---------------------+----------------------------------+
  3. | Field | Value |
  4. +---------------------+----------------------------------+
  5. | domain_id | default |
  6. | enabled | True |
  7. | id | e4dab5daa52b4da783370824566697eb |
  8. | name | cinder |
  9. | options | {} |
  10. | password_expires_at | None |
  11. +---------------------+----------------------------------+
  12. [root@openstack1 ~]# openstack role add --project service --user cinder admin

3,

创建cinder的服务实例

  1. openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
  2. openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3

输出如下:

  1. [root@openstack1 ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
  2. +-------------+----------------------------------+
  3. | Field | Value |
  4. +-------------+----------------------------------+
  5. | description | OpenStack Block Storage |
  6. | enabled | True |
  7. | id | ef9ec02eecf84560a1a3a498a968312a |
  8. | name | cinderv2 |
  9. | type | volumev2 |
  10. +-------------+----------------------------------+
  11. [root@openstack1 ~]# openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
  12. +-------------+----------------------------------+
  13. | Field | Value |
  14. +-------------+----------------------------------+
  15. | description | OpenStack Block Storage |
  16. | enabled | True |
  17. | id | dbb637bc998544b89e7feb6d60759f5a |
  18. | name | cinderv3 |
  19. | type | volumev3 |
  20. +-------------+----------------------------------+
  21. [root@openstack1 ~]# openstack service list
  22. +----------------------------------+-----------+-----------+
  23. | ID | Name | Type |
  24. +----------------------------------+-----------+-----------+
  25. | 629d817aa28d4579b08663529efc63e4 | placement | placement |
  26. | 7aa0d862c3dc4ae884e7f02551b07630 | glance | image |
  27. | 83721cda2dd94e8bbfad43e34657a6da | nova | compute |
  28. | c187cea7ed9c46668a229a3278b1e434 | keystone | identity |
  29. | dbb637bc998544b89e7feb6d60759f5a | cinderv3 | volumev3 |
  30. | ef9ec02eecf84560a1a3a498a968312a | cinderv2 | volumev2 |
  31. | fed6374c1cdd453a8d26c4e33d664b5d | neutron | network |
  32. +----------------------------------+-----------+-----------+

4,

创建cinder服务的检查点(六个)

###注:仍然使用的是控制节点的主机名openstack1

  1. openstack endpoint create --region RegionOne volumev2 public http://openstack1:8776/v2/%\(project_id\)s
  2. openstack endpoint create --region RegionOne volumev2 internal http://openstack1:8776/v2/%\(project_id\)s
  3. openstack endpoint create --region RegionOne volumev2 admin http://openstack1:8776/v2/%\(project_id\)s
  4. openstack endpoint create --region RegionOne volumev3 public http://openstack1:8776/v3/%\(project_id\)s
  5. openstack endpoint create --region RegionOne volumev3 internal http://openstack1:8776/v3/%\(project_id\)s
  6. openstack endpoint create --region RegionOne volumev3 admin http://openstack1:8776/v3/%\(project_id\)s

输出如下:

  1. [root@openstack1 ~]# openstack endpoint list
  2. +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
  3. | ID | Region | Service Name | Service Type | Enabled | Interface | URL |
  4. +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+
  5. | 010363cc3b224811ab1c45d67f56d475 | RegionOne | placement | placement | True | public | http://openstack1:8778 |
  6. | 09b682984f4d446b9624de291b27ba43 | RegionOne | keystone | identity | True | internal | http://openstack1:5000/v3/ |
  7. | 133422327e074eb7af3cdd47f0cb8002 | RegionOne | cinderv2 | volumev2 | True | public | http://openstack1:8776/v2/%(project_id)s |
  8. | 168e152a5ecd471183d5772b0d582039 | RegionOne | glance | image | True | public | http://openstack1:9292 |
  9. | 1d267eb74ab245958730f80b75c1abf3 | RegionOne | nova | compute | True | internal | http://openstack1:8774/v2.1 |
  10. | 38a8f28889e147aebea59251589fe9af | RegionOne | cinderv3 | volumev3 | True | internal | http://openstack1:8776/v3/%(project_id)s |
  11. | 4cbde990b9ac4e5d8cb58ecea6591361 | RegionOne | placement | placement | True | admin | http://openstack1:8778 |
  12. | 5080d68d4d094baab6246608fd7d277d | RegionOne | neutron | network | True | admin | http://openstack1:9696 |
  13. | 51ce1bfdca11488f8851c0ad6c77873d | RegionOne | cinderv3 | volumev3 | True | public | http://openstack1:8776/v3/%(project_id)s |
  14. | 632410fddc98491496f54d93a9d13a96 | RegionOne | keystone | identity | True | public | http://openstack1:5000/v3/ |
  15. | 63cf103027204a5d845c9da6a08f36e0 | RegionOne | nova | compute | True | public | http://openstack1:8774/v2.1 |
  16. | 8bbfa274e32f4a069b172976a0e209e4 | RegionOne | placement | placement | True | internal | http://openstack1:8778 |
  17. | 9f46fdd5d8a7498d8a12b047f21095ab | RegionOne | glance | image | True | admin | http://openstack1:9292 |
  18. | a1c8d96d44154cbc85f32e5d9ff8e54e | RegionOne | neutron | network | True | internal | http://openstack1:9696 |
  19. | a3610b51395e49d8898463136d24cec3 | RegionOne | nova | compute | True | admin | http://openstack1:8774/v2.1 |
  20. | a57efb7be1664e9bae2ad823bef3ea5a | RegionOne | glance | image | True | internal | http://openstack1:9292 |
  21. | a9e0562e0f5241b49c9106dadcf88db7 | RegionOne | keystone | identity | True | admin | http://openstack1:5000/v3/ |
  22. | b4a929d14a0d432eb0a554357fa66d33 | RegionOne | cinderv2 | volumev2 | True | internal | http://openstack1:8776/v2/%(project_id)s |
  23. | b6ec4e7f40eb4cedbf18a94883173654 | RegionOne | cinderv2 | volumev2 | True | admin | http://openstack1:8776/v2/%(project_id)s |
  24. | dedb5defaefc41ddaf3eae3e470af2dc | RegionOne | cinderv3 | volumev3 | True | admin | http://openstack1:8776/v3/%(project_id)s |
  25. | e69de8adfe8042369e05652e6961503e | RegionOne | neutron | network | True | public | http://openstack1:9696 |
  26. +----------------------------------+-----------+--------------+--------------+---------+-----------+------------------------------------------+

5,

yum安装cinder

yum install openstack-cinder -y

6,

快速修改cinder配置

###注:这里仍然是使用130的主机名,注意,rabbitmq的密码不要写错了

  1. openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:cinder@openstack1/cinder
  2. openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@openstack1
  3. openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
  4. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_uri http://openstack1:5000
  5. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://openstack1:5000
  6. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers openstack1:11211
  7. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password
  8. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default
  9. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default
  10. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service
  11. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder
  12. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password cinder
  13. openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.123.130
  14. openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/nova/tmp

配置文件的内容:

  1. [root@openstack1 ~]# grep ^[a-z] /etc/cinder/cinder.conf
  2. transport_url = rabbit://openstack:RABBIT_PASS@openstack1
  3. auth_strategy = keystone
  4. my_ip = 192.168.123.130
  5. connection = mysql+pymysql://cinder:cinder@openstack1/cinder
  6. auth_uri = http://openstack1:5000
  7. auth_url = http://openstack1:5000
  8. memcached_servers = openstack1:11211
  9. auth_type = password
  10. project_domain_name = default
  11. user_domain_name = default
  12. project_name = service
  13. username = cinder
  14. password = cinder
  15. lock_path = /var/lib/nova/tmp

7,

同步cinder数据库(共计新增35张表)

su -s /bin/sh -c "cinder-manage db sync" cinder

输出如下:

###注:这个警告可以忽略

  1. [root@openstack1 ~]# su -s /bin/sh -c "cinder-manage db sync" cinder
  2. Deprecated: Option "logdir" from group "DEFAULT" is deprecated. Use option "log-dir" from group "DEFAULT".
  3. [root@openstack1 ~]# mysql -ucinder -pcinder -e "use cinder;show tables" |wc -l
  4. 36

8,配置nova调用cinder服务

openstack-config --set  /etc/nova/nova.conf cinder os_region_name  RegionOne

9,重启nova-api服务和启动cinder服务以及将cinder服务加入自启

  1. systemctl restart openstack-nova-api.service
  2. systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
  3. systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

此时,在dashboard里可以看到多出了一个卷管理界面:

此时,查看卷存储的服务是只能看到一个调度服务的:

  1. [root@openstack1 ~]# openstack volume service list
  2. +------------------+------------+------+---------+-------+----------------------------+
  3. | Binary | Host | Zone | Status | State | Updated At |
  4. +------------------+------------+------+---------+-------+----------------------------+
  5. | cinder-scheduler | openstack1 | nova | enabled | up | 2023-02-03T04:01:49.000000 |
  6. +------------------+------------+------+---------+-------+----------------------------+

 二,

在storage存储节点操作

该虚拟机新增了一个100G的硬盘,IP地址是192.168.123.132

 

1,

环境准备

  1. yum install lvm2 device-mapper-persistent-data -y
  2. systemctl enable lvm2-lvmetad.service
  3. systemctl start lvm2-lvmetad.service
  4. systemctl status lvm2-lvmetad.service
  5. [root@openstack3 ~]# lsblk
  6. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  7. sda 8:0 0 100G 0 disk
  8. └─sda1 8:1 0 100G 0 part /
  9. sdb 8:16 0 100G 0 disk
  10. sr0 11:0 1 4.2G 0 rom
  11. [root@openstack3 ~]# pvcreate /dev/sdb
  12. Physical volume "/dev/sdb" successfully created.
  13. [root@openstack3 ~]# vgcreate cinder-volumes /dev/sdb
  14. Volume group "cinder-volumes" successfully created

2,

配置过滤器,防止系统出错

# 默认只会有openstack实例访问块存储卷组,不过,底层的操作系统也会管理这些设备并尝试将逻辑卷与系统关联。
# 默认情况下LVM卷扫描工具会扫描整个/dev目录,查找所有包含lvm卷的块存储设备。如果其他项目在某个磁盘设备sda,sdc等上使用了lvm卷,那么扫描工具检测到这些卷时会尝试缓存这些lvm卷,可能导致底层操作系统或者其他服务无法正常调用他们的lvm卷组,从而产生各种问题,需要手动配置LVM,让LVM卷扫描工具只扫描包含"cinder-volume"卷组的设备/dev/sdb,我这边磁盘分区都是格式化的手工分区,目前不存在这个问题,以下是配置演示:

  1. vim /etc/lvm/lvm.conf
  2. -----------------------------
  3. devices {
  4. filter = [ "a/sdb/", "r/.*/"]
  5. }

# 配置规则:

# 每个过滤器组中的元素都以a开头accept接受,或以 r 开头reject拒绝,后面连接设备名称的正则表达式规则。
# 过滤器组必须以"r/.*/"结束,过滤所有保留设备。
# 可以使用命令:vgs -vvvv来测试过滤器。

3,

在存储节点安装配置cinder组件

yum install openstack-cinder targetcli python-keystone -y

 4,

在存储节点快速修改cinder配置

###注:仍然是使用控制节点的主机名,my_ip是本机IP

  1. openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:cinder@openstack1/cinder
  2. openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@openstack1
  3. openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
  4. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://openstack1:5000
  5. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://openstack1:5000
  6. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers openstack1:11211
  7. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password
  8. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default
  9. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default
  10. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service
  11. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder
  12. openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password cinder
  13. openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.123.132
  14. openstack-config --set /etc/cinder/cinder.conf lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
  15. openstack-config --set /etc/cinder/cinder.conf lvm volume_group cinder-volumes
  16. openstack-config --set /etc/cinder/cinder.conf lvm iscsi_protocol iscsi
  17. openstack-config --set /etc/cinder/cinder.conf lvm iscsi_helper lioadm
  18. openstack-config --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm
  19. openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_api_servers http://openstack1:9292
  20. openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp

配置文件修改的内容:

  1. [root@openstack3 ~]# grep ^[a-z] /etc/cinder/cinder.conf
  2. transport_url = rabbit://openstack:RABBIT_PASS@openstack1
  3. auth_strategy = keystone
  4. my_ip = 192.168.123.132
  5. enabled_backends = lvm
  6. glance_api_servers = http://openstack1:9292
  7. connection = mysql+pymysql://cinder:cinder@openstack1/cinder
  8. www_authenticate_uri = http://openstack1:5000
  9. auth_url = http://openstack1:5000
  10. memcached_servers = openstack1:11211
  11. auth_type = password
  12. project_domain_name = default
  13. user_domain_name = default
  14. project_name = service
  15. username = cinder
  16. password = cinder
  17. lock_path = /var/lib/cinder/tmp
  18. volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
  19. volume_group = cinder-volumes
  20. iscsi_protocol = iscsi
  21. iscsi_helper = lioadm

5,

存储节点启动cinder服务并加入自启

# 需要启动2个服务

  1. systemctl enable openstack-cinder-volume.service target.service
  2. systemctl start openstack-cinder-volume.service target.service
  3. systemctl status openstack-cinder-volume.service target.service

# 至此,在存储节点安装cinder服务就完成了

三,

验证cinder服务是否正常(在控制节点操作)

  1. [root@openstack1 ~]# openstack volume service list
  2. +------------------+----------------+------+---------+-------+----------------------------+
  3. | Binary | Host | Zone | Status | State | Updated At |
  4. +------------------+----------------+------+---------+-------+----------------------------+
  5. | cinder-scheduler | openstack1 | nova | enabled | up | 2023-02-03T05:26:30.000000 |
  6. | cinder-volume | openstack3@lvm | nova | enabled | up | 2023-02-03T05:26:23.000000 |

可以看到两个service,cinder-volume的host自动打上了lvm的标签。

cinder服务其实只算完成了一部分,还有一个备份服务没有安装,但此备份服务依赖于对象存储服务Swift,因此,在讲Swift服务安装完毕后,在补充backup服务。

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号