天天看點

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:   備份建立的卷

openstack常用的存儲類型cinder
[root@harbor ~]# pvcreate /dev/vdb 
Physical volume "/dev/vdb" successfully created.

[root@harbor ~]# pvcreate  /dev/vdc
Physical volume "/dev/vdc"      

添加硬碟後預設,不能識别出來,通過以下指令實作

[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"      

添加過濾器

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上檢視服務資訊

openstack常用的存儲類型cinder

dashboard 登入

openstack常用的存儲類型cinder
openstack常用的存儲類型cinder

指定ssd 或者 sata硬碟上

openstack常用的存儲類型cinder
openstack常用的存儲類型cinder
openstack常用的存儲類型cinder

再次建立卷

openstack常用的存儲類型cinder

使用 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      
openstack常用的存儲類型cinder
openstack常用的存儲類型cinder
openstack常用的存儲類型cinder
openstack常用的存儲類型cinder

繼續閱讀