OpenStack Icehouse : ストレージを利用する(マルチバックエンド)2014/06/26 |
|
仮想マシンインスタンスには一定容量のディスクは割り当てられていますが、
ディスクが足りなくなった場合やデータは別で保管しておきたい場合等は、
Cinder が提供するブロックストレージ機能を利用することができます。
ここではバックエンドとして NFS および GlusterFS のマルチバックエンド構成で設定します。
+------------------+ +------------------+
10.0.0.35| [ Storage Node ] | 10.0.0.61| |
+------------------+ +-----+ Cinder-Volume | +-----+ GlusterFS #1 |
| [ Control Node ] | | eth0| | | eth0| |
| Keystone |10.0.0.30 | +------------------+ | +------------------+
| Glance |------------+------------------------------+
| Nova API |eth0 | +------------------+ | +------------------+
| Cinder API | | eth0| [ Compute Node ] | | eth0| |
+------------------+ +-----+ Nova Compute | +-----+ GlusterFS #2 |
10.0.0.51| | 10.0.0.62| |
+------------------+ | +------------------+
|
| +------------------+
| eth0| |
+-----+ NFS |
10.0.0.40| |
+------------------+
|
| [1] |
こちらを参考に LAN内に NFS サーバーを用意してください。
なお、ここの例では「nfs.srv.world」上の「/storage」ディレクトリを共有ディレクトリとして設定することにします。 |
| [2] |
こちらを参考に LAN内に GlusterFS サーバーを用意してください。
なお、ここの例では「gfs01」と「gfs02」で構築した分散構成の「vol_distributed」ボリュームを利用するように設定します。 |
| [3] | Storage ノードの設定です。 |
|
# EPEL からインストール
[root@storage ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@storage ~]#
vi /etc/cinder/cinder.conf # [DEFAULT] セクション内の適当な場所へ追記 enabled_backends=nfs,glusterfs
[nfs]
volume_driver=cinder.volume.drivers.nfs.NfsDriver volume_backend_name=NFS nfs_shares_config=/etc/cinder/nfs_shares nfs_mount_point_base=/var/lib/cinder/nfs
[glusterfs]
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver volume_backend_name=GlusterFS glusterfs_shares_config=/etc/cinder/glusterfs_shares glusterfs_mount_point_base=/var/lib/cinder/glusterfs
[root@storage ~]#
vi /etc/cinder/nfs_shares # 新規作成:NFS共有ディレクトリを指定 (複数ある場合は1行ずつ列挙) nfs.srv.world:/storage
[root@storage ~]#
vi /etc/cinder/glusterfs_shares # 新規作成:GlusterFS ボリュームを指定 (複数ある場合は1行ずつ列挙) gfs01.srv.world:/vol_distributed
[root@storage ~]#
[root@storage ~]# chmod 640 /etc/cinder/nfs_shares [root@storage ~]# chgrp cinder /etc/cinder/nfs_shares [root@storage ~]# mkdir /var/lib/cinder/nfs [root@storage ~]# chown cinder. /var/lib/cinder/nfs [root@storage ~]# chmod 640 /etc/cinder/glusterfs_shares [root@storage ~]# chgrp cinder /etc/cinder/glusterfs_shares [root@storage ~]# mkdir /var/lib/cinder/glusterfs [root@storage ~]# chown cinder. /var/lib/cinder/glusterfs /etc/rc.d/init.d/openstack-cinder-volume restart Stopping openstack-cinder-volume: [ OK ] Starting openstack-cinder-volume: [ OK ] |
| [4] | NFS, GlusterFS がマウントできるように Compute ノードの設定を変更します。 |
|
# EPEL からインストール
[root@node01 ~]#
yum --enablerepo=epel -y install nfs-utils glusterfs glusterfs-fuse
[root@node01 ~]#
vi /etc/nova/nova.conf # [DEFAULT] セクション内の適当な場所へ追記 volume_drivers="nfs=nova.virt.libvirt.volume.LibvirtNFSVolumeDriver, glusterfs=nova.virt.libvirt.volume.LibvirtGlusterfsVolumeDriver" /etc/rc.d/init.d/openstack-nova-compute restart Stopping openstack-nova-compute: [ OK ] Starting openstack-nova-compute: [ OK ] |
| [5] | ボリュームタイプ作成 |
|
[root@dlp ~(keystone)]# cinder type-create nfs +--------------------------------------+------+ | ID | Name | +--------------------------------------+------+ | 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | +--------------------------------------+------+[root@dlp ~(keystone)]# cinder type-create glusterfs +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | +--------------------------------------+-----------+[root@dlp ~(keystone)]# cinder type-list +--------------------------------------+-----------+ | ID | Name | +--------------------------------------+-----------+ | 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | | bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | +--------------------------------------+-----------+ |
| [6] | [5]で作成したボリュームタイプと cinder.conf で定義した名前を関連付け |
|
[root@dlp ~(keystone)]# cinder type-key nfs set volume_backend_name=NFS [root@dlp ~(keystone)]# cinder type-key glusterfs set volume_backend_name=GlusterFS [root@dlp ~(keystone)]# cinder extra-specs-list
+--------------------------------------+-----------+----------------------------------------+
| ID | Name | extra_specs |
+--------------------------------------+-----------+----------------------------------------+
| 37852f73-6d66-46c8-b6d4-654f30c0e75a | nfs | {u'volume_backend_name': u'NFS'} |
| bc729593-ff3e-4f01-a21a-64d46aa5d737 | glusterfs | {u'volume_backend_name': u'GlusterFS'} |
+--------------------------------------+-----------+----------------------------------------+
|
| [7] | ボリュームタイプを指定してボリュームを作成 |
|
[root@dlp ~(keystone)]# cinder create --display_name disk_nfs --volume-type nfs 10
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-27T05:46:50.395655 |
| display_description | None |
| display_name | disk_nfs |
| encrypted | False |
| id | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | nfs |
+---------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder create --display_name disk_glusterfs --volume-type glusterfs 10
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-06-27T05:47:09.165059 |
| display_description | None |
| display_name | disk_glusterfs |
| encrypted | False |
| id | 60687e44-953e-4eeb-b05e-c843ca5293e9 |
| metadata | {} |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| volume_type | glusterfs |
+---------------------+--------------------------------------+
[root@dlp ~(keystone)]# cinder list +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | available | disk_nfs | 10 | nfs | false | | | 60687e44-953e-4eeb-b05e-c843ca5293e9 | available | disk_glusterfs | 10 | glusterfs | false | | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ |
| [8] | あとは通常通り作成したボリュームをインスタンスに接続すればOKです。 |
|
[root@dlp ~(keystone)]# nova list +--------------------------------------+-----------+---------+------------+-------------+--------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-----------+---------+------------+-------------+--------------------------+ | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | CentOS_65 | SHUTOFF | - | Shutdown | sharednet1=192.168.100.2 | +--------------------------------------+-----------+---------+------------+-------------+--------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_65 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdb | | id | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | | serverId | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | | volumeId | 04c8a41f-8ba3-44a8-a9e5-ad78a868f202 | +----------+--------------------------------------+[root@dlp ~(keystone)]# nova volume-attach CentOS_65 60687e44-953e-4eeb-b05e-c843ca5293e9 auto +----------+--------------------------------------+ | Property | Value | +----------+--------------------------------------+ | device | /dev/vdc | | id | 60687e44-953e-4eeb-b05e-c843ca5293e9 | | serverId | 90304be0-c9e7-4632-b39f-ac734a8bfb1e | | volumeId | 60687e44-953e-4eeb-b05e-c843ca5293e9 | +----------+--------------------------------------+ |
| Sponsored Link |
|
|