cinder分布式搭建

做实验过程中随手记下,直接无节操上传:

环境:2台linux机器
ubuntu 12.04.1
kvm-controller 172.16.7.53
kvm-compute4 172.16.7.54
openstack FLAT网络模式 multi-host

1.增加keystone中cinder认证
#keystone tenant-list
+----------------------------------+-------------+---------+
|                id                |     name    | enabled |
+----------------------------------+-------------+---------+
| df6ed0ac5e7e43b2aafc9c8daaeb092a |    admin    |   True  |
| 39acb6de9d8846eabe6a8e0e5aae32df | project_one |   True  |
| 68960b568ef34234a844124ebd4dd101 |   service   |   True  |
+----------------------------------+-------------+---------+

#keystone user-list
+----------------------------------+----------+---------+---------------------------+
|                id                |   name   | enabled |           email           |
+----------------------------------+----------+---------+---------------------------+
| 737d8223af3b45c58dd36a15fcd9ac91 |  admin   |   True  |      [email protected]     |
| deca22e7c8044ab1ab310fee4d1f8e8a |  glance  |   True  |     [email protected]     |
| 18aaca6f65c04cdba8c24d264340ece5 |   nova   |   True  |      [email protected]      |
| 688b3ff3316d46d6af087c655e553a75 | user_one |   True  | [email protected] |
+----------------------------------+----------+---------+---------------------------+

#keystone role-list
+----------------------------------+----------------------+
|                id                |         name         |
+----------------------------------+----------------------+
| 8fd89eb258c34ad1ac185ca8122d0dfa |    KeystoneAdmin     |
| a7383ebc7bff40949761998a0d766912 | KeystoneServiceAdmin |
| 2361cfd5095e443f9680a085d28d22ca |        Member        |
| 9fe2ff9ee4384b1894a90878d3e92bab |       _member_       |
| 913bfd4a27cd409aa564bb3c540c8272 |        admin         |
+----------------------------------+----------------------+

#keystone user-create --name=cinder --pass="service_pass" --tenant-id 68960b568ef34234a844124ebd4dd101 [email protected]
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |        [email protected]         |
| enabled  |               True               |
|    id    | 30ec06d902934e84811453c9fba5ba2f |
|   name   |              cinder              |
| tenantId | 68960b568ef34234a844124ebd4dd101 |
+----------+----------------------------------+

#keystone user-role-add --tenant-id 68960b568ef34234a844124ebd4dd101 --user-id $CINDER_USER_ID --role-id 913bfd4a27cd409aa564bb3c540c8272

#keystone service-create --name cinder --type volume --description 'OpenStack Volume Service'
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |     OpenStack Volume Service     |
|      id     | c2c9947892c1458d83dea970431d2c12 |
|     name    |              cinder              |
|     type    |              volume              |
+-------------+----------------------------------+

#keystone endpoint-create --region RegionOne --service-id $service_id --publicurl 'http://'172.16.7.53':8776/v1/$(tenant_id)s' --adminurl 'http://'172.16.7.53':8776/v1/$(tenant_id)s' --internalurl 'http://'172.16.7.53':8776/v1/$(tenant_id)s'
+-------------+------------------------------------------+
|   Property  |                  Value                   |
+-------------+------------------------------------------+
|   adminurl  | http://172.16.7.53:8776/v1/$(tenant_id)s |
|      id     |     b1607fe834594f21b0c526d7fa07e459     |
| internalurl | http://172.16.7.53:8776/v1/$(tenant_id)s |
|  publicurl  | http://172.16.7.53:8776/v1/$(tenant_id)s |
|    region   |                RegionOne                 |
|  service_id |     c2c9947892c1458d83dea970431d2c12     |
+-------------+------------------------------------------+

2.安装cinder
#sudo apt-get install cinder-api cinder-scheduler cinder-volume open-iscsi python-cinderclient tgt

#vi /etc/cinder/api-paste.ini
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
service_protocol = http
service_host = 172.16.7.53
service_port = 5000
auth_host = 172.16.7.53
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = cinder
admin_password = service_pass
signing_dir = /var/lib/cinder

#vi /etc/cinder/cinder.conf
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
sql_connection = mysql://cinderUser:[email protected]/cinder
api_paste_confg = /etc/cinder/api-paste.ini

iscsi_helper = tgtadm
volume_name_template = volume-%s
verbose = True
auth_strategy = keystone

rabbit_host=172.16.7.53
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
volumes_dir = /var/lib/cinder/volumes

enabled_backends = cinder-volumes,cinder-volume2
[cinder-volumes]
volume_group=cinder-volumes
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI
[cinder-volume2]
volume_group=cinder-volume2
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI

#vi /etc/nova/nova.conf
# Cinder #
volume_api_class=nova.volume.cinder.API

#service tgt restart

#cinder-manage db sync

2.1 mysql创建用户以及数据库
mysql> create database cinder;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on cinder.* TO 'cinderUser'@'%' IDENTIFIED BY 'cinderPass';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on cinder.* TO 'cinderUser'@'localhost' IDENTIFIED BY 'cinderPass';
Query OK, 0 rows affected (0.01 sec)

2.2 创建volume group
#fdisk /dev/sdb

#pvcreate /dev/sdb1

#vgcreate cinder-volumes /dev/sdb1

3.计算节点cinder配置
#sudo apt-get install cinder-volume open-iscsi python-cinderclient tgt

#sudo apt-get install lvm2

#fdisk /dev/sdb

#pvcreate /dev/sdb1

#vgcreate cinder-volume2 /dev/sdb1

#vi /etc/cinder/cinder.conf
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
sql_connection = mysql://cinderUser:[email protected]/cinder
api_paste_confg = /etc/cinder/api-paste.ini

iscsi_helper = tgtadm
volume_name_template = volume-%s
verbose = True
auth_strategy = keystone

rabbit_host=172.16.7.53
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
volumes_dir = /var/lib/cinder/volumes

enabled_backends = cinder-volumes,cinder-volume2
[cinder-volumes]
volume_group=cinder-volumes
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI
[cinder-volume2]
volume_group=cinder-volume2
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI

NOTE!!!iscsitarget与tgt,只能使用一个否则会冲突!

你可能感兴趣的:(openstack,openstack)