其实看基础理论篇大家也可以看出来,cinder跟nova流程比较像,是这样的,nova为云主机提供了虚拟资源,cinder则是提供存储相关的资源,cinder的小伙伴叫swift,不过这个一般没人用了现在,之所以要部署cinder呢是因为需要用它来对接ceph,不过考虑到并不是所有人都想后端用分布式存储,所以这篇文章就写默认情况下cinder提供lvm存储的方式,需要对接ceph的小伙伴讲ceph对接里面需要修改的地方看清自行修改就可以了
前面说了,跟nova类似,那么肯定也有控制的跟干活的,控制的还是用总的控制节点,干活的就原来的计算节点吧,分工明确
yum install openstack-cinder -y
1.控制节点
一样,先弄数据库把表建了,其实操作多了大家也可以看出来不论什么服务,都是一套流程
mysql -uroot -pbfmq
CREATE 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;
quit
openstack user create --domain default --password-prompt cinder(会提示设置密码,如果出现os什么什么的报错就. admin-openrc下,因为你退出了环境变量不生效了)
openstack service create --name cinder --description "OpenStack Block Storage" volume
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack endpoint create --region RegionOne volume public http://controller01:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne volume internal http://controller01:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne volume admin http://controller01:8776/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev2 public http://controller01:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller01:8776/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller01:8776/v2/%\(tenant_id\)s
vim /etc/cinder/cinder.conf修改
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 60.34.30.11
[oslo_messaging_rabbit]
rabbit_host = controller01
rabbit_userid = rabbitmq
rabbit_password = bfmq
[database]
connection = mysql+pymysql://cinder:[email protected]/cinder
[keystone_authtoken]
auth_uri = http://controller01:5000
memcached_servers = controller01:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = bfmq
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
su -s /bin/sh -c "cinder-manage db sync" cinder
2.计算节点,注意这里就是你部署nova-computer的节点
vim /etc/nova/nova.conf添加
[cinder]
os_region_name = RegionOne
systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
3.存储节点,就是你提供真实物理存储设备的节点,我的跟计算节点是同节点
yum install lvm2 targetcli -y
systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service
pvcreate /dev/sdb(以后可以再创建pv向vg里加以扩大容量)
vgcreate cinder-volumes /dev/sdb
vim /etc/lvm/lvm.conf修改
filter = [ "a/sdb/", "r/.*/"](新加了pv就需要修改了)
vim /etc/cinder/cinder.conf修改
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 60.34.30.13
enabled_backends = lvm
glance_api_servers = http://controller01:9292
[oslo_messaging_rabbit]
rabbit_host = controller01
rabbit_userid = rabbitmq
rabbit_password = bfmq
[database]
connection = mysql+pymysql://cinder:[email protected]/cinder
[keystone_authtoken]
auth_uri = http://controller01:5000
memcached_servers = controller01:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = bfmq
[lvm]这些加到文件末尾即可
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
systemctl enable openstack-cinder-volume.service target.service
systemctl start openstack-cinder-volume.service target.service