设为首页 收藏本站
查看: 1399|回复: 0

[经验分享] openstack学习笔记九 cinder基础配置

[复制链接]

尚未签到

发表于 2018-6-1 08:09:34 | 显示全部楼层 |阅读模式
  cinder  就是     云硬盘
  

  配置cinder步骤
  1 安装软件包,然后到keystone注册
  创建必要的用户名 密码
                             服务
                             endpoint
  2 设置配置文件
yum install openstack-cinder  -y
keystone  user-create  --name  cinder  --pass  hequan
keystone  user-role-add --user   cinder  --role admin  --tennat  services
keystone  service-create  --name  cinder  --type volume  --description  cinderxxx

例子  关于cul
keystone service-list
| d1271040fa9144318a836a0b476d1e66 |   cinder   |    volume    |         Cinder Service         |
keystone  endpoint-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 |

keystone  endpoint-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@hequan cinder(keystone_admin)]# ls
api-paste.ini  policy.json    rootwrap.d
cinder.conf    rootwrap.conf  volumes
[root@hequan cinder(keystone_admin)]# cp cinder.conf cinder.conf.bak  ##备份
[root@hequan ~(keystone_admin)]# cp /usr/share/cinder/cinder-dist.conf  /etc/cinder/cinder.conf   ##复制配置文件
[root@hequan cinder(keystone_admin)]# chown root.cinder  cinder.conf  ##记得修改权限
[root@hequan cinder(keystone_admin)]# openstack-db --init -service cinder  --password hequan  --rootpw 123456  ##创建数据库[root@hequan cinder(keystone_admin)]# vim cinder.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@hequan cinder(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@hequan cinder(keystone_admin)]# systemctl  list-unit-files  | grep cinder
openstack-cinder-api.service                  enabled   ##用户接口
openstack-cinder-backup.service               enabled   ##备份
openstack-cinder-scheduler.service            enabled   ##调度
openstack-cinder-volume.service               enabled    ##后端存储 卷
[root@hequan cinder(keystone_admin)]# systemctl  is-active  openstack-cinder-api.service
active
[root@hequan cinder(keystone_admin)]# systemctl start openstack-cinder-api.service  openstack-cinder-backup.service  openstack-cinder-scheduler.service openstack-cinder-volume.service
[root@hequan cinder(keystone_admin)]# systemctl enable  openstack-cinder-api.service  openstack-cinder-backup.service  openstack-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 修改配置
[root@hequan cinder(keystone_admin)]# cinder list
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+  


创建VG
[root@hequan cinder(keystone_admin)]# pvcreate      /dev/xvdb
[root@hequan cinder(keystone_admin)]# vgcreate    cinder-volumes    /dev/xvdb
[root@hequan cinder(keystone_admin)]# vgs
  VG             #PV #LV #SN Attr   VSize  VFree
  cinder-volumes   1   0   0 wz--n- 20.60g 20.60g  

[root@hequan cinder(keystone_admin)]# cinder create --display-name  voll  1
+---------------------------------------+--------------------------------------+
|                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@hequan cinder(keystone_admin)]# 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中  作为单独字段
[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@hequan cinder(keystone_admin)]# lvs
  LV                                          VG             Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert                                       
  volume-7f778803-41cd-492f-b3b7-baa349b9c3dc cinder-volumes -wi-a-----  1.00g
  
  [root@hequan cinder(keystone_admin)]# lvscan
  ACTIVE            '/dev/cinder-volumes/volume-7f778803-41cd-492f-b3b7-baa349b9c3dc' [1.00 GiB] inherit  


更换名字
volume_group=vg0
[root@hequan cinder(keystone_admin)]# vgrename  cinder-volumes vg0       ##更改名字
[root@hequan ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-496785-1-1.html 上篇帖子: openstack部署实战第2版之Open vSwitch 下篇帖子: Openstack juno安装笔记与常见问题处理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表