OpenStack kilo版(8) 部署cinder
直接将cinder服务和块设备都部署在controller节点上
在controller节点添加一块100G的块设备/dev/sdb
配置数据库
(root@localhost) [(none)]> CREATE DATABASE cinder;
Query OK, 1 row affected (0.02 sec)
(root@localhost) [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';
Query OK, 0 rows affected (0.10 sec)
(root@localhost) [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';
Query OK, 0 rows affected (0.00 sec)
(root@localhost) [(none)]> flush privileges ;
Query OK, 0 rows affected (0.04 sec)
配置cinder服务认证
创建cinder用户:
root@controller:~# openstack user create --password-prompt cinder
User Password:cinder
Repeat User Password:cinder
+----------+----------------------------------+
| Field | Value |
+----------+----------------------------------+
| email | None |
| enabled | True |
| id | cbdfbba062b6446dac61ca9b9ce67eb6 |
| name | cinder |
| username | cinder |
+----------+----------------------------------+
将admin角色添加给cinder用户:
root@controller:~# openstack role add --project service --user cinder admin
+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
| id | 63561476dd124bc1b6fe1e4f3cb7f3dc |
| name | admin |
+-------+----------------------------------+
创建cinder的服务实体:
root@controller:~# openstack service create --name cinder --description "OpenStack Block Storage" volume
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 91fafad225f1475c9b4596ec663a8d9e |
| name | cinder |
| type | volume |
+-------------+----------------------------------+
root@controller:~# openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | 53b6766c632b43d0ae442d6e07af5a03 |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
创建cinder服务的API endpoint:
root@controller:~# openstack endpoint create --publicurl http://controller:8776/v2/%\(tenant_id\)s --internalurl http://controller:8776/v2/%\(tenant_id\)s --adminurl http://controller:8776/v2/%\(tenant_id\)s --region RegionOne volume
+--------------+-----------------------------------------+
| Field | Value |
+--------------+-----------------------------------------+
| adminurl | http://controller:8776/v2/%(tenant_id)s |
| id | d9246387b6ec4f0f9a63e60c25b481f4 |
| internalurl | http://controller:8776/v2/%(tenant_id)s |
| publicurl | http://controller:8776/v2/%(tenant_id)s |
| region | RegionOne |
| service_id | 91fafad225f1475c9b4596ec663a8d9e |
| service_name | cinder |
| service_type | volume |
+--------------+-----------------------------------------+
root@controller:~# openstack endpoint create --publicurl http://controller:8776/v2/%\(tenant_id\)s --internalurl http://controller:8776/v2/%\(tenant_id\)s --adminurl http://controller:8776/v2/%\(tenant_id\)s --region RegionOne volumev2
+--------------+-----------------------------------------+
| Field | Value |
+--------------+-----------------------------------------+
| adminurl | http://controller:8776/v2/%(tenant_id)s |
| id | 7f4e8c7a9b794336a61013ce56ceb994 |
| internalurl | http://controller:8776/v2/%(tenant_id)s |
| publicurl | http://controller:8776/v2/%(tenant_id)s |
| region | RegionOne |
| service_id | 53b6766c632b43d0ae442d6e07af5a03 |
| service_name | cinderv2 |
| service_type | volumev2 |
+--------------+-----------------------------------------+
安装cinder-server
root@controller:~# apt-get install cinder-api cinder-scheduler python-cinderclient cinder-volume
配置cinder-server
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 10.0.0.200
[database]
connection = mysql://cinder:cinder@controller/cinder
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = openstack
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lock/cinder
初始化数据库:
root@controller:~# su -s /bin/sh -c "cinder-manage db sync" cinder
重启服务:
root@controller:~# service cinder-scheduler restart
cinder-scheduler stop/waiting
cinder-scheduler start/running, process 5420
root@controller:~# service cinder-api restart
cinder-api stop/waiting
cinder-api start/running, process 5444
删除Ubuntu自带的SQLit数据库:
root@controller:~# rm -f /var/lib/cinder/cinder.sqlite
块存储配置
创建新分区:将sdb整块盘建立一个分区:
root@controller:~# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x622b5756.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Command (m for help): p
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x622b5756
Device Boot Start End Blocks Id System
/dev/sdb1 2048 209715199 104856576 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
配置LVM的物理卷:
root@controller:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
root@controller:~# pvdisplay
--- Physical volume ---
PV Name /dev/sdb1
VG Name cinder-volumes
PV Size 100.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 25599
Free PE 25599
Allocated PE 0
PV UUID bLnc53-Yv3d-samm-nGLL-riM8-TyJc-xQn0i5
创建LVM的卷组cinder-volumes:
root@controller:~# vgcreate cinder-volumes /dev/sdb1
Volume group "cinder-volumes" successfully created
root@controller:~# vgdisplay
--- Volume group ---
VG Name cinder-volumes
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 100.00 GiB
PE Size 4.00 MiB
Total PE 25599
Alloc PE / Size 0 / 0
Free PE / Size 25599 / 100.00 GiB
VG UUID B623Af-5Uru-0S81-23Cr-XOZt-ZCkq-Wh42sf
配置LVM仅仅扫描含有cinder-volume的卷组
编辑/etc/lvm/lvm.conf,在devices部分,添加一个筛选器,仅仅允许/dev/sdb设备并拒绝所有其他设备:
devices {
...
filter = [ "a/sdb/", "r/.*/"]
安装cinder
由于都部署在controller节点上,可以忽略这步
root@controller:~# apt-get install -y cinder-volume python-mysqldb
配置cinder
/etc/cinder/cinder.conf 添加:
[DEFAULT]
#启用LVM作为后端存储系统
enabled_backends = lvm
#镜像服务运行的节点
glance_host = controller
#配置LVM驱动,卷组,iscsi的协议和helper:
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = tgtadm
重启服务:
root@controller:~# service tgt restart
tgt stop/waiting
tgt start/running, process 3785
root@controller:~# service cinder-volume restart
cinder-volume stop/waiting
cinder-volume start/running, process 3838
检查块存储服务启动的服务组件:
root@controller:~# cinder service-list
+------------------+----------------+------+---------+-------+----------------------------+-----------------+
| Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+------------------+----------------+------+---------+-------+----------------------------+-----------------+
| cinder-scheduler | controller | nova | enabled | up | 2019-08-27T03:43:37.000000 | None |
| cinder-volume | controller | nova | enabled | up | 2019-08-27T03:42:48.000000 | None |
| cinder-volume | controller@lvm | nova | enabled | up | 2019-08-27T03:43:33.000000 | None |
+------------------+----------------+------+---------+-------+----------------------------+-----------------+
卷的管理
创建1GB的一个卷:
root@controller:~# cinder create --name demo-volume1 1
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2019-08-27T03:44:20.000000 |
| description | None |
| encrypted | False |
| id | 2eea737f-6d26-48d9-b396-5c40062dc606 |
| metadata | {} |
| multiattach | False |
| name | demo-volume1 |
| 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 | e2fc7b33877b4d4e844d63b4343e9d14 |
| 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 | 5726ba166bea4c9b957ed227bfd26692 |
| volume_type | None |
+---------------------------------------+--------------------------------------+
查看可用的卷:
root@controller:~# cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 2eea737f-6d26-48d9-b396-5c40062dc606 | available | demo-volume1 | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
root@controller:~# nova volume-list
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| 2eea737f-6d26-48d9-b396-5c40062dc606 | available | | 1 | - | |
+--------------------------------------+-----------+--------------+------+-------------+-------------+
将卷添加到实例中:
root@controller:~# nova volume-attach demo1 2eea737f-6d26-48d9-b396-5c40062dc606
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdb |
| id | 2eea737f-6d26-48d9-b396-5c40062dc606 |
| serverId | 69eacd59-57dd-49b4-a310-b1cd98edd935 |
| volumeId | 2eea737f-6d26-48d9-b396-5c40062dc606 |
+----------+--------------------------------------+
root@controller:~# cinder list
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| 2eea737f-6d26-48d9-b396-5c40062dc606 | in-use | demo-volume1 | 1 | None | false | 69eacd59-57dd-49b4-a310-b1cd98edd935 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
root@controller:~# nova volume-list
+--------------------------------------+--------+--------------+------+-------------+--------------------------------------+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+--------+--------------+------+-------------+--------------------------------------+
| 2eea737f-6d26-48d9-b396-5c40062dc606 | in-use | | 1 | - | 69eacd59-57dd-49b4-a310-b1cd98edd935 |
+--------------------------------------+--------+--------------+------+-------------+--------------------------------------+
OpenStack kilo版(8) 部署cinder的更多相关文章
- OpenStack kilo版(1) 部署环境
硬件 VMware workstation虚拟机 Ubuntu14.04操作系统 虚拟机网络规划 管理网络: eth0, 桥接模式 10.0.0.0/24 外部网络: eth1, nat模式(需要关闭 ...
- OpenStack kilo版(7) 部署dashboard
安装dashboard root@controller:~# apt-get install openstack-dashboard 配置 /etc/openstack-dashboard/loc ...
- OpenStack Kilo版加CEPH部署手册
OpenStack Kilo版加CEPH部署手册 作者: yz联系方式: QQ: 949587200日期: 2015-7-13版本: Kilo 转载地址: http://mp.weixin.qq.co ...
- CentOS7安装OpenStack(Rocky版)-09.安装Cinder存储服务组件(控制节点)
本文分享openstack的Cinder存储服务组件,cinder服务可以提供云磁盘(卷),类似阿里云云盘 ----------------------- 完美的分隔线 -------------- ...
- OpenStack kilo版(5) Neutron部署
neutron简介: Neutron 通过 plugin 和 agent 提供的网络服务. plugin 位于 Neutron server,包括 core plugin 和 service plug ...
- OpenStack kilo版(4) Glance部署
Glance简介 Glance-api:接受云系统镜像的构建.删除.读取请求 Glance-Registry:云系统的镜像注册服务 部署在controller节点 配置数据库 MariaDB [(no ...
- OpenStack kilo版(3) Nova部署
部署在controller和compute节点 配置数据库 MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 row affected ( ...
- OpenStack kilo版(2) keystone部署
部署在controller节点 配置数据库 MariaDB [(none)]> CREATE DATABASE keystone; Query OK, 1 row affected (0.00 ...
- OpenStack Train版 简单部署流程
environment 1.网络平面 management(管理网络)→软件安装,组件通信 provider(提供实例网络)→:提供者网络:直接获取ip地址,实例之间直接互通 自服务网络(私有网络 ...
随机推荐
- MFC加载大型osg模型
MFC加载模型,发现打开 Navid 缓冲等选项后,加载大型模型的速度就快了很多. #include "stdafx.h" #include "OSGObject.h&q ...
- 算法习题---5-5复合词(UVa10391)
一:题目 输入一系列由小写字母组成的单词.输入已按照字典序排序,且不超过120000个.找出所有的复合词,即恰好由两个单词连接而成的单词 (一)样例输入 a alien born less lien ...
- Hashset(不能添加相同的字符进入数组)
参考: https://ke.qq.com/webcourse/index.html#cid=434021&term_id=100518216&taid=377652179413386 ...
- 石子合并 区间DP模板题
题目链接:https://vjudge.net/problem/51Nod-1021 题意 N堆石子摆成一条线.现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆石子合并成新的一堆,并将新的一堆石 ...
- 高级UI-自定义动画框架
有的时候会需要做一些自定义的动画效果,在会反复用到的动画效果可以考虑做成动画框架,方便使用,做成框架的话就需要考虑很多的问题,最典型的问题就是属性和方法必须要是可配置的,这里就来聊一聊自定义动画框架的 ...
- Django 之memcached的应用
memcached介绍: memcached之前是danga的一个项目,最早是为LiveJournal服务的,当初设计师为了加速LiveJournal访问速度而开发的,后来被很多大型项目采用.官网是w ...
- 微信小程序bug集
bug1:navigator标签无法跳转,控制台不报错,解决方案如图
- social engineering toolkit
1. freebuf介绍 http://www.freebuf.com/sectool/73409.html 2. github https://github.com/trustedsec/socia ...
- Makefile中宏定义
实际上是gcc命令支持-D宏定义,相当于C中的全局#define: gcc -D name gcc -D name=definition Makefile中可以定义变量(和宏很像),但是是给make解 ...
- mysql 5.7 停电导致无法启动、如何备份数据,重新安装mysql
用于记录服务器停电导致,mysql启动失败后,如何备份数据,重新安装mysql,主要分为数据备份,mysql重新安装. 1.mysql无法启动时,进行数据备份. 执行:systemctl start ...