Openstack Newton Install Guide - Cinder
目录:
Install and configure controller node
第一步:数据库配置
$ 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';
第二步:创建cinder账号
$ . admin-openrc
$ openstack user create --domain default --password-prompt cinder
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 0dbcdd0968dd4c948eacf9eb60d82b46 |
| name | cinder |
| password_expires_at | None |
+---------------------+----------------------------------+
$ openstack role add --project service --user cinder admin
$ openstack service create --name cinder \ --description "OpenStack Block Storage" volume +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Block Storage | | enabled | True | | id | ab3bbbef780845a1a283490d281e7fda | | name | cinder | | type | volume | +-------------+----------------------------------+
$ openstack service create --name cinderv2 \
--description "OpenStack Block Storage" volumev2
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Block Storage |
| enabled | True |
| id | eb9fd245bdbc414695952e93f29fe3ac |
| name | cinderv2 |
| type | volumev2 |
+-------------+----------------------------------+
第三步:创建cinder api endpoint
$ openstack endpoint create --region RegionOne \
volume public http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volume internal http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volume admin http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 public http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
volumev2 admin http://controller:8776/v2/%\(tenant_id\)s
第四步:安装cinder软件包
# apt install cinder-api cinder-scheduler
第五步:配置/etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@controller
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = CINDER_PASS
[DEFAULT]
my_ip = 10.0.0.11
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
第六步:初始化数据库
# su -s /bin/sh -c "cinder-manage db sync" cinder
第七步:重启服务
# service nova-api restart
# service cinder-scheduler restart
# service cinder-api restart
Install and configure a storage node
第一步:配置LVM
# apt install lvm2
# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created
第二步:配置/etc/lvm/lvm.conf
devices {
...
filter = [ "a/sda/", "a/sdb/", "r/.*/"]
第三步:安装cinder-volume
# apt install cinder-volume
第四步:配置/etc/cinder/cinder.conf
[database]
...
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder
[DEFAULT]
...
transport_url = rabbit://openstack:RABBIT_PASS@controller
[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = CINDER_PASS
[DEFAULT]
...
my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS
[lvm]
...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = tgtadm
volume_backend_name = lvm //主要这个backend_name非常重要
[DEFAULT]
...
enabled_backends = lvm
[DEFAULT]
...
glance_api_servers = http://controller:9292
[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp
第五步:重启服务
# service tgt restart
# service cinder-volume restart
Configure Compute to use Block Storage
第一步:配置/etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
第二步:重启nova-compute
service nova-compute restart
验证
第一步:查看服务
$ openstack volume service list
+------------------+------------+------+---------+-------+----------------------------+
| Binary | Host | Zone | Status | State | Updated_at |
+------------------+------------+------+---------+-------+----------------------------+
| cinder-scheduler | controller | nova | enabled | up | 2016-09-30T02:27:41.000000 |
| cinder-volume | block@lvm | nova | enabled | up | 2016-09-30T02:27:46.000000 |
+------------------+------------+------+---------+-------+----------------------------+
第二步: 配置 volume type
# cinder type-create lvm
# cinder type-key lvm set volume_backend_name=lvm
第三步: 创建volume
root@server01:~# cinder create --volume-type lvm --name volume01 2
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2017-04-21T06:06:29.000000 |
| description | None |
| encrypted | False |
| id | 03af51df-92cc-47bb-92d9-1a605dec8a7f |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | volume01 |
| 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 | ab1cc38a13044a04acefe41897d6b836 |
| replication_status | disabled |
| size | 2 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| updated_at | None |
| user_id | e0fca99beba84e6bb9fe1e81647fe9df |
| volume_type | lvm |
+--------------------------------+--------------------------------------+
第四步:查看volume
root@server01:~# cinder list
+--------------------------------------+-----------+----------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+----------+------+-------------+----------+--------------------------------------+
| 03af51df-92cc-47bb-92d9-1a605dec8a7f | available | volume01 | 2 | lvm | false | | |
+--------------------------------------+-----------+----------+------+-------------+----------+--------------------------------------+