安装配置cinder服务
controller节点
一、创建数据库
[[email protected] ~]# mysql -u root -p >>CREATE DATABASE cinder; >>GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘CINDER_DBPASS‘; >>GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘CINDER_DBPASS‘;
CINDER_DBPASS换成自己想要设置的密码
二、创建服务实体和api接口
[[email protected] ~]# source /root/admin-openrc.sh [[email protected] ~]# openstack user create --domain default --password-prompt cinder [[email protected] ~]# openstack role add --project service --user cinder admin [[email protected] ~]# openstack service create --name cinder --description "OpenStack Block Storage" volume [[email protected] ~]# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2 [[email protected] ~]# openstack endpoint create --region RegionOne volume public http://controller:8776/v1/%\(tenant_id\)s [[email protected] ~]# openstack endpoint create --region RegionOne volume internal [[email protected] ~]# openstack endpoint create --region RegionOne \ volume admin http://controller:8776/v1/%\(tenant_id\)s [[email protected] ~]# openstack endpoint create --region RegionOne \ volumev2 public http://controller:8776/v2/%\(tenant_id\)s [[email protected] ~]# openstack endpoint create --region RegionOne \ volumev2 internal http://controller:8776/v2/%\(tenant_id\)s [[email protected] ~]# openstack endpoint create --region RegionOne \ volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
三、安装cinder服务
[[email protected] ~]# yum install openstack-cinder
配置cinder服务
[[email protected] ~]# mv /etc/cinder/cinder.conf /etc/cinder/cinder.conf_bak [[email protected] ~]# vim /etc/cinder/cinder.conf [DEFAULT] rpc_backend = rabbit my_ip = 10.0.0.11 auth_strategy = keystone [database] connection = mysql+pymysql://cinder:[email protected]/cinder #改为自己的数据库密码 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS #改为rabbimq的密码 [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = CINDER_PASS #改为cinder服务的密码 [oslo_concurrency] lock_path = /var/lib/cinder/tmp
配置nova使用cinder
[[email protected] ~]# vim /etc/nova/nova.conf #增加以下内容 [cinder] os_region_name = RegionOne
重启nova-api服务
[[email protected] ~]# systemctl restart openstack-nova-api.service
启动cinder服务,并设置开机启动
[[email protected] ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service [[email protected] ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
storage 节点
改节点测试,我这里有两块磁盘,用第二块测试
一、安装配置lvm2
[[email protected] ~]# yum install lvm2 [[email protected] ~]# systemctl enable lvm2-lvmetad.service [[email protected] ~]# systemctl start lvm2-lvmetad.service
使用第二块磁盘/dev/sdb 穿件一个pv
[[email protected] ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created
在上面的pv上创建一个vg
[[email protected] ~]# vgcreate cinder-volumes /dev/sdb Volume group "cinder-volumes" successfully created
编辑lvm配置文件
[[email protected] ~]#vim /etc/lvm/lvm.conf devices { filter = [ "a/sdb/", "r/.*/"] #lvm可以扫描发现sdb,其他的分区都reject
二、安装配置cinder volume
[[email protected] ~]# yum install openstack-cinder targetcli
编辑cinder配置文件
[[email protected] ~]#mv /etc/cinder/cinder.conf /etc/cinder/cinder.conf_bak [[email protected] ~]#vim /etc/cinder/cinder.conf [DEFAULT] rpc_backend = rabbit auth_strategy = keystone my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS #改成管理网的ip 这里 10.0.0.41 enabled_backends = lvm glance_api_servers = http://controller:9292 [database] connection = mysql+pymysql://cinder:[email protected]/cinder #改成自己数据库密码 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS #改成自己rabbit密码 [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = cinder password = CINDER_PASS #改成自己cinder服务密码 [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
启动cinder相关服务,并添加开机启动
[[email protected] ~]# systemctl enable openstack-cinder-volume.service target.service [[email protected] ~]# systemctl start openstack-cinder-volume.service target.service
三、验证
在controller节点执行
[[email protected] ~]#source /root/admin-openrc.sh [[email protected] ~]# cinder service-list +------------------+--------------+------+---------+-------+----------------------------+-----------------+ | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +------------------+--------------+------+---------+-------+----------------------------+-----------------+ | cinder-scheduler | controller | nova | enabled | up | 2016-06-16T14:17:46.000000 | - | | cinder-volume | [email protected] | nova | enabled | up | 2016-06-16T14:17:00.000000 | - | | cinder-volume | [email protected] | nova | enabled | down | 2016-06-16T08:41:19.000000 | - | +------------------+--------------+------+---------+-------+----------------------------+-----------------+
我这里在compute2上做测试装了cinder服务,因为compute2没有启动,所以是down,cinder对时间同步有要求,时间不同步这里就显示down。
如果出现上面信息,表示成功。
对于创建网络,创建实例,创建卷,挂载卷,热迁移,待续.....
时间: 2024-11-05 10:42:54