openstack学习笔记九 cinder基础配置
cinder 就是 云硬盘 配置cinder步骤 1 安装软件包,然后到keystone注册 创建必要的用户名 密码 服务 endpoint 2 设置配置文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 yum install openstack-cinder-y keystoneuser-create--namecinder--passhequan keystoneuser-role-add--usercinder--roleadmin--tennatservices keystoneservice-create--namecinder-- type volume--descriptioncinderxxx 例子关于cul keystoneservice-list |d1271040fa9144318a836a0b476d1e66|cinder|volume|CinderService| 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' [root@hequan~(keystone_admin)] #cd/etc/cinder/ [root@hequancinder(keystone_admin)] #ls api- paste .inipolicy.jsonrootwrap.d cinder.confrootwrap.confvolumes [root@hequancinder(keystone_admin)] #cpcinder.confcinder.conf.bak##备份 [root@hequan~(keystone_admin)] #cp/usr/share/cinder/cinder-dist.conf/etc/cinder/cinder.conf##复制配置文件 [root@hequancinder(keystone_admin)] #chownroot.cindercinder.conf##记得修改权限 [root@hequancinder(keystone_admin)] #openstack-db--init-servicecinder--passwordhequan--rootpw123456##创建数据库 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [root@hequancinder(keystone_admin)] #vimcinder.conf [DEFAULT] 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 [database] connection=mysql: //cinder :hequan@115.29.107.17 /cinder [keystone_authtoken] admin_tenant_name=services admin_user=cinder admin_password=hequan auth_host=115.29.107.17 auth_port=35357 auth_protocol=http [root@hequancinder(keystone_admin)] #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 ##把这些写到上面的配置文件里,通信用 [root@hequancinder(keystone_admin)] #systemctllist-unit-files|grepcinder openstack-cinder-api.serviceenabled ##用户接口 openstack-cinder-backup.serviceenabled ##备份 openstack-cinder-scheduler.serviceenabled ##调度 openstack-cinder-volume.serviceenabled ##后端存储卷 [root@hequancinder(keystone_admin)] #systemctlis-activeopenstack-cinder-api.service active [root@hequancinder(keystone_admin)] #systemctlstartopenstack-cinder-api.serviceopenstack-cinder-backup.serviceopenstack-cinder-scheduler.serviceopenstack-cinder-volume.service [root@hequancinder(keystone_admin)] #systemctlenableopenstack-cinder-api.serviceopenstack-cinder-backup.serviceopenstack-cinder-scheduler.serviceopenstack-cinder-volume.service 再创建一个cinderv2和上面一样 |8fe36f49892447679bc5433b21591906|cinderv2|volumev2|CinderServicev2| |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 修改配置 1 2 3 4 5 [root@hequancinder(keystone_admin)] #cinderlist +----+--------+------------------+------+------+-------------+----------+-------------+-------------+ |ID|Status|MigrationStatus|Name|Size|VolumeType|Bootable|Multiattach|Attachedto| +----+--------+------------------+------+------+-------------+----------+-------------+-------------+ +----+--------+------------------+------+------+-------------+----------+-------------+-------------+ 1 2 3 4 5 6 创建VG [root@hequancinder(keystone_admin)] #pvcreate/dev/xvdb [root@hequancinder(keystone_admin)] #vgcreatecinder-volumes/dev/xvdb [root@hequancinder(keystone_admin)] #vgs VG #PV#LV#SNAttrVSizeVFree cinder-volumes100wz--n-20.60g20.60g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [root@hequancinder(keystone_admin)] #cindercreate--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| +---------------------------------------+--------------------------------------+ [root@hequancinder(keystone_admin)] #cinderlist +--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+ |ID|Status|MigrationStatus|Name|Size|VolumeType|Bootable|Multiattach|Attachedto| +--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+ |7f778803-41cd-492f-b3b7-baa349b9c3dc|available|-|voll|1|-| false |False|| +--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ##添加到上面的配置cinder.conf中作为单独字段 [lvm] 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 [root@hequancinder(keystone_admin)] #lvs LVVGAttrLSizePoolOriginData%Meta%MoveLogCpy%SyncConvert volume-7f778803-41cd-492f-b3b7-baa349b9c3dccinder-volumes-wi-a-----1.00g [root@hequancinder(keystone_admin)] #lvscan ACTIVE '/dev/cinder-volumes/volume-7f778803-41cd-492f-b3b7-baa349b9c3dc' [1.00GiB]inherit 1 2 3 4 5 6 更换名字 volume_group=vg0 [root@hequancinder(keystone_admin)] #vgrenamecinder-volumesvg0##更改名字 [root@hequan~] #vgs VG #PV#LV#SNAttrVSizeVFree vg0120wz--n-20.60g9.60g 1 2 3 4 5 6 7 8 9 10 11 待测试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-mu:cinder:r-- /etc/ceph/ceph .client.admin.keyring ##cinder可读 本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1830981,如需转载请自行联系原作者