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
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  ##创建数据库
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@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 修改配置

1
2
3
4
5
[root@hequan cinder(keystone_admin)] # cinder list
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
| ID | Status | Migration Status | Name | Size | Volume Type | Bootable | Multiattach | Attached to |
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+
+----+--------+------------------+------+------+-------------+----------+-------------+-------------+



1
2
3
4
5
6
创建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


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@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    |             |
+--------------------------------------+-----------+------------------+------+------+-------------+----------+-------------+-------------+
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@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



1
2
3
4
5
6
更换名字
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



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  -m   u:cinder:r--    /etc/ceph/ceph .client.admin.keyring   ##cinder可读









本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1830981,如需转载请自行联系原作者
目录
相关文章
|
6月前
|
存储 消息中间件 数据库
云计算|OpenStack|社区版OpenStack安装部署文档(八--- 存储服务cinder的安装部署---Rocky版)
云计算|OpenStack|社区版OpenStack安装部署文档(八--- 存储服务cinder的安装部署---Rocky版)
259 0
|
2月前
|
存储 消息中间件 算法
深入解析OpenStack Cinder:块存储服务详解
本文介绍了OpenStack及其块存储服务Cinder。OpenStack是一个开源云计算管理平台,提供基础设施即服务(IaaS),核心服务包括计算、网络、存储等。Cinder主要用于为虚拟机提供持久性块存储,具备多种功能,如卷操作、备份、快照及与实例的交互等。此外,还详细介绍了Cinder的工作流程、命令行操作及不同存储插件的使用。
293 8
|
3月前
|
存储 网络性能优化 块存储
OpenStack的块存储卷管理创建与配置
【8月更文挑战第27天】
73 3
|
3月前
|
存储 固态存储 网络性能优化
OpenStack的块存储(Cinder)
【8月更文挑战第24天】
91 2
|
3月前
|
存储 API 调度
OpenStack核心组件Cinder
【8月更文挑战第4天】
91 9
|
6月前
|
存储 运维 Swift
openstack cinder、swift运维命令
Cinder是OpenStack的块存储服务,提供虚拟机块设备功能,包括卷的创建、挂载等。它由cinder-api、cinder-scheduler和cinder-volume三个组件构成,前者处理请求,中间者负责调度,后者执行卷管理。Swift是OpenStack的分布式对象存储服务,高可用、持久性,适用于大文件存储。Swift架构对称,无单点故障,提供类似文件系统的简单逻辑和高效读写。Cinder关注虚拟机层面的块存储,而Swift则提供对象存储服务。命令示例展示了如何使用cinder和openstack命令操作云硬盘和Swift容器。
133 0
|
API 数据库
(九)Open Stack(M)--- Heat安装和配置
(九)Open Stack(M)--- Heat安装和配置
141 0
|
存储 API 数据库
(八)Open Stack(M)---Cinder安装和配置
(八)Open Stack(M)---Cinder安装和配置
116 0
|
存储 Swift 对象存储
(七)Open Stack(M)---- Swift安装和配置(下)
(七)Open Stack(M)---- Swift安装和配置(下)
80 0
|
存储 API Swift
(七)Open Stack(M)---- Swift安装和配置(上)
(七)Open Stack(M)---- Swift安装和配置(上)
80 0