Download - Control distribution of virtual machines
![Page 1: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/1.jpg)
1
2013.6.28日本 OpenStack ユーザ会 @irix_jp
openstackOpen source software to build public and private clouds.
JOSUG 13th Study
仮想マシンの分散を制御する
![Page 2: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/2.jpg)
2
自己紹介
● @irix_jp
● 日本 OpenStack ユーザ会 会長● クラウド利用促進機構 技術アドバイザー● RedHat 認定アーキテクト
● 某 SIer 勤務● OSS を使ったクラウドサービスの企画・開発
![Page 3: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/3.jpg)
3
Grizzly 時点の OpenStack
● 分散環境を制御するための2つの視点● OpenStack そのものの分散
● 仮想マシンの分散
![Page 4: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/4.jpg)
4
Grizzly 時点の OpenStack
● 分散環境を制御するための 4 つの手段● OpenStack そのものの分散
– Region– Cell
● 仮想マシンの分散– Availability Zone– Host Aggregate
![Page 5: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/5.jpg)
5
Grizzly 時点の OpenStack
● 分散環境を制御するための 4 つの手段● OpenStack そのものの分散
– Region– Cell
● 仮想マシンの分散– Availability Zone– Host Aggregate
ここが主題
![Page 6: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/6.jpg)
6
分散環境の考慮点
● OpenStack の分散を考える上で重要な項目● AMQP ブローカー・・・メッセージの交換範囲● データベース・・・構成管理情報の共有範囲
● 仮想マシンの分散を考える上で重要な項目● スケジューラー( nova-scheduler )
![Page 7: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/7.jpg)
7
● まずは 4 つの手法のおさらい
![Page 8: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/8.jpg)
8
Region
● 異なる 2 つの OpenStack クラスタの操作窓口を一元化するためのもの● メッセージ交換も構成管理情報も共有しない
– MySQL の複製機能等で共有させることもできる
Horzionで定義 Keystone で定義|----------------------------------+-----------+-------------------------------------------------|| id | region | publicurl ||----------------------------------+-----------+-------------------------------------------------|| 13d5e2ec04b7477c993a574b9dba14f1 | RegionOne | http://192.168.1.111:5000/v2.0 || 1f5e76c949c14b41baeb024b20c599f7 | RegionOne | http://192.168.1.111:8080/v1/AUTH_$(tenant_id)s || 6be0db9b56294d44b33c2c2e1cd9e4a8 | RegionOne | http://192.168.1.111:8773/services/Cloud || 973dad1531f04d4e9c9a9b85c98808d0 | RegionOne | http://192.168.1.111:8774/v2/$(tenant_id)s || 9bfc854b8fd24c808160dcb1367c5cbb | RegionOne | http://192.168.1.111:9696/ || d2108c60933343c0ad680562238b9f53 | RegionOne | http://192.168.1.111:9292 || f164fecb28484ce38ffaaa69497fdbef | RegionOne | http://192.168.1.111:8776/v1/$(tenant_id)s || 7fa3739ab8054cf7b612f5427cbfa897 | RegionTwo | http://192.168.1.222:5000/v2.0 || e38690360a2848ec91c28cde8101393c | RegionTwo | http://192.168.1.222:8080/v1/AUTH_$(tenant_id)s || cf05c1f5f3c04b3899af14b8e2edf08d | RegionTwo | http://192.168.1.222:8773/services/Cloud || 1b80b77ce5b64483ad84887d8ca1bf13 | RegionTwo | http://192.168.1.222:8774/v2/$(tenant_id)s || 558b80356f094534be3cbe087e70d257 | RegionTwo | http://192.168.1.222:9696/ || 95b0a65d26d3448a83daf7b817337a0b | RegionTwo | http://192.168.1.222:9292 || ea527718c5fb45c1aa5977aa94262593 | RegionTwo | http://192.168.1.222:8776/v1/$(tenant_id)s |+----------------------------------+-----------+-------------------------------------------------+
![Page 9: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/9.jpg)
9
Cell
● OpenStack クラスタ(リージョン)内に、複数のAMQP ブローカーと、データベースを持つための仕組み● 主に負荷の分散を目的● 大規模な OpenStack 環境を想定した機能
– コンピューティングノード 10,000 台 / リージョンくらい??
● Grizzly 時点で Nova のみの実験的実装– Newtron(Quantum), Cinder 等は未対応
![Page 10: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/10.jpg)
10
Host Aggregate
● OpenStack クラスタ内での仮想マシンの配置に管理者が法則を与える● 例) HyperVisor 種別、マシンスペック等● 管理者が定義するだけ、ユーザは意識しない
![Page 11: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/11.jpg)
11
Availability Zone
● OpenStack クラスタ内での仮想マシンの配置をユーザが選択できるようにする● 例)ラック間、マシンルーム間、 DC 間 等々● 管理者が定義し、ユーザは指定するだけ
● Host Aggregate をベースとした機能– Folsom までは、別の機能として実装されていた。
![Page 12: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/12.jpg)
12
分散環境
AMQP
nova-api
keystone
AMQP
DB
computenova-cell
scheduler
nova-cell
glance
AMQP
AMQP
DB DB
computecomputecomputecomputecomputecompute
computecomputecomputecomputecomputecompute
nova-api
AMQP DB
keystone
scheduler glance
compute
Child Cells1 Child Cells2
Grandchild Cells
Top CellRegion 1 Region 2
Shared Nothing
horizon
AG1 AG2 AG3 AG4AZ1 AZ2
scheduler
![Page 13: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/13.jpg)
13
使い方
● Host Aggregate● Availability Zone
![Page 14: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/14.jpg)
14
Scheduler
● これらの管理をするのは全部、スケジューラー。● スケジューラーに様々なフィルターを適用すること
で、仮想マシンの配置をコントロールできる。
nova.conf(for nova-schduler)
scheduler_default_filters = AggregateInstanceExtraSpecsFilter,AvailabilityZ
oneFilter,RamFilter,ComputeFilter
スケジューラーの設定に関しては
http://goo.gl/qTikE
![Page 15: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/15.jpg)
15
Host Aggregate
$ source openrc admin admin
$ nova aggregate-list+----+------+-------------------+| Id | Name | Availability Zone |+----+------+-------------------++----+------+-------------------+
$ source openrc demo demo
$ nova aggregate-listERROR: Policy doesn't allow compute_extension:aggregates to be performed. (HTTP 403) (Request-ID: req-134ee1c2-2b1b-4a5c-a500-431964dc3490)
管理者 一般ユーザ
![Page 16: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/16.jpg)
16
Availability Zone
$ source openrc admin admin
$ nova availability-zone-list+-------------------------+----------------------------------------+| Name | Status |+-------------------------+----------------------------------------+| internal | available || |- devstack1.opst.ne.jp | || | |- nova-conductor | enabled :-) 2013-06-23T06:12:06.000000 || | |- nova-consoleauth | enabled :-) 2013-06-23T06:12:04.000000 || | |- nova-scheduler | enabled :-) 2013-06-23T06:12:04.000000 || | |- nova-cert | enabled :-) 2013-06-23T06:12:12.000000 || nova | available || |- devstack1.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack8.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack3.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack9.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack2.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:06.000000 || |- devstack5.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack4.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack6.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 || |- devstack7.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T06:12:10.000000 |+-------------------------+----------------------------------------
$ source openrc demo demo
$ nova availability-zone-list+------+-----------+| Name | Status |+------+-----------+| nova | available |+------+-----------+
管理者 一般ユーザ
nova.conf(grizzly)
default_availability_zone=nova
nova.conf(folsom)
node_availability_zone=nova
![Page 17: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/17.jpg)
17
Aggregate 想定環境
Openstack controller
compute1
compute2
compute3
compute4
compute5
compute6
compute7
compute8
compute9
CPU 12core 24core 36core
Mem 24GB 48GB 64GB
Disk SATA SAS Array SSD Array
Web用 AP用 DB用
![Page 18: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/18.jpg)
18
Host Aggregate の定義
$ nova aggregate-create ag1-web+----+---------+-------------------+-------+----------+| Id | Name | Availability Zone | Hosts | Metadata |+----+---------+-------------------+-------+----------+| 5 | ag1-web | None | | |+----+---------+-------------------+-------+----------+
$ nova aggregate-create ag2-ap+----+--------+-------------------+-------+----------+| Id | Name | Availability Zone | Hosts | Metadata |+----+--------+-------------------+-------+----------+| 6 | ag2-ap | None | | |+----+--------+-------------------+-------+----------+
$ nova aggregate-create ag3-db+----+--------+-------------------+-------+----------+| Id | Name | Availability Zone | Hosts | Metadata |+----+--------+-------------------+-------+----------+| 7 | ag3-db | None | | |+----+--------+-------------------+-------+----------+
web サーバ用
APサーバ用
DBサーバ用
![Page 19: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/19.jpg)
19
Host Aggregate へホスト追加■ホストの追加 $ nova aggregate-add-host 5 devstack1.opst.ne.jp $ nova aggregate-add-host 5 devstack2.opst.ne.jp $ nova aggregate-add-host 5 devstack3.opst.ne.jp■識別子を設定 $ nova aggregate-set-metadata 5 webserver01=true
ホストの追加 $ nova aggregate-add-host 6 devstack4.opst.ne.jp $ nova aggregate-add-host 6 devstack5.opst.ne.jp $ nova aggregate-add-host 6 devstack6.opst.ne.jp■識別子の設定 $ nova aggregate-set-metadata 6 apserver01=true
ホストの追加 $ nova aggregate-add-host 7 devstack7.opst.ne.jp $ nova aggregate-add-host 7 devstack8.opst.ne.jp $ nova aggregate-add-host 7 devstack9.opst.ne.jp■識別子の設定 $ nova aggregate-set-metadata 7 dbserver01=true
![Page 20: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/20.jpg)
20
Host Aggregate へホスト追加
|----+---------+-------------------+---------------------------+---------------------------|| Id | Name | Availability Zone | Hosts | Metadata ||----+---------+-------------------+---------------------------+---------------------------|| 5 | ag1-web | None | [u'devstack1.opst.ne.jp', | {u'webserver01': u'true'} || | | | u'devstack2.opst.ne.jp', | || | | | u'devstack3.opst.ne.jp'] | ||----+---------+-------------------+---------------------------+---------------------------|| 6 | ag2-ap | None | [u'devstack4.opst.ne.jp', | {u'apserver01': u'true'} || | | | u'devstack5.opst.ne.jp', | || | | | u'devstack6.opst.ne.jp'] | ||----+---------+-------------------+---------------------------+---------------------------|| 7 | ag3-db | None | [u'devstack7.opst.ne.jp', | {u'dbserver01': u'true'} || | | | u'devstack8.opst.ne.jp', | || | | | u'devstack9.opst.ne.jp'] | ||----+---------+-------------------+---------------------------+---------------------------|
![Page 21: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/21.jpg)
21
Flavor との関連付け
$ nova flavor-create ag1.webserver 100 512 0 1$ nova flavor-key 100 set webserver01=true
$ nova flavor-create ag1.apserver 101 512 0 1$ nova flavor-key 100 set apserver01=true
$ nova flavor-create ag1.dbserver 102 512 0 1$ nova flavor-key 100 set dbserver01=true
$ nova flavor-list+-----+---------------+-----------+------+-----------+------+-------+-------------+-----------+| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |+-----+---------------+-----------+------+-----------+------+-------+-------------+-----------+| 100 | ag1.webserver | 512 | 0 | 0 | | 1 | 1.0 | True || 101 | ag1.apserver | 512 | 0 | 0 | | 1 | 1.0 | True || 102 | ag1.dbserver | 512 | 0 | 0 | | 1 | 1.0 | True || 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True || 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True || 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True || 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True || 42 | m1.nano | 64 | 0 | 0 | | 1 | 1.0 | True || 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True || 84 | m1.micro | 128 | 0 | 0 | | 1 | 1.0 | True |+-----+---------------+-----------+------+-----------+------+-------+-------------+-----------+
![Page 22: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/22.jpg)
22
Flavor との関連付け
$ nova flavor-show 100+----------------------------+---------------------------+| Property | Value |+----------------------------+---------------------------+| name | ag1.webserver || ram | 512 || OS-FLV-DISABLED:disabled | False || vcpus | 1 || extra_specs | {u'webserver01': u'true'} || swap | || os-flavor-access:is_public | True || rxtx_factor | 1.0 || OS-FLV-EXT-DATA:ephemeral | 0 || disk | 0 || id | 100 |+----------------------------+---------------------------+
![Page 23: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/23.jpg)
23
仮想マシンの起動
$ for i in {1..9}; do nova boot --flavor ag1.apserver --image cirros-0.3.1-x86_64-uec ap0${i}; done
$ nova list+--------------------------------------+------+--------+------------+-------------+----------------------+| ID | Name | Status | Task State | Power State | Networks |+--------------------------------------+------+--------+------------+-------------+----------------------+| 7a893de6-559f-4a9c-ac3d-9a66a6525c66 | ap01 | ACTIVE | None | Running | private=172.24.17.3 || d798ade7-844e-4f77-850b-a9c55c657e98 | ap02 | ACTIVE | None | Running | private=172.24.17.4 || b6590d4e-a0d7-4500-99d0-167525156212 | ap03 | ACTIVE | None | Running | private=172.24.17.5 || 837b2f81-9aa0-403c-b7f9-d8992211f68b | ap04 | ACTIVE | None | Running | private=172.24.17.6 || 95d9d8d0-a085-4d02-8bad-973213b64c96 | ap05 | ACTIVE | None | Running | private=172.24.17.7 || 2c4bc17e-b3f0-49f3-ac76-58e677f14bac | ap06 | ACTIVE | None | Running | private=172.24.17.8 || 6af465cf-cafc-498b-a937-417911575316 | ap07 | ACTIVE | None | Running | private=172.24.17.9 || a92e1d08-bf7a-4749-8d57-1874cfdae49b | ap08 | ACTIVE | None | Running | private=172.24.17.10 || a8454436-5631-4b30-b4b7-815be628e167 | ap09 | ACTIVE | None | Running | private=172.24.17.11 |+--------------------------------------+------+--------+------------+-------------+----------------------+
$ nova-manage vm list
| instance | node | type | state ||----------+----------------------+--------------+--------|| ap01 | devstack4.opst.ne.jp | ag1.apserver | active || ap02 | devstack6.opst.ne.jp | ag1.apserver | active || ap03 | devstack5.opst.ne.jp | ag1.apserver | active || ap04 | devstack4.opst.ne.jp | ag1.apserver | active || ap05 | devstack6.opst.ne.jp | ag1.apserver | active || ap06 | devstack5.opst.ne.jp | ag1.apserver | active || ap07 | devstack4.opst.ne.jp | ag1.apserver | active || ap08 | devstack6.opst.ne.jp | ag1.apserver | active || ap09 | devstack5.opst.ne.jp | ag1.apserver | active |
指定した Host Aggregateに含まれたホストのみに配置される。
![Page 24: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/24.jpg)
24
Host Aggregate まとめ
ag1-web
ag2-ap
compute1
compute2
compute3
compute4
compute5
compute6
compute7
compute8
compute9
ag3-db
{u'webserver01': u'true'}
{u'apserver01': u'true'}
{u'dbserver01': u'true'}
ag1.dbserver
ag1.apserver
ag1.webserver
{u'webserver01': u'true'}
{u'apserver01': u'true'}
{u'dbserver01': u'true'}
Host aggregate(管理者 )
Flavor(管理者 )
nova boot \ --flavor ag1.apserver \ --image cirros-0.3.1-x86_64-uec
● 管理者が Flavor とAggregate のキーを設定する。
● ユーザが指定した Flavor のキーに対応する Aggregate で仮想マシンが起動する。
● scheduler が振り分けを制御する。
● 用途ごとにスペックの異なる物理マシンへ配置したり、ハイパーバイザーが混在する環境での割り当てに利用する。
![Page 25: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/25.jpg)
25
AZ 想定環境
Openstack controller
compute2
compute3
compute4
compute5
compute6 compute8
compute7 compute9
浅草 DC 渋谷 DC 上野 DC
![Page 26: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/26.jpg)
26
Availability Zone の定義+-------------------------+----------------------------------------+| Name | Status |+-------------------------+----------------------------------------+| internal | available || |- devstack1.opst.ne.jp | || | |- nova-conductor | enabled :-) 2013-06-23T11:20:05.000000 || | |- nova-consoleauth | enabled :-) 2013-06-23T11:20:11.000000 || | |- nova-scheduler | enabled :-) 2013-06-23T11:20:05.000000 || | |- nova-cert | enabled :-) 2013-06-23T11:20:07.000000 || nova | available || |- devstack1.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack8.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack3.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack9.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack2.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack5.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack4.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack6.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 || |- devstack7.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:20:09.000000 |+-------------------------+----------------------------------------+
![Page 27: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/27.jpg)
27
Availability Zone の定義
$ nova aggregate-create ag001-az001 az-tokyo-asakusa$ nova aggregate-create ag002-az002 az-tokyo-shibuya$ nova aggregate-create ag003-az003 az-tokyo-ueno
$ nova aggregate-list+----+-------------+-------------------+| Id | Name | Availability Zone |+----+-------------+-------------------+| 5 | ag1-web | None || 6 | ag2-ap | None || 7 | ag3-db | None || 8 | ag001-az001 | az-tokyo-asakusa || 9 | ag002-az002 | az-tokyo-shibuya || 10 | ag003-az003 | az-tokyo-ueno |+----+-------------+-------------------+
● Availability Zone は Host Aggregate をベースにして実装されている。
● Folsom までは完全に別機能。● host aggregate based availability zones● https://blueprints.launchpad.net/nova/+spec/aggregate-based-availability-zones
![Page 28: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/28.jpg)
28
AZ へのホスト追加
● 方法は Host Aggregate と同一。
■ホストの追加 $ nova aggregate-add-host 8 devstack2.opst.ne.jp $ nova aggregate-add-host 8 devstack3.opst.ne.jp $ nova aggregate-add-host 8 devstack4.opst.ne.jp $ nova aggregate-add-host 8 devstack5.opst.ne.jp
$ nova aggregate-add-host 9 devstack6.opst.ne.jp $ nova aggregate-add-host 9 devstack7.opst.ne.jp
$ nova aggregate-add-host 10 devstack8.opst.ne.jp $ nova aggregate-add-host 10 devstack9.opst.ne.jp
![Page 29: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/29.jpg)
29
AZ へのホスト追加
● 一つのホストを複数の Aggregate へ所属させることも可能。|----+-------------+-------------------+---------------------------+---------------------------------------------|| Id | Name | Availability Zone | Hosts | Metadata ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 5 | ag1-web | None | [u'devstack1.opst.ne.jp', | {u'webserver01': u'true'} || | | | u'devstack2.opst.ne.jp', | || | | | u'devstack3.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 6 | ag2-ap | None | [u'devstack4.opst.ne.jp', | {u'apserver01': u'true'} || | | | u'devstack5.opst.ne.jp', | || | | | u'devstack6.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 7 | ag3-db | None | [u'devstack7.opst.ne.jp', | {u'dbserver01': u'true'} || | | | u'devstack8.opst.ne.jp', | || | | | u'devstack9.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 8 | ag001-az001 | az-tokyo-asakusa | [u'devstack2.opst.ne.jp', | {u'availability_zone': u'az-tokyo-asakusa'} || | | | u'devstack3.opst.ne.jp', | || | | | u'devstack4.opst.ne.jp', | || | | | u'devstack5.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 9 | ag002-az002 | az-tokyo-shibuya | [u'devstack6.opst.ne.jp', | {u'availability_zone': u'az-tokyo-shibuya'} || | | | u'devstack7.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|| 10 | ag003-az003 | az-tokyo-ueno | [u'devstack8.opst.ne.jp', | {u'availability_zone': u'az-tokyo-ueno'} || | | | u'devstack9.opst.ne.jp'] | ||----+-------------+-------------------+---------------------------+---------------------------------------------|
![Page 30: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/30.jpg)
30
AZ へのホスト追加+-------------------------+----------------------------------------+| Name | Status |+-------------------------+----------------------------------------+| nova | available || |- devstack1.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:19.000000 || az-tokyo-asakusa | available || |- devstack3.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || |- devstack2.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || |- devstack5.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || |- devstack4.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || az-tokyo-ueno | available || |- devstack9.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || |- devstack8.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || az-tokyo-shibuya | available || |- devstack6.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 || |- devstack7.opst.ne.jp | || | |- nova-compute | enabled :-) 2013-06-23T11:45:17.000000 |+-------------------------+----------------------------------------+
![Page 31: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/31.jpg)
31
AZ 指定での仮想マシン起動
$ nova availability-zone-list+------------------+-----------+| Name | Status |+------------------+-----------+| nova | available || az-tokyo-asakusa | available || az-tokyo-ueno | available || az-tokyo-shibuya | available |+------------------+-----------+
$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm01$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm02$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm03$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm04$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm05$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm06
$ nova list+--------------------------------------+-----------+--------+------------+-------------+---------------------+| ID | Name | Status | Task State | Power State | Networks |+--------------------------------------+-----------+--------+------------+-------------+---------------------+| 38a845b0-df6f-4b86-a52e-46ef9a1c269b | ueno-vm01 | ACTIVE | None | Running | private=172.24.17.2 || fa214a65-414a-4b47-a526-83116a73dda5 | ueno-vm02 | ACTIVE | None | Running | private=172.24.17.3 || 44c687b9-d89e-4497-a3d9-d277ee7af02c | ueno-vm03 | ACTIVE | None | Running | private=172.24.17.4 || c260af46-cc11-4a7c-96e2-4f39786a8972 | ueno-vm04 | ACTIVE | None | Running | private=172.24.17.5 || 4444d731-1f6a-4baa-9228-298297d1e726 | ueno-vm05 | ACTIVE | None | Running | private=172.24.17.6 || be9ef87b-eb5a-4dd5-b8c9-a1c779704790 | ueno-vm06 | ACTIVE | None | Running | private=172.24.17.7 |+--------------------------------------+-----------+--------+------------+-------------+---------------------+
![Page 32: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/32.jpg)
32
AZ 指定での仮想マシン起動
$ nova-manage vm list
| instance | node | type | state ||-----------+----------------------+---------+--------|| ueno-vm01 | devstack9.opst.ne.jp | m1.tiny | active || ueno-vm02 | devstack8.opst.ne.jp | m1.tiny | active || ueno-vm03 | devstack9.opst.ne.jp | m1.tiny | active || ueno-vm04 | devstack8.opst.ne.jp | m1.tiny | active || ueno-vm05 | devstack9.opst.ne.jp | m1.tiny | active || ueno-vm06 | devstack8.opst.ne.jp | m1.tiny | active |
Availability Zoneを指定しない場合、 schedulerに設定されたデフォルト zoneが利用される
指定した Availability Zoneに含まれたホストのみに配置される。
default_schedule_zone=nova
nova.conf(nova-api)
![Page 33: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/33.jpg)
33
Availability Zone まとめ
compute2
compute3
compute4
compute5
compute6
compute7
compute8
compute9
Availability Zone(管理者 )
● 管理者が Availability Zone を定義する。
● ユーザはゾーンを指定して仮想マシンを起動する。
● scheduler が振り分けを制御する。
● Availability Zone は DB/AMQP が共有できる範囲での分散を制御する。
● 近隣の DC単位、敷地内の建物単位、ラック単位など。
az-tokyo-asakusa
az-tokyo-shibuya
az-tokyo-ueno
$ nova boot --flavor m1.tiny --image cirros-0.3.1-x86_64-uec --availability-zone az-tokyo-ueno ueno-vm01
![Page 34: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/34.jpg)
34
組合せ
● Aggregate と AZ を組合せて利用することも可能
compute2
compute3
compute4
compute6
compute7
compute8
compute5 compute9
Host Aggerageag-hadoop
Availability Zoneaz-rack01
Availability Zoneaz-rack02
![Page 35: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/35.jpg)
35
Aggregate/AZ の定義
■Aggregateと AZの作成$ nova aggregate-create ag-hadoop$ nova aggregate-create ag0001-az-rack01 az-rack01$ nova aggregate-create ag0002-az-rack02 az-rack02
■Aggregateにキーを設定$ nova aggregate-set-metadata 11 hadoop01=true
■Flavorの作成とキーの設定$ nova flavor-create h1.hadoop 200 512 0 1$ nova flavor-key 200 set hadoop01=true
■作成した Aggregateと AZ(抜粋$ nova aggregate-list+----+------------------+-------------------+| Id | Name | Availability Zone |+----+------------------+-------------------+| 11 | ag-hadoop | None || 12 | ag0001-az-rack01 | az-rack01 || 13 | ag0002-az-rack02 | az-rack02 |+----+------------------+-------------------+
![Page 36: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/36.jpg)
36
Aggregate/AZ の定義|----+------------------+-------------------+---------------------------+--------------------------------------|| Id | Name | Availability Zone | Hosts | Metadata ||----+------------------+-------------------+---------------------------+--------------------------------------|| 11 | ag-hadoop | None | [u'devstack2.opst.ne.jp', | {u'hadoop01': u'true'} || | | | u'devstack3.opst.ne.jp', | || | | | u'devstack4.opst.ne.jp', | || | | | u'devstack7.opst.ne.jp', | || | | | u'devstack6.opst.ne.jp', | || | | | u'devstack8.opst.ne.jp'] | ||----+------------------+-------------------+---------------------------+--------------------------------------|| 12 | ag0001-az-rack01 | az-rack01 | [u'devstack2.opst.ne.jp', | {u'availability_zone': u'az-rack01'} || | | | u'devstack3.opst.ne.jp', | || | | | u'devstack4.opst.ne.jp'] | ||----+------------------+-------------------+---------------------------+--------------------------------------|| 13 | ag0002-az-rack02 | az-rack02 | [u'devstack6.opst.ne.jp', | {u'availability_zone': u'az-rack02'} || | | | u'devstack7.opst.ne.jp', | || | | | u'devstack8.opst.ne.jp'] | ||----+------------------+-------------------+---------------------------+--------------------------------------|
![Page 37: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/37.jpg)
37
Aggregate/AZ の定義 nova |- devstack1.opst.ne.jp | |- nova-compute | az-tokyo-asakusa |- devstack2.opst.ne.jp | |- nova-compute |- devstack3.opst.ne.jp | |- nova-compute |- devstack4.opst.ne.jp | |- nova-compute |- devstack5.opst.ne.jp | |- nova-compute | az-tokyo-shibuya |- devstack6.opst.ne.jp | |- nova-compute |- devstack7.opst.ne.jp | |- nova-compute | az-tokyo-ueno |- devstack8.opst.ne.jp | |- nova-compute |- devstack9.opst.ne.jp | |- nova-compute |
| az-rack01 |- devstack2.opst.ne.jp | |- nova-compute |- devstack3.opst.ne.jp | |- nova-compute |- devstack4.opst.ne.jp | |- nova-compute | az-rack02 |- devstack6.opst.ne.jp | |- nova-compute |- devstack7.opst.ne.jp | |- nova-compute |- devstack8.opst.ne.jp | |- nova-compute
*見やすいように加工しています。
![Page 38: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/38.jpg)
38
仮想マシンの起動$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop01$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop02$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop03$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop04$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop05$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop06$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop07$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop08$ nova boot --flavor h1.hadoop --image cirros-0.3.1-x86_64-uec --availability-zone az-rack02 hadoop09
|----------+----------------------+-----------+--------|| instance | node | type | state ||----------+----------------------+-----------+--------|| hadoop01 | devstack6.opst.ne.jp | h1.hadoop | active || hadoop02 | devstack8.opst.ne.jp | h1.hadoop | active || hadoop03 | devstack7.opst.ne.jp | h1.hadoop | active || hadoop04 | devstack6.opst.ne.jp | h1.hadoop | active || hadoop05 | devstack8.opst.ne.jp | h1.hadoop | active || hadoop06 | devstack7.opst.ne.jp | h1.hadoop | active || hadoop07 | devstack6.opst.ne.jp | h1.hadoop | active || hadoop08 | devstack8.opst.ne.jp | h1.hadoop | active || hadoop09 | devstack7.opst.ne.jp | h1.hadoop | active ||----------+----------------------+-----------+--------|
指定した Host Aggregateに含まれたホストのみに配置される。
![Page 39: Control distribution of virtual machines](https://reader033.vdocuments.mx/reader033/viewer/2022052620/5577d6fbd8b42ae0418b52c5/html5/thumbnails/39.jpg)
39
まとめ
● OpenStack そのものの分散を制御したい時には● Region or Cell
● 仮想マシンの分散を制御したい時には、● Availability Zone or Host Aggregate
● Availability Zone はユーザが仮想マシンの配置を管理する。
● Host Aggregate は管理者が仮想マシンの分散に法則を与える。– 組み合わせることも可能