• A14. openstack架构实战-计算(其他节点)节点cinder块存储服务部署


    本次使用逻辑卷进行对接后端存储:(逻辑卷使用可以动态调节后端存储的大小)

    该服务在这个设备上使用:term:LVM <Logical Volume Manager (LVM)> 提供逻辑卷,并通过:term:`iSCSI`协议提供给实例使用。您可以根据这些小的修改指导,添加额外的存储节点来增加您的环境规模。

    cinder原理分析:

     如整体架构图所示,创建卷涉及的答题步骤主要有以下几步:
    a. Client发送请求,通过RESTFUL接口访问cinder-api。
    b. Api解析响应请求,api解析由Client发送来的请求,并通过rpc进一步调用cinder-scheduler。
    c. Scheduler对资源进行调度,scheduler选择合适的节点进行。
    d. Volume调用Driver创建卷,volume通过指定Driver进行卷的创建。

    准备条件:

    安装支持的工具包:

    1:安装 LVM 包:

    [root@compute01 ~]# yum install lvm2 device-mapper-persistent-data -y

    2:启动LVM的metadata服务并且设置该服务随系统启动:

    [root@compute01 ~]# systemctl enable lvm2-lvmetad.service && systemctl start  lvm2-lvmetad.service
    添加硬盘:

    扫描识别

    [root@compute01 ~]# echo '- - -' >/sys/class/scsi_host/host{0..10}/scan

    使用现有的sdb sdc进行创建lvm

    [root@compute01 ~]# pvcreate /dev/sdb

    [root@compute01 ~]# vgcreate cinder-volumes01 /dev/sdb

    [root@compute01 ~]# pvcreate /dev/sdc

    [root@compute01 ~]# vgcreate cinder-volumes02 /dev/sdc

    只有实例可以访问块存储卷组。不过,底层的操作系统管理这些设备并将其与卷关联。默认情况下,LVM卷扫描工具会扫描``/dev`` 目录,查找包含卷的块存储设备。如果项目在他们的卷上使用LVM,扫描工具检测到这些卷时会尝试缓存它们,可能会在底层操作系统和项目卷上产生各种问题。您必须重新配置LVM,让它只扫描包含``cinder-volume``卷组的设备。

    编辑``/etc/lvm/lvm.conf``文件并完成下面的操作:

    在``devices``部分,添加一个过滤器,只接受``/dev/sdb``设备,拒绝其他所有设备:

    filter = [ "a/sda/", "a/sdb/", "r/.*/"]

    安装cinder包:

    [root@compute01 ~]# yum install openstack-cinder targetcli python-keystone -y

    配置cinder的配置文件:

    编辑 /etc/cinder/cinder.conf,同时完成如下动作:

    在 [database] 部分,配置数据库访问:

    [database]
    connection = mysql+pymysql://cinder:huayun@controller01/cinder


    在 “[DEFAULT]” 和 “[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问:

    [DEFAULT]
    rpc_backend = rabbit

    [oslo_messaging_rabbit]
    rabbit_host = controller01
    rabbit_userid = openstack
    rabbit_password = huayun

    [DEFAULT][keystone_authtoken]部分中,配置身份服务访问:

    [DEFAULT]
    auth_strategy = keystone

    [keystone_authtoken]
    auth_uri = http://controller01:5000
    auth_url = http://controller01:5000
    memcached_servers = controller01:11211
    auth_type = password
    project_domain_id = default
    user_domain_id = default
    project_name = service
    username = cinder
    password = huayun

    在该[DEFAULT]部分中,配置my_ip选项:

    [DEFAULT]

    。。。。。。。

    my_ip = 10.100.214.202

    在该[lvm]部分中,为LVM后端配置LVM驱动程序,cinder-volumes卷组,iSCSI协议和适当的iSCSI服务。如果该[lvm]部分不存在,请创建它:(这里我们其他方法进行配置)

    在最下面添加下面的配置(volume_backend_name我们定义存储盘的类型

    [ssd]
    volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
    volume_group = cinder-volumes01
    iscsi_protocol = iscsi
    iscsi_helper = lioadm
    volume_backend_name = ssd

    [lvm]
    volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
    volume_group = cinder-volumes02
    iscsi_protocol = iscsi
    iscsi_helper = lioadm
    volume_backend_name = lvm



    在该[DEFAULT]部分中,启用LVM,和ssd后端:
    [DEFAULT]
    。。。。。。。
    enabled_backends = ssd,lvm

    在该[DEFAULT]部分中,配置图像服务API的位置:
    [DEFAULT]

    glance_api_servers = http://controller01:9292


    在该[oslo_concurrency]部分中,配置锁定路径:
    [oslo_concurrency]
    lock_path = /var/lib/cinder/tmp

    启动服务:
    [root@compute01 ~]#  systemctl enable openstack-cinder-volume.service target.service && systemctl start openstack-cinder-volume.service target.service

    检测:
    [root@controller01 ~]# cinder service-list
    +------------------+---------------+------+---------+-------+----------------------------+-----------------+
    | Binary           | Host          | Zone | Status  | State | Updated_at                 | Disabled Reason |
    +------------------+---------------+------+---------+-------+----------------------------+-----------------+
    | cinder-scheduler | controller01  | nova | enabled | up    | 2020-05-28T08:44:13.000000 | -               |
    | cinder-volume    | compute01@lvm | nova | enabled | up    | 2020-05-28T08:44:12.000000 | -               |
    | cinder-volume    | compute01@ssd | nova | enabled | up    | 2020-05-28T08:44:12.000000 | -               |
    +------------------+---------------+------+---------+-------+----------------------------+-----------------+

    创建一个卷测试:
    [root@controller01 ~]# openstack volume create --size 1 volume1

    [root@controller01 ~]# cinder list
    +--------------------------------------+-----------+---------+------+-------------+----------+-------------+
    | ID                                   | Status    | Name    | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+---------+------+-------------+----------+-------------+
    | a2871929-c1d7-4fe1-b2ff-737209410f5e | available | volume1 | 1    | -           | false    |             |
    +--------------------------------------+-----------+---------+------+-------------+----------+-------------+
    [root@controller01 ~]# openstack volume list
    +--------------------------------------+---------+-----------+------+-------------+
    | ID                                   | Name    | Status    | Size | Attached to |
    +--------------------------------------+---------+-----------+------+-------------+
    | a2871929-c1d7-4fe1-b2ff-737209410f5e | volume1 | available |    1 |             |
    +--------------------------------------+---------+-----------+------+-------------+


    查看逻辑卷已经由生成的:
    [root@compute01 ~]# lvs

      LV                                          VG               Attr       LSize  Pool                  Origin Data%  Meta%  Move Log Cpy%Sync Convert
      cinder-volumes01-pool                       cinder-volumes01 twi-a-tz-- 41.80g                              0.00   0.44                            
      cinder-volumes02-pool                       cinder-volumes02 twi-aotz-- 47.50g                              0.00   0.46                            
      volume-a2871929-c1d7-4fe1-b2ff-737209410f5e cinder-volumes02 Vwi-a-tz--  1.00g cinder-volumes02-pool        0.00                  
    附加卷添加到云主机上:
    [root@controller01 ~]# nova list
    +--------------------------------------+-----------+---------+------------+-------------+-------------------------+
    | ID                                   | Name      | Status  | Task State | Power State | Networks                |
    +--------------------------------------+-----------+---------+------------+-------------+-------------------------+
    | 0944b546-b038-4962-939e-6b890eb1d5df | test1     | SHUTOFF | -          | Shutdown    | provider=10.100.214.151 |
    | 8fbf0f77-9591-47a6-a086-4d1daab6673a | zhaopei02 | ACTIVE  | -          | Running     | provider=10.100.214.150 |
    +--------------------------------------+-----------+---------+------------+-------------+-------------------------+
    [root@controller01 ~]# openstack server add volume zhaopei02  volume1




  • 相关阅读:
    js将页面上取得的元素坐标转换为电脑屏幕坐标
    一个例子形象的理解协程和线程的区别
    为什么有的人把代码写的如此复杂?
    都说Dapper性能好,突然就遇到个坑,还是个性能问题
    springgateway基于数据库 + nacos 的动态路由
    k8s配置deployment的 liveness 和 readiness 探针 若
    UML设计图5部署图 若
    UML设计图1用例图 若
    UML设计图6序列图 若
    UML设计图2数据流图 若
  • 原文地址:https://www.cnblogs.com/zhaopei123/p/12981898.html
Copyright © 2020-2023  润新知