openstack常用的存储类型cinder

目前openstack场景常用的存储类型主要有cinder、manila和swift三种类型存储。

下面简单介绍三种存储的对比:

 

Cinder:提供块存储服务,可以对接后端存储类型:本地磁盘、ip-san、fc-san、fusionstorage-block

Manila:提供文件存储服务,可以对接后端存储类型:nas、fusionstorage-file

Swift:提供对象存储服务,可以对接后端存储类型:本地磁盘、

 

 

cinder 块存储服务

nova-compute  提供服务的是 libvirt

cinder-volume  提供存储服务的是 lvm nfs  glusterfs  ceph

 

cinder-api  作用 接收外部请求,提供api

cinder-volume:  提供存储空间

cinder-scheduler:  调度器,决定使用那个cinder-volume

cinder-backup:   备份创建的卷

 

 

 

[root@harbor ~]# pvcreate /dev/vdb 
Physical volume "/dev/vdb" successfully created.
[root@harbor
~]# pvcreate /dev/vdc Physical volume "/dev/vdc" successfully created.


添加硬盘后默认,不能识别出来,通过以下命令实现

[root@harbor ~]# echo '- - -' > /sys/class/scsi_host/host0/scan 
[root@harbor ~]# echo '- - -' > /sys/class/scsi_host/host1/scan  

 

 建立卷组

[root@harbor ~]# vgcreate cinder-ssd /dev/vdb
  Volume group "cinder-ssd" successfully created

[root@harbor ~]# vgcreate cinder-sata /dev/vdc
  Volume group "cinder-sata" successfully created

 

添加过滤器

vim  /etc/lvm/lvm.conf

#145 行左右
filer = ["a/vda/", "a/vdb/", "a/vdc/", "r/.*/"]

 

安装和配置组件

 yum install openstack-cinder targetcli python-keystone

 

编辑/etc/cinder/cinder.conf文件

[root@cinder ~]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@controller
auth_strategy = keystone
my_ip = 10.20.1.186
enabled_backends = ssd,sata
glance_api_servers = http://controller:9292
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]
[ssd]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-ssd
target_protocol = iscsi
target_helper = lioadm
volume_backend_name= ssd
[sata]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-sata
target_protocol = iscsi
target_helper = lioadm
volume_backend_name = sata

 

在controller上查看服务信息

 

 
dashboard 登录

 

 

 

 

 

指定ssd 或者 sata硬盘上

 

 

 

 

 

 

 

 

 

再次创建卷

 

 

 

使用 nfs 作为存储

[root@cinder test]# yum -y install nfs-utils rpcbind

 

设置共享目录

[root@cinder test]# vim /etc/exports                             
/opt/nfsdata            10.20.1.0/24(rw,sync,no_root_squash,no_all_squash)

 

启动

[root@cinder test]# systemctl enable  nfs  rpcbind
[root@cinder test]# systemctl start nfs rpcbind

 

修改 cinder-volume 配置文件,支持nfs

[root@cinder test]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@controller
auth_strategy = keystone
my_ip = 10.20.1.186
enabled_backends = ssd, sata, nfs
glance_api_servers = http://controller:9292
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]
[ssd]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-ssd
target_protocol = iscsi
target_helper = lioadm
volume_backend_name = ssd
[sata]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-sata
target_protocol = iscsi
target_helper = lioadm
volume_backend_name = sata
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config=/etc/cinder/nfs_shares
volume_backend_name=nfs
nfs_qcow2_volumes=True
[root@cinder test]# volume_backend_name^C
[root@cinder test]# cat /etc/cinder/cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@controller
auth_strategy = keystone
my_ip = 10.20.1.186
enabled_backends = ssd, sata, nfs
glance_api_servers = http://controller:9292
[backend]
[backend_defaults]
[barbican]
[brcd_fabric_example]
[cisco_fabric_example]
[coordination]
[cors]
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[fc-zone-manager]
[healthcheck]
[key_manager]
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS
[nova]
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[oslo_reports]
[oslo_versionedobjects]
[privsep]
[profiler]
[sample_castellan_source]
[sample_remote_file_source]
[service_user]
[ssl]
[vault]
[ssd]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-ssd
target_protocol = iscsi
target_helper = lioadm
volume_backend_name = ssd
[sata]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-sata
target_protocol = iscsi
target_helper = lioadm
volume_backend_name = sata
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config=/etc/cinder/nfs_shares
volume_backend_name=nfs
nfs_qcow2_volumes=True

 

 

创建/etc/cinder/nfs_shares配置文件

[root@cinder test]# cat /etc/cinder/nfs_shares 
10.20.1.186:/opt/nfsdata

 

重启cinder-volume 和 target

systemctl restart openstack-cinder-volume.service target.service

 

控制节点查看,nfs

[root@controller ~]# cinder service-list
+------------------+-------------+------+---------+-------+----------------------------+---------+-----------------+---------------+
| Binary           | Host        | Zone | Status  | State | Updated_at                 | Cluster | Disabled Reason | Backend State |
+------------------+-------------+------+---------+-------+----------------------------+---------+-----------------+---------------+
| cinder-scheduler | controller  | nova | enabled | up    | 2022-07-13T05:56:35.000000 | -       | -               |               |
| cinder-volume    | cinder@nfs  | nova | enabled | up    | 2022-07-13T05:56:39.000000 | -       | -               | up            |
| cinder-volume    | cinder@sata | nova | enabled | up    | 2022-07-13T05:56:35.000000 | -       | -               | up            |
| cinder-volume    | cinder@ssd  | nova | enabled | up    | 2022-07-13T05:56:35.000000 | -       | -               | up            |
+------------------+-------------+------+---------+-------+----------------------------+---------+-----------------+---------------+

 

 

 

 

 

 

 

 

posted @ 2022-07-12 13:28  fengjian1585  阅读(1415)  评论(0编辑  收藏  举报