其实看基础理论篇大家也可以看出来,cinder跟nova流程比较像,是这样的,nova为云主机提供了虚拟资源,cinder则是提供存储相关的资源,cinder的小伙伴叫swift,不过这个一般没人用了现在,之所以要部署cinder呢是因为需要用它来对接ceph,不过考虑到并不是所有人都想后端用分布式存储,所以这篇文章就写默认情况下cinder提供lvm存储的方式,需要对接ceph的小伙伴讲ceph对接里面需要修改的地方看清自行修改就可以了
前面说了,跟nova类似,那么肯定也有控制的跟干活的,控制的还是用总的控制节点,干活的就原来的计算节点吧,分工明确yum install openstack-cinder -y
1.控制节点一样,先弄数据库把表建了,其实操作多了大家也可以看出来不论什么服务,都是一套流程mysql -uroot -pbfmqCREATE DATABASE cinder;GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'bfmq';GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'bfmq';GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'controller01' IDENTIFIED BY 'bfmq';flush privileges;quitopenstack user create --domain default --password-prompt cinder(会提示设置密码,如果出现os什么什么的报错就. admin-openrc下,因为你退出了环境变量不生效了)
openstack role add --project service --user cinder adminopenstack service create --name cinder --description "OpenStack Block Storage" volumeopenstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2openstack endpoint create --region RegionOne volume public http://controller01:8776/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne volume internal http://controller01:8776/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne volume admin http://controller01:8776/v1/%\(tenant_id\)sopenstack endpoint create --region RegionOne volumev2 public http://controller01:8776/v2/%\(tenant_id\)sopenstack endpoint create --region RegionOne volumev2 internal http://controller01:8776/v2/%\(tenant_id\)sopenstack endpoint create --region RegionOne volumev2 admin http://controller01:8776/v2/%\(tenant_id\)svim /etc/cinder/cinder.conf修改[DEFAULT]rpc_backend = rabbitauth_strategy = keystonemy_ip = 60.34.30.11[oslo_messaging_rabbit]
rabbit_host = controller01rabbit_userid = rabbitmqrabbit_password = bfmq[database]
connection = mysql+pymysql://cinder:bfmq@controller01/cinder[keystone_authtoken]
auth_url = http://controller01:5000memcached_servers = controller01:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = cinderpassword = bfmq[oslo_concurrency]
lock_path = /var/lib/cinder/tmpsu -s /bin/sh -c "cinder-manage db sync" cinder(各种info信息请忽略)
systemctl restart openstack-nova-api.servicesystemctl enable openstack-cinder-api.service openstack-cinder-scheduler.servicesystemctl start openstack-cinder-api.service openstack-cinder-scheduler.service2.计算节点,注意这里就是你部署nova-computer的节点
vim /etc/nova/nova.conf添加[cinder]os_region_name = RegionOnesystemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.servicesystemctl start openstack-cinder-api.service openstack-cinder-scheduler.service3.存储节点,就是你提供真实物理存储设备的节点,我的跟计算节点是同节点
yum install lvm2 targetcli -ysystemctl enable lvm2-lvmetad.servicesystemctl start lvm2-lvmetad.servicepvcreate /dev/sdb(以后可以再创建pv向vg里加以扩大容量)vgcreate cinder-volumes /dev/sdbvim /etc/lvm/lvm.conf修改filter = [ "a/sdb/", "r/.*/"](新加了pv就需要修改了)vim /etc/cinder/cinder.conf修改
[DEFAULT]rpc_backend = rabbitauth_strategy = keystonemy_ip = 60.34.30.13enabled_backends = lvmglance_api_servers = http://controller01:9292[oslo_messaging_rabbit]
rabbit_host = controller01rabbit_userid = rabbitmqrabbit_password = bfmq[database]
connection = mysql+pymysql://cinder:bfmq@controller01/cinder[keystone_authtoken]
auth_url = http://controller01:5000memcached_servers = controller01:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = cinderpassword = bfmq[lvm]这些加到文件末尾即可
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDrivervolume_group = cinder-volumesiscsi_protocol = iscsiiscsi_helper = lioadm[oslo_concurrency]
lock_path = /var/lib/cinder/tmpsystemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service