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地址,实例之间直接互通 自服务网络(私有网络 ...
随机推荐
- Source Insight解决回车缩进过多问题
摘自:https://jingyan.baidu.com/article/02027811339e651bcc9ce53c.html 新安装的Source Insight软件在编写代码时,回车换行 ...
- 【445】Markdown Syntax
ref: Markdown基本语法 ref: Markdown Guide ref: Markdown Cheatsheet ref: Markdown Tutorial Lists Basic Sy ...
- Java EE互联网轻量级框架整合开发— SSM框架(中文版带书签)、原书代码
Java EE互联网轻量级框架整合开发 第1部分 入门和技术基础 第1章 认识SSM框架和Redis 2 1.1 Spring框架 2 1.2 MyBatis简介 6 1.3 Spring MVC简介 ...
- 使用Docker在本地启动3个MySQL镜像
首先执行 sudo docker pull mysql 命令下载mysql官方镜像: zifeiy@zifeiy-PC:~$ sudo docker pull mysql Using default ...
- selenium3+Python3+sublime text3自动化登录
前言: 对于初学者来说,python自带的IDLE,精简又方便,不过一个好的编辑器能让python编码变得更方便,更加优美些. 不过呢,也可以自己去下载其他更好用的代码编辑器,在这推荐: PyChar ...
- 初步了解 Netty
精通并发与 Netty (一)如何使用 精通并发与 Netty Netty 是一个异步的,事件驱动的网络通信框架,用于高性能的基于协议的客户端和服务端的开发. 异步指的是会立即返回,并不知道到底发送过 ...
- 爬虫存储介质之CSV文件存储
本文章来自度娘 CSV文件存储 CSV,全称为Comma-Separated Values,中文可以叫做逗号分隔值或字符分隔值,其文件以纯文本形式 存储表格数据.该文件是一个字符序列,可以由任意数目的 ...
- linux CentOS7 安装字体库-转
前言 报表中发现有中文乱码和中文字体不整齐(重叠)的情况,首先考虑的就是操作系统是否有中文字体,在CentOS 7中发现输入命令查看字体列表是提示命令无效: 如上图可以看出,不仅没有中文字体,连字体库 ...
- 个人PC电脑 关闭网卡自启
前言: 今早我打开我的电脑,惊呆了.出现了以下字样: This Product is covered by one or more of the following patents ... 看了BIO ...
- 将自己的项目作为jar包发布到maven中央仓库
maven版本是3.5.0,jdk是1.8(注意,不是说项目是1.8就行,必须是环境变量里的也是,不能超过1.8,否则一大堆问题,执行mvn前用javac -version看下版本) 一:先在sona ...