1. CloudStack
構築事例例+Tips
OCDET環境編
⽇日本CloudStackユーザ会
@MayumiK0
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
2. CloudStackユーザ会で
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
2
3. OCDETとは
オープンクラウド実証実験タスクフォース
http://www.ocdet.org/
⽇日本CloudStackユーザ会は
⽬目的: OpenIaaS研究会に参加しております
オープンソースベースの各クラウド基盤技術の
実証実験を通じて相互接続による連携、運⽤用ノ
ウハウを周知し、クラウド基盤の⼀一般化と利利活
⽤用の促進を図る。
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
3
5. OCDET CloudStack構成
グローバルネットワーク
-‐‑‒Management Server
Gateway#1
(KVM)
APサーバ✕2 すべてオープンソースで
DBサーバ✕2 構成
VPN#1
FW#1
Zabbix#1
-‐‑‒NFS Server (Primary/Secondary領領域)
-‐‑‒Compute Node✕3
-‐‑‒LVS(負荷分散)✕2
プライベートネットワーク(VLANによりネットワークを分けている)
Management
Host
#1
(KVM)
CloudStack
CloudStack
Compute Compute
Compute
Management
DB
LVS#1
暫定NFS
Node
Node
Node
Server#1
Server#1
(node004)
(node005)
(node006)
Primary
Storage
Secondary
Storage
Management
Host
#2
(KVM)
Storage
(NFS)
CloudStack
CloudStack
Management
DB
LVS#2
Server#2
Server#12
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
5
6. OCDET CloudStack構成
■ CloudStack
Apache CloudStack 4.0
・リリース情報
blog:https://blogs.apache.org/cloudstack/entry/apache_̲cloudstack_̲4_̲0_̲0
・ダウンロードURL
http://incubator.apache.org/cloudstack/downloads.html
・インストールガイドHTML版
http://incubator.apache.org/cloudstack/docs/en-‐‑‒US/
Apache_̲CloudStack/4.0.0-‐‑‒incubating/html/Installation_̲Guide/index.html
■ OS
CentOS6.3(64bit版)
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
6
8. DB Serverインストール①
[root@db01
~]#
rpm
-qa
|grep
mysql
mysql-‐‑‒serverをインストールしておく
mysql-server-5.1.61-4.el6.x86_64
こと
mysql-libs-5.1.61-4.el6.x86_64
mysql-5.1.61-4.el6.x86_64
[mysqld]セクションに次の⾏行行を挿⼊入し
ます
[root@db01
~]#
vi
/etc/my.cnf
innodb_̲rollback_̲on_̲timeout=1 追加
[mysqld]
innodb_̲lock_̲wait_̲timeout=600 追加
datadir=/var/lib/mysql
max_̲connections=700 追加
socket=/var/lib/mysql/mysql.sock
log-‐‑‒bin=mysql-‐‑‒bin 追加
user=mysql
binlog-‐‑‒format = 'ROWʼ’ 追加
#
Disabling
symbolic-links
is
recommended
to
prevent
assorted
security
risks
bind-‐‑‒address = 0.0.0.0 追加
symbolic-links=0
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=700
1管理理サーバあたり
log-bin=mysql-bin
max_̲connections 350を⽬目安に
binlog-format
=
‘ROW’
OCDET構成では
bind-address
=
0.0.0.0
管理理サーバ2台なので
[root@db01
~]#
service
mysqld
restart
700で設定
mysqld
を停止中:
[
OK
]
mysqld
を起動中:
[
OK
]
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
8
9. DB Serverインストール②
[root@db01
~]#
mysql_secure_installation
NOTE:
RUNNING
ALL
PARTS
OF
THIS
SCRIPT
IS
RECOMMENDED
FOR
ALL
MySQL
SERVERS
IN
PRODUCTION
USE!
PLEASE
READ
EACH
STEP
CAREFULLY!
Change
the
root
password?
[Y/n]
Y
「Disallow root login remotely」以外は全
Remove
anonymous
users?
[Y/n]
Y
て「Y」で設定
Disallow
root
login
remotely?
[Y/n]
n
Remove
test
database
and
access
to
it?
[Y/n]
Y
Reload
privilege
tables
now?
[Y/n]
Y
...
Success!
Cleaning
up...
All
done!
If
you've
completed
all
of
the
above
steps,
your
MySQL
installation
should
now
be
secure.
Thanks
for
using
MySQL!
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
9
10. CloudStack設定①
[root@manager01
~]#
yum
install
mysql
(省略)
Complete!
#
cloud-setup-databases
cloud:DBパスワード@DBサーバのIPアドレス
--deploy-as=root:DBサーバpasswoed
(省略)
データベースをセットアップします。
Applying
/usr/share/cloud/setup/bridge/db/cloudbridge_offering.sql
[
OK
]
※必要に応じて、-‐‑‒e <encryption_̲type> -‐‑‒
Applying
/usr/share/cloud/setup/bridge/db/cloudbridge_offering_alter.sql
[
OK
]
m <management_̲server_̲key> -‐‑‒k
Processing
encryption
...
[
OK
]
<database_̲key>を付けて
Finalizing
setup
...
[
OK
]
セキュリティ設定を⾏行行いましょう
CloudStack
has
successfully
initialized
database,
you
can
check
your
database
configuration
in
/
etc/cloud/management/db.properties
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
10
11. CloudStack設定②
[root@manager01
~]#
cloud-setup-management
Starting
to
configure
CloudStack
Management
Server:
Configure
sudoers
...
[OK]
KVM環境ではvhd-‐‑‒utilは不不要なので
Configure
Firewall
...
[OK]
スキップ
Configure
CloudStack
Management
Server
...[OK]
CloudStack
Management
Server
setup
is
Done!
[root@manager01
network-scripts]#
mkdir
-p
/mnt/secondary
[root@manager01
network-scripts]#
mount
-t
nfs
172.16.10.19:/export/secondary
/mnt/secondary
[root@manager01
network-scripts]#
cd
/mnt/secondary/
[root@manager01
secondary]#
cat
>
hoge
NFS領領域が正しく
test
file
rootで読み書き可能なことを確認しておく
[root@manager01
secondary]#
ls
-al
hoge
-rw-r--r--.
1
root
root
10
11月
4
18:31
2012
hoge
[root@manager01
secondary]#
rm
hoge
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
11
12. CloudStack設定③
[root@manager01
secondary]#
cd
[root@manager01
~]#
wget
http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2
(省略)
システムVM⽤用のテンプレートの配置する。
wgetで⾃自ホストにDownLoadしておいて
-‐‑‒f オプションで指定した⽅方がやり直し時に
は便便利利
[root@manager01
~]#
/usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt
-m
/
mnt/secondary
-f
acton-systemvm-02062012.qcow2.bz2
-h
kvm
-F
Uncompressing
to
/usr/lib64/cloud/common/scripts/storage/secondary/38d0870e-d5f2-43a5-
a2b7-276c41796a5f.qcow2.tmp
(type
bz2)...could
take
a
long
time
Moving
to
/mnt/secondary/template/tmpl/1/3///38d0870e-d5f2-43a5-a2b7-276c41796a5f.qcow2...could
take
a
while
Successfully
installed
system
VM
template
acton-systemvm-02062012.qcow2.bz2
to
/mnt/secondary/
template/tmpl/1/3/
[root@manager01
~]#
umount
/mnt/secondary/
システムVMと仮想ルータ⽤用のテンプレート
がSecondaryStorageに格納されます
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
12
13. Agentインストール
[root@node006
~]#
vi
/etc/yum.repos.d/CloudStack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
enabled=1
gpgcheck=1
[root@node006
~]#
yum
install
cloud-agent
[root@node006
~]#
yum
install
--nogpgcheck
cloud-agent
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
13
14. 無事に動きました
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
14
15. CloudStack Tips編
CloudStack Tips
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
15
16. CloudStack Tips編
SystemVMが起動しない場合
GUIで確認するとProxy Console VMと
Secondary Storage VMが「Starting」のまま
(1)NFS
・Compute NodeをCloudStack Agentとして登録すると
Compute NodeがPrimaryStorage領領域をmountする
・SystemVM起動(Deploy)時はPrimaryStorage領領域に書き込む
・NFSの設定を誤るとmount領領域のownerがnobody:nobodyになり
仮想イメージを書き込めない。そのためSystemVMをDeployできない。
(2)コントロールグループ(cgroup)
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
16
18. CloudStack Tips編
仮想ルータにホストからsshできます
[root@node006
~]#
ssh
-i
.ssh/id_rsa.cloud
169.254.3.116
-p
3922
Linux
r-5-VM
2.6.32-5-686-bigmem
#1
SMP
Mon
Jan
16
16:42:05
UTC
2012
i686
The
programs
included
with
the
Debian
GNU/Linux
system
are
free
software;
the
exact
distribution
terms
for
each
program
are
described
in
the
individual
files
in
/usr/share/doc/*/copyright.
Debian
GNU/Linux
comes
with
ABSOLUTELY
NO
WARRANTY,
to
the
extent
permitted
by
applicable
law.
root@r-5-VM:~#
date;
ifconfig
–a
eth0
Link
encap:Ethernet
HWaddr
02:00:6b:3d:00:02
Last
login:
Sun
Dec
9
14:20:04
2012
from
169.254.0.1
inet
addr:10.1.1.1
Bcast:10.1.1.255
Mask:255.255.255.0
Linux
r-5-VM
2.6.32-5-686-bigmem
#1
SMP
Mon
Jan
16
16:42:05
UTC
2012
i686
UP
BROADCAST
RUNNING
MULTICAST
MTU:1500
Metric:1
RX
packets:11592
errors:0
dropped:0
overruns:0
frame:0
TX
packets:8741
errors:0
dropped:0
overruns:0
carrier:0
The
programs
included
with
the
Debian
GNU/Linux
system
are
free
software;
collisions:0
txqueuelen:1000
RX
bytes:972709
(949.9
KiB)
TX
bytes:2582211
(2.4
MiB)
the
exact
distribution
terms
for
each
program
are
described
in
the
individual
files
in
/usr/share/doc/*/copyright.
eth1
Link
encap:Ethernet
HWaddr
0e:00:a9:fe:03:74
inet
addr:169.254.3.116
Bcast:169.254.255.255
Mask:255.255.0.0
UP
BROADCAST
RUNNING
MULTICAST
MTU:1500
Metric:1
Debian
GNU/Linux
comes
with
ABSOLUTELY
NO
WARRANTY,
to
the
extent
RX
packets:12285
errors:0
dropped:0
overruns:0
frame:0
TX
packets:10166
errors:0
dropped:0
overruns:0
carrier:0
permitted
by
applicable
law.
collisions:0
txqueuelen:1000
root@r-5-VM:~#
RX
bytes:1937229
(1.8
MiB)
TX
bytes:1915520
(1.8
MiB)
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
18
19. CloudStack Tips編
仮想ルータにホストからsshできます
VMware vSphereの場合はホストからではなく管理理サーバからログイン
# ssh -‐‑‒i /var/lib/cloud/management/.ssh/id_̲rsa -‐‑‒p 3922 root@リンクローカルIP
Proxy Console VM
Secondary Storage VMも同様の⽅方法でsshできます
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
19
23. CloudStack Tips編
削除したVMがなかなか消えない
例例) 検証環境などリソースが少ない環境で削除したVMを
完全に削除したい
秒数で指定
[root@manager01
~]#
/etc/init.d/cloud-management
restart
グローバル設定変更更後は再起
Stopping
cloud-management:
[
OK
]
動を忘れずに
Starting
cloud-management:
[
OK
]
Copyright (C) 2012 Japan CloudStack User Group All Rights
Reserved.
23