18. OpenStack構築手順書 Juno版
rootパスワードの入力
controller# mysql_secure_installation
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): password
rootパスワードの変更
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
anonymousユーザーの削除
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
リモートからのrootログインを禁止
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
testデーターベースの削除
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
権限の再読み出し
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
日本仮想化技術18
21. OpenStack構築手順書 Juno版
4. Keystoneインストールと設定(controllerノード)
各サービス間の連携時に使用する認証IDサービスKeystoneのインストールと設定を行います。
4-1 パッケージのインストール
apt-getコマンドでkeystoneパッケージをインストールします。
controller# apt-get install -y keystone python-keystoneclient
4-2 データベースの作成・確認
Keystoneで使用するデータベースを作成します。
4-2-1 データベースの作成
MySQLにデータベースkeystoneを作成します。
controller# mysql -u root -p << EOF
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'
IDENTIFIED BY 'password';
EOF
Enter password: ← MariaDBのrootパスワードpasswordを入力
日本仮想化技術21
22. OpenStack構築手順書 Juno版
4-2-2 データベースの確認
ユーザーkeystoneでログインしデータベースの閲覧が可能であることを確認します。
controller# mysql -u keystone -p
Enter password: ← MariaDBのkeystoneパスワードpasswordを入力
...
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| keystone |
+--------------------+
2 rows in set (0.00 sec)
4-3 設定の変更
keystoneの設定ファイルを変更します。
controller# vi /etc/keystone/keystone.conf
[DEFAULT]
admin_token = password ← 追記
log_dir = /var/log/keystone ← 設定されていることを確認
verbose = True
[database]
#connection = sqlite:////var/lib/keystone/keystone.db ← 既存設定をコメントアウト
connection = mysql://keystone:password@controller/keystone ← 追記
[token]
provider = keystone.token.providers.uuid.Provider
driver = keystone.token.persistence.backends.sql.Token
4-4 データベースに表を作成
controller# su -s /bin/sh -c "keystone-manage db_sync" keystone
日本仮想化技術22
23. OpenStack構築手順書 Juno版
4-5 使用しないデータベースファイルの削除
controller# rm /var/lib/keystone/keystone.db
4-6 Keystoneサービスの再起動
設定を反映させるために、Keystoneサービスを再起動します。
controller# rm /var/log/keystone/*
controller# service keystone restart
4-7 ログの確認
keystoneのログを確認します。下記のWARNING以外にログが表示されなければ問題ありません。
controller# grep "ERROR|WARNING" /var/log/keystone/*
...
2014-11-12 16:32:16.466 18369 WARNING keystone.openstack.common.versionutils [-] Deprecated: keystone.cont
rib.revoke.backends.kvs is deprecated as of Juno in favor of keystone.contrib.revoke.backends.sql and may
be removed in Kilo.
日本仮想化技術23
30. OpenStack構築手順書 Juno版
5. Glanceのインストールと設定
5-1 パッケージのインストール
apt-getコマンドでglanceとglanceクライアントパッケージをインストールします。
controller# apt-get install -y glance python-glanceclient
5-2 データベースの作成・確認
5-2-1 データベース作成
MariaDBにデータベースglanceを作成します。
controller# mysql -u root -p << EOF
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost'
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%'
IDENTIFIED BY 'password';
EOF
Enter password: ← MariaDBのrootパスワードpasswordを入力
5-2-2 データベースの確認
ユーザーglanceでログインしデータベースの閲覧が可能であることを確認します。
controller# mysql -u glance -p
Enter password: ← MariaDBのglanceパスワードpasswordを入力
...
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| glance |
+--------------------+
2 rows in set (0.00 sec)
日本仮想化技術30
37. OpenStack構築手順書 Juno版
6. Novaのインストールと設定(controllerノード)
controllerノードへNovaをインストールします。
6-1 パッケージのインストール
apt-getコマンドでNova関連のパッケージをインストールします。
controller# apt-get install -y nova-api nova-cert nova-conductor nova-consoleauth nova-novncproxy
nova-scheduler python-novaclient
6-2 データベースの作成・確認
6-2-1 データベースの作成
MariaDBにデータベースnovaを作成します。
controller# mysql -u root -p << EOF
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost'
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'
IDENTIFIED BY 'password';
EOF
Enter password: ← MariaDBのrootパスワードpasswordを入力
6-2-2 データベースの作成確認
※ユーザーnovaでログインしデータベースの閲覧が可能であることを確認します。
controller# mysql -u nova -p
Enter password: ← MariaDBのnovaパスワードpasswordを入力
...
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| nova |
+--------------------+
2 rows in set (0.00 sec)
日本仮想化技術37
38. OpenStack構築手順書 Juno版
6-3 認証情報の作成
以下コマンドで認証情報を作成します。
環境変数の設定
controller# source admin-openrc.sh
novaユーザーの作成
controller# keystone user-create --name=nova --pass=password
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | 60d2a224d82449c2b087a0f0b4b9e0a3 |
| name | nova |
| username | nova |
+----------+----------------------------------+
novaユーザーをadminロールに所属
controller# keystone user-role-add --user=nova --tenant=service --role=admin
novaサービスの作成
controller# keystone service-create --name=nova --type=compute
--description="OpenStack Compute"
+-------------+----------------------------------+
| Property | Value |
+-------------+----------------------------------+
| description | OpenStack Compute |
| enabled | True |
| id | 247c48a462b94870920631626d7f9d23 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
日本仮想化技術38
45. OpenStack構築手順書 Juno版
8. Neutronのインストール・設定(controllerノード)
8-1 パッケージインストール
controller# apt-get install -y neutron-server neutron-plugin-ml2 python-neutronclient
8-2 データベース作成・確認
8-2-1 データベース作成
MariaDBにデータベースneutronを作成します。
controller# mysql -u root -p << EOF
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%'
IDENTIFIED BY 'password';
EOF
Enter password: ← MariaDBのrootパスワードpasswordを入力
8-2-2 データベースの確認
MariaDBにNeutronのデータベースが登録されたか確認します。
controller# mysql -u neutron -p
Enter password: ← MariaDBのneutronパスワードpasswordを入力
...
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| neutron |
+--------------------+
2 rows in set (0.00 sec)
※ユーザーneutronでログイン可能でデータベースが閲覧可能なら問題ありません。
日本仮想化技術45
51. OpenStack構築手順書 Juno版
8-9 ログの確認
controller# grep "ERROR|WARNING" /var/log/neutron/*
...
2014-05-16 18:41:24.106 2331 ERROR neutron.openstack.common.rpc.common [-] AMQP server on localhost:5672 i
s unreachable: Socket closed. Trying again in 30 seconds.
2014-05-16 18:41:34.119 2708 WARNING neutron.openstack.common.db.sqlalchemy.session [-] This application h
as not enabled MySQL traditional mode, which means silent data corruption may occur. Please encourage the
application developers to enable this mode.
2014-05-16 18:41:36.423 2708 WARNING neutron.api.extensions [-] Extension fwaas not supported by any of lo
aded plugins
2014-05-16 18:41:36.429 2708 WARNING neutron.api.extensions [-] Extension flavor not supported by any of l
oaded plugins
2014-05-16 18:41:36.484 2708 WARNING neutron.api.extensions [-] Extension lbaas_agent_scheduler not suppor
ted by any of loaded plugins
2014-05-16 18:41:36.502 2708 WARNING neutron.api.extensions [-] Extension lbaas not supported by any of lo
aded plugins
2014-05-16 18:41:36.528 2708 WARNING neutron.api.extensions [-] Extension metering not supported by any of
loaded plugins
2014-05-16 18:41:36.558 2708 WARNING neutron.api.extensions [-] Extension port-security not supported by a
ny of loaded plugins
2014-05-16 18:41:36.593 2708 WARNING neutron.api.extensions [-] Extension routed-service-insertion not sup
ported by any of loaded plugins
2014-05-16 18:41:36.601 2708 WARNING neutron.api.extensions [-] Extension router-service-type not supporte
d by any of loaded plugins
2014-05-16 18:41:36.630 2708 WARNING neutron.api.extensions [-] Extension service-type not supported by an
y of loaded plugins
2014-05-16 18:41:36.653 2708 WARNING neutron.api.extensions [-] Extension vpnaas not supported by any of l
oaded plugins
※上記ERRORとWARNING以外が出力されなければ問題ありません。
日本仮想化技術51
58. OpenStack構築手順書 Juno版
9-7 ネットワークインタフェースの設定変更
Management側に接続されたNICを使って、仮想NIC(br-ex)を作成します。
network# vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual ← 既存設定を変更
up ip link set dev $IFACE up ← 既存設定を変更
down ip link set dev $IFACE down ← 既存設定を変更
auto eth1
iface eth1 inet static
address 192.168.0.9
netmask 255.255.255.0
auto br-ex ← 追記
iface br-ex inet static ← 追記
address 10.0.0.9 ← 追記
netmask 255.255.255.0 ← 追記
gateway 10.0.0.1 ← 追記
dns-nameservers 10.0.0.1 ← 追記
9-7 networkノード再起動
インタフェース設定変更を適用するために、システムを再起動します。
network# reboot
9-8 ブリッジ設定確認
各種ブリッジが正常に設定されていることを確認します。
network# ifconfig
br-ex Link encap:Ethernet HWaddr 00:1c:42:29:b3:bd
inet addr:10.0.0.9 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::a840:fbff:fe7d:dd6e/64 Scope:Link
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:2148 errors:0 dropped:0 overruns:0 frame:0
TX packets:2956 errors:0 dropped:0 overruns:0 carrier:0
日本仮想化技術58
66. OpenStack構築手順書 Juno版
11-2-2 インスタンス用ネットワーク作成
demo-netという名前でインスタンス用ネットワークを作成します。
controller# neutron net-create demo-net
Created a new network:
+----------------+--------------------------------------+
| Field | Value |
+----------------+--------------------------------------+
| admin_state_up | True |
| id | 71059c78-fd2c-4e52-a4b9-98776be0ba28 |
| name | demo-net |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |
+----------------+--------------------------------------+
11-2-3 インスタンス用ネットワークサブネット作成
demo-subnetという名前でインスタンス用ネットワークサブネットを作成します。
controller# neutron subnet-create demo-net --name demo-subnet
--gateway 192.168.0.1 192.168.0.0/24
Created a new subnet:
+------------------+--------------------------------------------------+
| Field | Value |
+------------------+--------------------------------------------------+
| allocation_pools | {"start": "192.168.0.2", "end": "192.168.0.254"} |
| cidr | 192.168.0.0/24 |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 192.168.0.1 |
| host_routes | |
| id | 6cf9c7f6-2105-4c2a-9fac-0b1df83f774d |
| ip_version | 4 |
| name | demo-subnet |
| network_id | 71059c78-fd2c-4e52-a4b9-98776be0ba28 |
| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |
+------------------+--------------------------------------------------+
日本仮想化技術66
67. OpenStack構築手順書 Juno版
11-3 仮想ネットワークルーター設定
仮想ネットワークルーターを作成して外部接続用ネットワークとインスタンス用ネットワークをルーターに接続し、双方
でデータのやり取りを行えるようにします。
11-3-1 demo-routerを作成
仮想ネットワークルータを作成します。
controller# neutron router-create demo-router
Created a new router:
+-----------------------+--------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------+
| admin_state_up | True |
| external_gateway_info | |
| id | d1a10de8-37e2-4966-a84d-caff3e6b0e1f |
| name | demo-router |
| status | ACTIVE |
| tenant_id | 6d19304a59b3456bbe2552a9080d1301 |
+-----------------------+--------------------------------------+
11-3-2 demo-routerにsubnetを追加
仮想ネットワークルーターにインスタンス用ネットワークを接続します。
controller# neutron router-interface-add demo-router demo-subnet
Added interface fc83f7f5-6da5-4607-b9f8-34d0004dfc3e to router demo-router.
11-3-3 demo-routerにgatewayを追加
仮想ネットワークルーターに外部ネットワークを接続します。
controller# neutron router-gateway-set demo-router ext-net
Set gateway for router demo-router
日本仮想化技術67
68. OpenStack構築手順書 Juno版
12. 仮想ネットワーク設定確認(networkノード)
12-1 仮想ネットワークルーターの確認
以下コマンドで仮想ネットワークルーターが作成されているか確認します。
network# ip netns
qdhcp-ed07c38c-8609-43d8-ae02-582f9f202a3e
qrouter-7c1ca8eb-eaa0-4a68-843d-daca30824693
※qrouter~~ という名前の行が表示されていれば問題ありません。
12-2 仮想ルーターのネームスペースのIPアドレスを確認
仮想ルーターと外部用ネットワークの接続を確認します。
network# ip netns exec `ip netns | grep qrouter` ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
13: qr-65249869-77: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether fa:16:3e:d0:df:2c brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global qr-65249869-77
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fed0:df2c/64 scope link
valid_lft forever preferred_lft forever
14: qg-bd7c5797-3f: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether fa:16:3e:35:80:8f brd ff:ff:ff:ff:ff:ff
inet 10.0.0.200/24 brd 10.0.0.255 scope global qg-bd7c5797-3f
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fe35:808f/64 scope link
valid_lft forever preferred_lft forever
※外部アドレス(この環境では10.0.0.0/24)のアドレスを確認します。
日本仮想化技術68
69. OpenStack構築手順書 Juno版
12-3 仮想ゲートウェイの疎通確認
仮想ルーターと通信が行えるかを確認します。
network# ping 10.0.0.200
PING 10.0.0.200 (10.0.0.200) 56(84) bytes of data.
64 bytes from 10.0.0.200: icmp_seq=1 ttl=64 time=1.17 ms
64 bytes from 10.0.0.200: icmp_seq=2 ttl=64 time=0.074 ms
64 bytes from 10.0.0.200: icmp_seq=3 ttl=64 time=0.061 ms
64 bytes from 10.0.0.200: icmp_seq=4 ttl=64 time=0.076 ms
※応答が返ってくれば問題ありません。各ノードからPingコマンドによる疎通確認を実行しましょう。
日本仮想化技術69
70. OpenStack構築手順書 Juno版
13. Cinderインストール(controllerノード)
13-1 パッケージインストール
controller# apt-get install -y cinder-common cinder-api cinder-scheduler cinder-volume lvm2 python-mysqldb
13-2 データベース作成・確認
13-2-1 データベース作成
MariaDBのデータベースにCinderのデータベースを作成します。
controller# mysql -u root -p <<EOF
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost'
IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%'
IDENTIFIED BY 'password';
EOF
Enter password: ← MariaDBのrootパスワードpasswordを入力
13-2-2 データベースの確認
MariaDBにCinderのデータベースが登録されたか確認します。
controller# mysql -u cinder -p
Enter password: ← MariaDBのcinderパスワードpasswordを入力
...
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cinder |
+--------------------+
2 rows in set (0.00 sec)
※ユーザーcinderでログイン可能でデータベースの閲覧が可能なら問題ありません。
日本仮想化技術70
74. OpenStack構築手順書 Juno版
13-8 ログの確認
controller# grep "ERROR|WARNING" /var/log/cinder/*
...
/var/log/cinder/cinder-api.log:2014-05-16 16:56:57.401 2641 WARNING cinder.service [-] Value of config opt
ion osapi_volume_workers must be integer greater than 1. Input value ignored.
/var/log/cinder/cinder-scheduler.log:2014-05-16 16:56:37.733 2287 ERROR oslo.messaging._drivers.impl_rabbi
t [req-b051f972-4128-49bb-a820-b0718340f8fd - - - - -] AMQP server on localhost:5672 is unreachable: Socke
t closed. Trying again in 30 seconds.
/var/log/cinder/cinder-volume.log:2014-05-16 16:56:38.409 2390 ERROR oslo.messaging._drivers.impl_rabbit [
-] AMQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.
/var/log/cinder/cinder-volume.log:2014-05-16 16:57:12.442 2390 ERROR oslo.messaging._drivers.impl_rabbit [
-] AMQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.
/var/log/cinder/cinder-volume.log:2014-05-16 16:57:46.479 2390 ERROR oslo.messaging._drivers.impl_rabbit [
-] AMQP server on localhost:5672 is unreachable: Socket closed. Trying again in 30 seconds.
※上記ERRORとWARNINGが出力されなければ問題ありません。
13-9 イメージ格納用ボリューム作成
イメージ格納用ボリュームを設定するために物理ボリュームの設定、ボリューム作成を行います。
13-9-1 物理ボリュームを設定
以下コマンドで物理ボリュームを設定します。
controller# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
controller# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created
13-9-2 Cinder-Volumeサービスの再起動
Cinderストレージの設定を反映させるために、Cinder-Volumeのサービスを再起動します。
controller# service cinder-volume restart && service tgt restart
13-9-3 admin環境変数設定ファイル読み込み
インスタンス格納用ボリュームを作成するために、admin環境変数を読み込みます。
controller# source admin-openrc.sh
日本仮想化技術74