sele 发表于 2018-5-30 11:52:55

OpenStack入门修炼之Cinder服务

  怎样为块存储服务安装并配置存储节点。为简单起见,这里配置一个有一个空的本地块存储设备的存储节点。这个向导用的是 /dev/sdb,此处选用linux-node1节点作为存储节点,需要在vmware中添加一块磁盘。

1.安装支持的工具包

安装 LVM 包:
# yum install -y lvm2
启动LVM的metadata服务并且设置该服务随系统启动:
# systemctl enable lvm2-lvmetad.service
# systemctl start lvm2-lvmetad.service

2.创建LVM物理卷/dev/sdb和卷组 cinder-volumes

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

3.修改配置/etc/lvm/lvm.conf

由于存储节点在操作系统磁盘上使用了 LVM,必需添加相关的设备到过滤器中。例如,如果 /dev/sda 设备包含操作系统:
# vim /etc/lvm/lvm.conf
devices {
filter = [ "a/sda/", "a/sdb/", "r/.*/"]

4.安装并配置组件

# yum install -y openstack-cinder targetcli python-keystone
# vim /etc/cinder/cinder.conf
在文末增加
   <==配置LVM后端,包括LVM驱动,cinder-volume卷组,iscsi协议以及服务
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

enabled_backends = lvm<==启用LVM后端
iscsi_ip_address = 192.168.56.11    <==配置iscsi监听地址
glance_api_servers = http://192.168.56.11:9292<==配置镜像服务API的位置

5.完成安装,启动cinder-volume服务,并查看

# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
# source admin-openstack
# openstack volume service list
+------------------+-----------------+------+---------+-------+----------------------------+
| Binary            | Host             | Zone | Status| State | Updated At               |
+------------------+-----------------+------+---------+-------+----------------------------+
| cinder-scheduler | linux-node1   | nova | enabled | up    | 2017-12-08T09:24:55.000000 |
| cinder-volume    | linux-node1@lvm | nova | enabled | up    | 2017-12-08T09:25:01.000000 |
+------------------+-----------------+------+---------+-------+----------------------------+

6.创建云硬盘并挂载
  (1)打开dashboard,进入卷,点击&quot;创建卷&quot;


  (2)将卷加入到云主机中,&quot;编辑卷&quot;-->&quot;管理连接&quot;-->&quot;链接云主机&quot;

  (3)进入云主机进行查看磁盘挂载情况
fdisk -l,成功挂载1G的云硬盘,对该磁盘进行格式化,并写入数据


  tips:当有多个节点需要挂载该云盘,需要将该磁盘进行umount,再到&quot;管理连接&quot;-->&quot;分离卷&quot;。分离卷时,该磁盘数据不会丢失。挂到其他云主机时,不再需要格式化,直接可挂载。
  存储节点可选用的存储类型
1.使用本地硬盘
2.系统使用本地硬盘+云硬盘(数据盘) ISCSINFSGlusterFSCeph
页: [1]
查看完整版本: OpenStack入门修炼之Cinder服务