Block Storage

我理解的blockstorage

block Storage是对虚拟主机的扩展数据存储,总体分为对硬盘的扩展,和数据的存储。cinder是对扩展数据使用的服务,cinderAPI处理浏览器扩充硬盘的请求,cinder-sheduler将请求发送到消息队列中。cinder-volume根据scsi技术同步所有的请求到volume节点,volume通过lvm架构选举出一个cinder-volume节点创建扩展的硬盘。对扩展的硬盘进行格式化,并绑定到虚拟机的目录下。所有扩展的文件都将存储在这个目录下,扩展文件通过scsi技术返回到浏览器。

首先介绍lvm
scsi的介绍是做数据传输和同步的技术

启动一台云主机gaga:

查看主机开启的服务:[root@localhost ~]# nova-manage service list

打开gaga云主机的控制台:


• cinder-api: Accepts API requests and routes them to cinder-volume for action.
cinder-api处理从浏览器发出的扩展云盘的请求
• cinder-volume: Responds to requests to read from and write to the Block Storage database to maintain state, interacting with other processes (like cinder-scheduler) through a message queue and directly upon block storage providing hardware or software. It can interact with a variety of storage providers through a driver architecture.
cinder-volume创建具体的云盘,将创建完成的云盘返回到浏览器
• cinder-scheduler daemon: Like the nova-scheduler, picks the optimal block storage provider node on which to create the volume.
cinder-scheduler统一调度可以创建云盘的cinder-volume
• Messaging queue: Routes information between the Block Storage service processes.

安装cinder框架

[root@localhost ~]# yum install openstack-cindew

创建mysql数据库:


# mysql -u root -p
mysql> CREATE DATABASE cinder;
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'CINDER_DBPASS';
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'CINDER_DBPASS';

[root@localhost ~]# vi cinderconf.sh

penstack-config --set /etc/cinder/cinder.conf \
database connection mysql://cinder:CINDER_DBPASS@controller/cinder

[root@localhost ~]# sh cinderconf.sh 

[root@localhost ~]# vi /etc/cinder/cinder.conf


database connection mysql://cinder:CINDER_DBPASS@controller/cinder
# mysql -u root -p
mysql> CREATE DATABASE cinder;
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY 'CINDER_DBPASS';
mysql> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY 'CINDER_DBPASS';
 $ keystone user-create --name=cinder --pass=CINDER_PASS -- email=cinder@


4. Create the database tables for the Block Storage service:
# su -s /bin/sh -c "cinder-manage db sync" cinder
5. Create a cinder user.
The Block Storage service uses this user to authenticate with the Identity service. Use the service tenant and give the user the admin role:
6. Edit the /etc/cinder/cinder.conf configuration file:
   
 # openstack-config --set /etc/cinder/cinder.conf \

创建cinder数据库并为cinder数据库授权,这样当每次操作 cinder的时候,都会在cinder数据库中保留操作信息

创建cinder服务,并对外显示接口

$ keystone service-create --name=cinder --type=volume --description= "OpenStack Block Storage"
$ keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ volume / {print $2}') \ --publicurl=http://controller:8776/v1/%\(tenant_id\)s \ --internalurl=http://controller:8776/v1/%\(tenant_id\)s \ --adminurl=http://controller:8776/v1/%\(tenant_id\)s
$ keystone service-create --name=cinderv2 --type=volumev2 --description= "OpenStack Block Storage v2"
$ keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ volumev2 / {print $2}') \ --publicurl=http://controller:8776/v2/%\(tenant_id\)s \ --internalurl=http://controller:8776/v2/%\(tenant_id\)s \ --adminurl=http://controller:8776/v2/%\(tenant_id\)s

 openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rpc_backend qpid
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT qpid_hostname controller

启动服务:


[root@localhost ~]# vi cinderservice.sh
service openstack-cinder-scheduler start 
 service openstack-cinder-api start
 service openstack-cinder-scheduler start 
 chkconfig openstack-cinder-api on
 chkconfig openstack-cinder-scheduler on

[root@localhost ~]# sh cinderservice.sh start
[root@localhost ~]# sh cinderservice.sh status
[root@localhost ~]# cinder service-list

安装cinder_volume节点

首先介绍lvm

为虚拟机添加一块50gb的新硬盘


[root@localhost ~]# fdisk -l
 pvcreate /dev/sdb
[root@localhost ~]# pas

 vgcreate cinder-volumes /dev/sdb
[root@localhost ~]# vgs

