美文网首页
Openstack(Ocata版本)部署总结第七章:块存储

Openstack(Ocata版本)部署总结第七章:块存储

作者: 辉耀辉耀 | 来源:发表于2017-10-12 17:09 被阅读0次

    (1)控制节点
    1、配置数据库

    $ mysql -u root -p
    MariaDB [(none)]> CREATE DATABASE cinder;
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
      IDENTIFIED BY 'CINDER_DBPASS';
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
      IDENTIFIED BY 'CINDER_DBPASS';
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'controller' \
      IDENTIFIED BY 'CINDER_DBPASS';
    

    2、创建服务实体和API端点

    $ . admin-openrc
    $ openstack user create --domain default --password-prompt cinder
    User Password:
    Repeat User Password:
    $ openstack role add --project service --user cinder admin
    $ openstack service create --name cinderv2 \
      --description "OpenStack Block Storage" volumev2
    $ openstack service create --name cinderv3 \
      --description "OpenStack Block Storage" volumev3
    
    $ 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
    

    3、安装并配置服务

    # yum install openstack-cinder
    
    # vim /etc/cinder/cinder.conf
    [database]
    connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
    [DEFAULT]
    transport_url = rabbit://openstack:RABBIT_PASS@controller
    auth_strategy = keystone
    my_ip = 10.0.0.11     这里为controller的IP地址
    [keystone_authtoken]
    auth_uri = http://controller:5000
    auth_url = http://controller:35357
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = cinder
    password = CINDER_PASS
    [oslo_concurrency]
    lock_path = /var/lib/cinder/tmp
    
    # su -s /bin/sh -c "cinder-manage db sync" cinder
    # vim /etc/nova/nova.conf
    [cinder]
    os_region_name = RegionOne
    

    4、启动服务并加入开机自启

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

    (2)存储节点
    1、安装lvm服务并启动

    # yum install lvm2
    # systemctl enable lvm2-lvmetad.service
    # systemctl start lvm2-lvmetad.service
    

    2、创建lvm逻辑卷/dev/sdb

    # pvcreate /dev/sdb
    Physical volume "/dev/sdb" successfully created
    # vgcreate cinder-volumes /dev/sdb
    Volume group "cinder-volumes" successfully created
    

    3、配置LVM过滤

    # vim /etc/lvm/lvm.conf
    devices {
    ...
    filter = [ "a/sdb/", "r/.*/"]
    这里如果出错的话,建议对挂载的硬盘重新做分区、格式化
    

    4、安装cinder服务

    # yum install openstack-cinder targetcli python-keystone
    # vim /etc/cinder/cinder.conf
    [database]
    connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
    [DEFAULT]
    transport_url = rabbit://openstack:RABBIT_PASS@controller
    auth_strategy = keystone
    my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS   这里修改为Cinder节点的IP
    enabled_backends = lvm
    glance_api_servers = http://controller:9292
    [keystone_authtoken]
    auth_uri = http://controller:5000
    auth_url = http://controller:35357
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = cinder
    password = CINDER_PASS
    [oslo_concurrency]
    lock_path = /var/lib/cinder/tmp
    [lvm]   这个标签默认是没有的,加到最后即可
    volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
    volume_group = cinder-volumes
    iscsi_protocol = iscsi
    iscsi_helper = lioadm
    

    5、启动服务并加到开机自启

    # systemctl enable openstack-cinder-volume.service target.service
    # systemctl start openstack-cinder-volume.service target.service
    

    6、验证

    $ . admin-openrc
    $ openstack volume service list
    

    这里看到状态为enabled 和 up即为正确。

    相关文章

      网友评论

          本文标题:Openstack(Ocata版本)部署总结第七章:块存储

          本文链接:https://www.haomeiwen.com/subject/ptsoyxtx.html