OpenStack塊存儲服務(cinder)爲虛擬機添加持久的存儲,塊存儲提供一個基礎設施爲了管理卷,以及和OpenStack計算服務交互,爲實例提供卷。此服務也會激活管理卷的快照和卷類型的功能。
塊存儲服務(cinder)爲實例提供塊存儲。存儲的分配和消耗是由塊存儲驅動器,或者多後端配置的驅動器決定的。還有不少驅動程序可用:NAS/SAN,NFS,ISCSI,Ceph等。
典型狀況下,塊服務API和調度器服務運行在控制節點上。取決於使用的驅動,卷服務器能夠運行在控制節點、計算節點或單獨的存儲節點。python
- cinder-api
接受API請求,並將其路由到cinder-volume
執行。- cinder-volume
與塊存儲服務和例如cinder-scheduler
的進程進行直接交互。它也能夠與這些進程經過一個消息隊列進行交互。cinder-volume
服務響應送到塊存儲服務的讀寫請求來維持狀態。它也能夠和多種存儲提供者在驅動架構下進行交互。- cinder-scheduler守護進程
選擇最優存儲提供節點來建立卷。其與nova-scheduler
組件相似。- cinder-backup守護進程
cinder-backup
服務提供任何種類備份捲到一個備份存儲提供者。就像cinder-volume
服務,它與多種存儲提供者在驅動架構下進行交互。- 消息隊列
在塊存儲的進程之間路由信息。
這個部分描述如何在控制節點上安裝和配置塊設備存儲服務,即 cinder。這個服務須要至少一個額外的存儲節點,以向實例提供卷。
mysql
新添加一塊磁盤sql
# fdisk /dev/sdb (而後輸入 n p 1 回車 回車 回車 w)
建立LVM物理邏輯卷/dev/sdb數據庫
# pvcreate /dev/sdb1
建立cinder-volumes邏輯卷組vim
# 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
配置數據庫api
# 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服務實體dom
# 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-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
# 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