openstack(九)cinder
mastesr:
yum install openstack-cinder python-cinderclient
/etc/cinder/cinder.conf
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
cat > /etc/cinder/cinder.conf <<EOF [DEFAULT] transport_url = rabbit://openstack:openstack@192.168.3.220 auth_strategy = keystone [keystone_authtoken] auth_uri = http://192.168.3.220:5000 auth_url = http://192.168.3.220:35357 memcached_servers = 192.168.3.220:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = cinder [database] connection = mysql+pymysql://cinder:cinder@192.168.3.220/cinder [oslo_concurrency] lock_path = /var/lib/cinder/tmp EOF
初始化cinder数据库
su -s /bin/sh -c "cinder-manage db sync" cinder && mysql -ucinder -pcinder -e "use cinder; show tables;"
cat /etc/nova/nova.conf (增加)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[cinder] os_region_name = RegionOne systemctl restart openstack-nova-api openstack-cinder-api openstack-cinder-scheduler systemctl enable openstack-cinder-api openstack-cinder-scheduler
创建服务与端点
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
openstack service create --name cinder --description "Openstack Block Storage" volumev2 openstack service create --name cinder --description "Openstack Block Storage" volumev3 openstack endpoint create --region RegionOne volumev2 public http://192.168.3.220:8776/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne volumev2 internal http://192.168.3.220:8776/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne volumev2 admin http://192.168.3.220:8776/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne volumev3 public http://192.168.3.220:8776/v3/%\(tenant_id\)s openstack endpoint create --region RegionOne volumev3 internal http://192.168.3.220:8776/v3/%\(tenant_id\)s openstack endpoint create --region RegionOne volumev3 admin http://192.168.3.220:8776/v3/%\(tenant_id\)s
================================================================================================
LVM节点(这里配置在控制器上)
安装并设置卡机启动
yum install -y lvm2 targetcli python-keystone openstack-cinder
systemctl enable lvm2-lvmetad && systemctl start lvm2-lvmetad
配置lvm卷
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
fdisk -l pvcreate /dev/sdb vgcreate cinder-volumes /dev/sdb (查看vgdisplay cinder-volumes )
vim /etc/lvm/lvm.conf (中){ sed -i 's#^devices {#& \n\tfilter = [ "a/sda/", "a/sdb/", "r/.*/"]#g' /etc/lvm/lvm.conf }
devices { (系统又lvm才这样操作,排除掉系统本身的lvm,控制器上也需要配)
......
filter = [ "a/sda/", "a/sdb/", "r/.*/"](存储节点,在控制器上需要配)
}
/etc/cinder/cinder.conf 增加
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[DEFAULT] verbose = True enabled_backends = lvm glance_host = http://192.168.3.220:9292 [lvm] volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_group = cinder-volumes iscsi_protocol = iscsi iscsi_helper = lioadm [backend_defaults] iscsci_ip_address = 192.168.3.220
重启服务
systemctl enable openstack-cinder-volume target && systemctl restart openstack-cinder-volume target
控制器查看卷
openstack volume service list
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步