openstack学习笔记九 cinder基础配置
cinder就是 云硬盘配置cinder步骤
1 安装软件包,然后到keystone注册
创建必要的用户名 密码
服务
endpoint
2 设置配置文件
yum install openstack-cinder-y
keystoneuser-create--namecinder--passhequan
keystoneuser-role-add --user cinder--role admin--tennatservices
keystoneservice-create--namecinder--type volume--descriptioncinderxxx
例子关于cul
keystone service-list
| d1271040fa9144318a836a0b476d1e66 | cinder | volume | Cinder Service |
keystoneendpoint-list| grep d1271040fa9144318a836a0b476d1e66
| 8e18c46fc51c4a6287ea740a37537a59 | RegionOne | http://115.29.107.17:8776/v1/%(tenant_id)s | http://115.29.107.17:8776/v1/%(tenant_id)s | http://115.29.107.17:8776/v1/%(tenant_id)s | d1271040fa9144318a836a0b476d1e66 |
keystoneendpoint-create --service-id d1271040fa9144318a836a0b476d1e66--publicul 'http://115.29.107.17:8776/v1/%(tenant_id)s'--internalurl 'http://115.29.107.17:8776/v1/%(tenant_id)s' --adminurl 'http://115.29.107.17:8776/v1/%(tenant_id)s'
# cd /etc/cinder/
# ls
api-paste.inipolicy.json rootwrap.d
cinder.conf rootwrap.confvolumes
# cp cinder.conf cinder.conf.bak##备份
# cp /usr/share/cinder/cinder-dist.conf/etc/cinder/cinder.conf ##复制配置文件
# chown root.cindercinder.conf##记得修改权限
# openstack-db --init -service cinder--password hequan--rootpw 123456##创建数据库# vim cinder.conf
logdir = /var/log/cinder
state_path = /var/lib/cinder
lock_path = /var/lib/cinder/tmp
volumes_dir = /etc/cinder/volumes
iscsi_helper = lioadm
rootwrap_config = /etc/cinder/rootwrap.conf
auth_strategy = keystone
connection = mysql://cinder:hequan@115.29.107.17/cinder
admin_tenant_name = services
admin_user = cinder
admin_password = hequan
auth_host = 115.29.107.17
auth_port = 35357
auth_protocol = http
# grep ^rabbit/etc/keystone/keystone.conf
rabbit_host = localhost
rabbit_port = 5672
rabbit_hosts = localhost:5672
rabbit_use_ssl = False
rabbit_userid = guest
rabbit_password = guest
rabbit_virtual_host = /
rabbit_ha_queues = False ##把这些写到上面的配置文件里,通信用
# systemctllist-unit-files| grep cinder
openstack-cinder-api.service enabled ##用户接口
openstack-cinder-backup.service enabled ##备份
openstack-cinder-scheduler.service enabled ##调度
openstack-cinder-volume.service enabled ##后端存储 卷
# systemctlis-activeopenstack-cinder-api.service
active
# systemctl start openstack-cinder-api.serviceopenstack-cinder-backup.serviceopenstack-cinder-scheduler.service openstack-cinder-volume.service
# systemctl enableopenstack-cinder-api.serviceopenstack-cinder-backup.serviceopenstack-cinder-scheduler.service openstack-cinder-volume.service
再创建一个cinderv2和上面一样
| 8fe36f49892447679bc5433b21591906 |cinderv2| volumev2 | Cinder Service v2 |
| 75a8f5bbf35a42a0bfcd2e6a0d4cea9c | RegionOne | http://115.29.107.17:8776/v2/%(tenant_id)s | http://115.29.107.17:8776/v2/%(tenant_id)s | http://115.29.107.17:8776/v2/%(tenant_id)s | 8fe36f49892447679bc5433b21591906 |
2 修改配置
# cinder list
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
创建VG
# pvcreate /dev/xvdb
# vgcreate cinder-volumes /dev/xvdb
# vgs
VG #PV #LV #SN Attr VSizeVFree
cinder-volumes 1 0 0 wz--n- 20.60g 20.60g
# cinder create --display-namevoll1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-07-27T15:14:07.000000 |
| description | None |
| encrypted | False |
| id | 7f778803-41cd-492f-b3b7-baa349b9c3dc |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | voll |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | ddac36f63e4547e0a8619574dbc41534 |
| os-volume-replication:driver_data | None |
| os-volume-replication:extended_status | None |
| replication_status | disabled |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| user_id | 9382216e2ea540a2af70216577dbed00 |
| volume_type | None |
+---------------------------------------+--------------------------------------+
# cinder list
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status| Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
| 7f778803-41cd-492f-b3b7-baa349b9c3dc | available | - | voll |1 | - |false | False | |
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+##添加到上面的配置 cinder.conf中作为单独字段
iscsi_helper=lioadm
volume_group=cinder-volumes ##那个组决定默认存储
iscsi_ip_address=115.29.107.17
volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver##云硬盘默认存储LVM
volumes_dir=/var/lib/cinder/volumes
iscsi_protocol=iscsi
volume_backend_name=lvm
# lvs
LV VG Attr LSizePool Origin Data%Meta%Move Log Cpy%Sync Convert
volume-7f778803-41cd-492f-b3b7-baa349b9c3dc cinder-volumes -wi-a-----1.00g
# lvscan
ACTIVE '/dev/cinder-volumes/volume-7f778803-41cd-492f-b3b7-baa349b9c3dc' inherit
更换名字
volume_group=vg0
# vgrenamecinder-volumes vg0 ##更改名字
# vgs
VG #PV #LV #SN Attr VSizeVFree
vg0 1 2 0 wz--n- 20.60g 9.60g
待测试 ceph做后端存储具体ceph配置 可看我前一篇glance
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_pool = cinder#ceph 卷名字
rbd_ceph_conf = /etc/ceph/ceph.conf
rbd_flatten_volume_from_snapshot = false
rbd_max_clone_depth = 5
rbd_stone_chunk_size = 4
rados_connect_timeout = -1
glance_api_version = 2
setfacl-m u:cinder:r-- /etc/ceph/ceph.client.admin.keyring##cinder可读
页:
[1]