OpenStack搭建企业私有云 六: 块存储服务(持续更新...)

块存储服务概览

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

块存储服务(cinder)为实例提供块存储。存储的分配和消耗是由块存储驱动器,或者多后端配置的驱动器决定的。还有很多驱动程序可用:NAS/SAN,NFS,ISCSI,Ceph等。

典型情况下,块服务API和调度器服务运行在控制节点上。取决于使用的驱动,卷服务器可以运行在控制节点、计算节点或单独的存储节点。

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

操作步骤

这个部分描述如何在控制节点上安装和配置块设备存储服务,即 cinder。这个服务需要至少一个额外的存储节点,以向实例提供卷。

  • 安装和配置Cinder节点

  • 新添加一块磁盘

    # fdisk /dev/sdb   (然后输入 n p 1 回车 回车 回车 w)
  • 创建LVM物理逻辑卷/dev/sdb

    # pvcreate /dev/sdb1
  • 创建cinder-volumes逻辑卷组

    # vgcreate cinder-volumes /dev/sdb1
  • 安装软件包

    # yum install openstack-cinder targetcli python-keystone -y
    # vim /etc/cinder/cinder.conf
    [DEFAULT]
    //1302
    transport_url = rabbit://openstack:RABBIT_PASS@controller
    /399
    auth_strategy = keystone
    //291
    my_ip = 192.168.200.143
    //403
    enabled_backends = lvm
    //296
    glance_api_servers = http://controller:9292
    
    [database]
    //3586
    connection = mysql+pymysql://cinder:123456@controller/cinder
    
    [keystone_authtoken]
    //3850
    auth_uri = http://controller:5000
    auth_url = http://controller:35357
    //3901
    memcached_servers = controller:11211
    //4008
    auth_type = password
    project_domain_id = default
    user_domain_id = default
    project_name = service
    username = cinder
    password = 123456
    
    [oslo_concurrency]
    //4126
    lock_path = /var/lib/cinder/tmp
    
    在[lvm]部分中,使用LVM驱动程序,cinder-volumes卷组,iSCSI协议和相应的iSCSI服务配置LVM后端。 
    如果[lvm]部分不存在,请创建它:文件末尾添加
    [lvm]
    volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
    volume_group = cinder-volumes
    iscsi_protocol = iscsi
    iscsi_helper = lioadm
    
    # systemctl enable openstack-cinder-volume.service target.service
    # systemctl start openstack-cinder-volume.service target.service

  • 安装和配置控制器节点

  • 配置数据库

    # mysql -u root -p
    > CREATE DATABASE cinder;
    > GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '123456';
    > GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '123456';
    
    # source ~/admin-openrc
  • 创建用户

    # openstack user create --domain default --password-prompt cinder
    User Password:          //密码123456
    Repeat User Password:   //密码123456
  • 添加角色

    # openstack role add --project service --user cinder admin
  • 创建cinderv2和cinderv3服务实体

    # openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
    # openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
  • 创建块存储服务API

    # openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
    # openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s

OpenStack搭建企业私有云 六: 块存储服务(持续更新...)
OpenStack搭建企业私有云 六: 块存储服务(持续更新...)
OpenStack搭建企业私有云 六: 块存储服务(持续更新...)

  • 安装openstack-cinder软件包

    # yum install openstack-cinder -y
    # vim /etc/cinder/cinder.conf
    [database]
    //3586
    connection = mysql+pymysql://cinder:123456@controller/cinder
    
    [DEFAULT]
    //1302
    transport_url = rabbit://openstack:RABBIT_PASS@controller
    //399
    auth_strategy = keystone
    //291
    my_ip = 192.168.200.133
    
    [keystone_authtoken]
    //3850
    auth_uri = http://controller:5000
    auth_url = http://controller:35357
    //3901
    memcached_servers = controller:11211
    //4008
    auth_type = password
    project_domain_id = default
    user_domain_id = default
    project_name = service
    username = cinder
    password = 123456
    
    [oslo_concurrency]
    //4126
    lock_path = /var/lib/cinder/tmp
  • 同步数据库

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

OpenStack搭建企业私有云 六: 块存储服务(持续更新...)

    # vim /etc/nova/nova.conf

    [cinder]
    //4237
    os_region_name = RegionOne

    # systemctl restart openstack-nova-api.service   //重启nova-api
  • 设置开机自启动并启动服务

    # systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
    # systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

猜你喜欢

转载自blog.51cto.com/13630803/2173445
今日推荐