此时不配置filter,让所有的设备通过节点
yum install openstack-cinder scsi-target-utils
scsi的介绍是做数据传输和同步的技术

5. Copy the /etc/cinder/cinder.conf configuration file from the controller, or
perform the following steps to set the keystone credentials:
  devices {
...
filter = [ "a/sda1/", "a/sdb/", "r/.*/"]
...
}
   
# openstack-config --set /etc/cinder/cinder.conf DEFAULT \ auth_strategy keystone
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ auth_uri http://controller:5000
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ auth_host controller
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ auth_protocol http
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ auth_port 35357
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ admin_user cinder
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ admin_tenant_name service
# openstack-config --set /etc/cinder/cinder.conf keystone_authtoken \ admin_password CINDER_PASS
6. Configure Block Storage to use the Qpid message broker:
7. Configure Block Storage to use your MySQL database. Edit the /etc/cinder/ cinder.conf file and add the following key to the [database] section. Replace CINDER_DBPASS with the password you chose for the Block Storage database:
 # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT rpc_backend qpid
# openstack-config --set /etc/cinder/cinder.conf \ DEFAULT qpid_hostname controller
 # openstack-config --set /etc/cinder/cinder.conf \
database connection mysql://cinder:CINDER_DBPASS@controller/cinder
   76
cehouse - Icehouse - Icehouse - Icehouse - Icehouse - Icehouse - Icehouse - Icehouse - Icehouse
OpenStack Installation Guide for November 20, 2014 icehouse Red Hat Enterprise Linux, CentOS,
and Fedora
8. In the [DEFAULT] section, configure the my_ip option:
Replace MANAGEMENT_INTERFACE_IP_ADDRESS with the IP address of the management network interface on your storage node, typically 10.0.0.41 for the first node in the example architecture.
9. Configure Block Storage to use the Image Service. Block Storage needs access to images to create bootable volumes. Edit the /etc/cinder/cinder.conf file and update the glance_host option in the [DEFAULT] section:
10. Configure Block Storage to use the tgtadm iSCSI service:
11. Configure the iSCSI target service to discover Block Storage volumes. Add the following line to the beginning of the /etc/tgt/targets.conf file, if it is not already present:
             include /etc/cinder/volumes/*
12. Start and configure the Block Storage services to start when the system boots:
Verify the Block Storage installation
To verify that the Block Storage is installed and configured properly, create a new volume.
For more information about how to manage volumes, see the 

节点的校验:


2. Use the cinder create command to create a new volume:
    # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT my_ip MANAGEMENT_INTERFACE_IP_ADDRESS
 # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT glance_host controller
 # openstack-config --set /etc/cinder/cinder.conf \ DEFAULT iscsi_helper tgtadm
 # service openstack-cinder-volume start # service tgtd start
# chkconfig openstack-cinder-volume on # chkconfig tgtd on
$ cinder create --display-name myVolume 1 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+
|     attachments     |
|  availability_zone  |
|       bootable      |
|      created_at     |
| display_description |
|     display_name    |
|      encrypted      |
|          id         | 5e691b7b-12e3-40b6-b714-7f17550db5d1 |
[root@localhost ~]# cinder list
[root@localhost ~]# cinder service-list

open stack使用创建的硬盘


排查不能绑定硬盘的故障:


把之前的硬盘删除,重新添加硬盘

对硬盘进行格式化

所有的文件最终将存储在/mnt/test目录下

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,126评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,254评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,445评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,185评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,178评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,970评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,276评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,927评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,400评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,883评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,997评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,646评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,213评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,204评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,423评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,423评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,722评论 2 345

推荐阅读更多精彩内容

  • 第一章 OpenStack基础 OpenStack管理的资源及提供的服务OpenStack做为一个操作系统,...
    sgt_tiger阅读 12,866评论 4 72
  • •王越:VMware存储API整理,比如核心的存储池与卷两者的CURD。可以参考:VMware in OpenSt...
    笨手笨脚越阅读 5,622评论 0 2
  • cinder是Openstack的Block Storage Service,在学习cinder之前,我们先练了解...
    drfung阅读 681评论 0 0
  • 寻找爱情的邹小姐 快看完了,虽然是言情类,但作者的文字功底比较深厚,很多的情景描写,很多的情感倾诉写的却是极好的。...
    叔影阅读 669评论 0 0
  • 人生有很多苦 思乡 就是其中一个 想到后天可以回家 避开这里扰乱的一切 心中雀跃不已 睡梦中 在考试 要回家 外面...
    专注的喵星人阅读 365评论 0 0