问题导读:
1.Cinder安装需要哪些步骤?
2.endpoint有哪些参数,你认为它的作用是什么?
3.如何检测cinder服务是否正常?
扩展
4.你认为配置文件的作用是什么?
在Unitestack的UOS下测试,看来今天要把cinder装上才行。老外的文档还没出来,我就只能对着官方文档,慢慢整理。
采用单独的存储节点作为存储.
控制节点
在控制节点上,我们需要安装cinder api和schedule两个服务.
- apt-get -y install cinder-api cinder-scheduler
复制代码
创建数据库
- CREATE DATABASE cinder;
- GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'CINDER_DBPASS';
- GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'CINDER_DBPASS';
- exit;
复制代码
创建用户
- keystone user-create --name=cinder --pass=service_pass --email=cinder@domain.com
- keystone user-role-add --user=cinder --tenant=service --role=admin
复制代码
endpoint
- 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://10.0.0.11:8776/v1/%\(tenant_id\)s \
- --internalurl=http://10.0.0.11:8776/v1/%\(tenant_id\)s \
- --adminurl=http://10.0.0.11: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://10.0.0.11:8776/v2/%\(tenant_id\)s \
- --internalurl=http://10.0.0.11:8776/v2/%\(tenant_id\)s \
- --adminurl=http://10.0.0.11:8776/v2/%\(tenant_id\)s
复制代码
修改配置文件 /etc/cinder.conf
- [DEFAULT]
- rootwrap_config = /etc/cinder/rootwrap.conf
- api_paste_confg = /etc/cinder/api-paste.ini
- iscsi_helper = tgtadm
- volume_name_template = volume-%s
- volume_group = cinder-volumes
- verbose = True
- auth_strategy = keystone
- state_path = /var/lib/cinder
- lock_path = /var/lock/cinder
- volumes_dir = /var/lib/cinder/volumes
-
- rpc_backend = cinder.openstack.common.rpc.impl_kombu
- rabbit_host = 10.0.0.11
- rabbit_port = 5672
- rabbit_userid = guest
- rabbit_password = guest
-
-
-
- [database]
- connection = mysql://cinder:CINDER_DBPASS@10.0.0.11/cinder
-
-
- [keystone_authtoken]
- auth_uri = http://10.0.0.11:5000
- auth_host = 10.0.0.11
- auth_port = 35357
- auth_protocol = http
- admin_tenant_name = service
- admin_user = cinder
- admin_password = service_pass
复制代码
同步数据库
复制代码
重启服务
- service cinder-scheduler restart
- service cinder-api restart
复制代码
存储节点
创建一个虚拟机,只需要1块网卡就可以,接入到管理网络里就可以。
存储节点的IP为:10.0.0.41,不过我们需要上网安装软件,所以把虚拟机接入到外部网络,装完后,可以断掉。创建1块100G的云硬盘,作为cinder volume使用。
升级内核
- apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade
复制代码
安装lvm工具
复制代码
安装iscsi软件
- apt-get -y install iscsitarget open-iscsi iscsitarget-dkms
复制代码
最新版本的内核有冲突,内核版本要降级。
- apt-get install linux-headers-3.13.0-32-generic
复制代码
配置iscsi服务
- sed -i 's/false/true/g' /etc/default/iscsitarget
复制代码
重启服务
- service iscsitarget start
- service open-iscsi start
复制代码
同步时间
复制代码
编辑 /etc/ntp.conf
复制代码
重启NTP服务
复制代码
安装python-mysqldb,因为需要通过python去连接数据库
- apt-get install python-mysqldb
复制代码
创建cinder-volumes卷
- pvcreate /dev/vdb
- vgcreate cinder-volumes /dev/vdb
复制代码
编辑 /etc/lvm/lvm.conf 添加一个filter
- # By default we accept every block device:
- filter = [ "a/.*/" ]
- filter = [ "a/vda1/", "a/vdb/", "r/.*/"]
复制代码
安装cinder
- apt-get -y install cinder-volume
复制代码
编辑 /etc/cinder/cinder.conf , 和控制节点区别就在多了一个glance host的设置
- [DEFAULT]
- rootwrap_config = /etc/cinder/rootwrap.conf
- api_paste_confg = /etc/cinder/api-paste.ini
- iscsi_helper = tgtadm
- volume_name_template = volume-%s
- volume_group = cinder-volume
- verbose = True
- auth_strategy = keystone
- state_path = /var/lib/cinder
- lock_path = /var/lock/cinder
- volumes_dir = /var/lib/cinder/volumes
-
- glance_host = 10.0.0.11
-
- rpc_backend = cinder.openstack.common.rpc.impl_kombu
- rabbit_host = 10.0.0.11
- rabbit_port = 5672
- rabbit_userid = guest
- rabbit_password = guest
-
-
-
- [database]
- connection = mysql://cinder:CINDER_DBPASS@10.0.0.11/cinder
-
-
- [keystone_authtoken]
- auth_uri = http://10.0.0.11:5000
- auth_host = 10.0.0.11
- auth_port = 35357
- auth_protocol = http
- admin_tenant_name = service
- admin_user = cinder
- admin_password = service_pass
复制代码
重启服务
- service cinder-volume restart
- service tgt restart
复制代码
验证
检测cinder服务是否正常
- # cinder service-list
- +------------------+------------+------+---------+-------+----------------------------+
- | Binary | Host | Zone | Status | State | Updated_at |
- +------------------+------------+------+---------+-------+----------------------------+
- | cinder-scheduler | controller | nova | enabled | up | 2014-09-04T17:13:28.000000 |
- | cinder-volume | cinder | nova | enabled | up | 2014-09-04T17:13:27.000000 |
- +------------------+------------+------+---------+-------+----------------------------+
复制代码
创建一个卷
- cinder list
- cinder create --display-name myVolume 1
复制代码
http://www.chenshake.com/openstack-cinder-installation-guide/
|