Más contenido relacionado La actualidad más candente (20) Similar a Amazon RDS for PostgreSQL ( JPUG 2014夏セミナー) #jpug (20) Más de Yasuhiro Matsuo (19) Amazon RDS for PostgreSQL ( JPUG 2014夏セミナー) #jpug2. 2
Who am I?
• 名前
– 松尾康博 ( @understeer )
• 所属
– アマゾンデータサービスジャパン株式会社
– ソリューションアーキテクト
– ビッグデータ、HPCのお客様を担当
• 経歴
– 九州大学でスパコンの効率化研究
– SIerで 分散キューの開発・導入、分散処理研究
– Web系スタートアップCTO
– SIerで仮想化基盤の研究・導入・運用
– 現職
4. 4
PostgreSQLと私
• 6.x
– FreeBSD 2.8-3.xの頃に読んでました
– シーラカンス本は第2版から(にわか)
• 7.x
– 分散キューの永続化に使おうと、当時のJDBCドライバと格闘
– 分散キューの永続化を独自実装しようとして MVCC周りを読み漁る
• 8.x
– PostgreSQL分散化を企んで、部下を大学に送りこむ
– 地図サービス案件でPostGISを実運用する
• 9.x
– RDSで初めて触るw
22. 22
様々なAWSのサービス
EBS, S3, Glacier, Storage Gateway
コンテンツ配信
CloudFront
Route 53, Direct Connect
と
CloudTrail, Cloud Formation
EC2, Auto Scaling, Elastic Load Balancing,
Workspaces
RDS, DynamoDB, Redshift, ElastiCache Elastic MapReduce, Kinesis, Data Pipeline
アプリケーションサービス
AppStream, Cloud Search, SWF, SQS, SES, SNS, Elastic Transcoder
24. 拡大を続けるAWS グローバルインフラストラクチャー
GovCloud 米国西部 米国東部 南米 EU アジアパシフィック 中国
US ITAR
Region
北カリフォルニア オレゴン 北バージニア サンパウロ アイルランド シドニー 東京 シンガポール 中国
10 Regions (地域) | 26 Availability Zones(データセンター群) | 51 Edge Locations
アカウント一つで世界中のデータセンターを利用可能
セキュリティーレベルは全て同じ
使い勝手も全て同じ
25. Gartner Magic Quadrant for Cloud
Infrastructure as a Service
Gartner “Magic Quadrant for Cloud Infrastructure as a Service,”
Lydia Leong, Douglas Toombs, Bob Gill, Gregor Petri, Tiny
Haynes, May 28, 2014. This Magic Quadrant graphic was
published by Gartner, Inc. as part of a larger research note and
should be evaluated in the context of the entire report. The
Gartner report is available at
http://aws.amazon.com/resources/analyst-reports/. Gartner does
not endorse any vendor, product or service depicted in its
research publications, and does not advise technology users to
select only those vendors with the highest ratings. Gartner
research publications consist of the opinions of Gartner's research
organization and should not be construed as statements of fact.
Gartner disclaims all warranties, expressed or implied, with
respect to this research, including any warranties of
merchantability or fitness for a particular purpose.
26. S3 : 耐久性の高いオブジェクトストレージ
• Amazon S3にバックアップ保存するだけで、
3ヶ所以上のDCに冗長化
• 容量無制限なのでディスクが足りなくなる心配なし
• 月額 約3.3円/GBから提供
1
S3
S3 S3
データを
自動複製
リージョン
耐久性 99.999999999%
27. 27
Amazon EC2(Elastic Compute Cloud)
• 数分で起動し、1時間ごとの従量課金で利用可能な仮想マシン
• ノード追加・削除、マシンスペック変更も数分で可能
• 管理者権限(root / Administrator) で利用可能
1
任意のゾーンに
分散配置可能
リージョンアベイラビリティゾーンBアベイラビリティゾーンA
31. 31
EC2インスタンスタイプ
• 様々なスペックの仮想マシンを選択可能
128
64
32
16
8
4
2
1
1 2 4 8 16 32 64 128
EC2 Compute Units (ECU)
Memory(GB)
Small 1.7 GB
1 EC2 Compute Unit
1 virtual core
$0.092/0.115
Micro 613 MB
Up to 2 ECUs (for
short bursts)
$0.027/0.035
Large 7.5 GB
4 EC2 Compute Units
2 virtual cores
$0.368/0.460
Extra Large 15 GB
8 EC2 Compute Units
4 virtual cores
$0.736/$0.920
High-CPU Med 1.7 GB
5 EC2 Compute Units
2 virtual cores
$0.190/$0.285
High-CPU XL 7 GB
20 EC2 Compute Units
8 virtual cores
$0.760/$1.140
Cluster GPU 4XL 22 GB
33.5 EC2 Compute Units,
2 x NVIDIA Tesla “Fermi”
M2050 GPUs
$2.10/2.60
Cluster Compute 4XL 23 GB
33.5 EC2 Compute Units
$1.60/1.98
Cluster Compute 8XL 60.5 GB
88 EC2 Compute Units
$2.40/2.97
Medium 3.75 GB
2 EC2 Compute Unit
1 virtual core
$0.184/0.230
Hi-Mem 4XL 68.4 GB
26 EC2 Compute Units
8 virtual cores
$2.072/$2.280
Hi-Mem 2XL 34.2 GB
13 EC2 Compute Units
4 virtual cores
$1.036/$1.140
Hi-Mem XL 17.1 GB
6.5 EC2 Compute Units
2 virtual cores
$0.518/$0.570
32. 322006 2007 2008 2009 2010 2011 2012 2013
m1.small
m1.xlarge
m1.large
m1.small
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
cc2.8xlarge
cc1.4xlarge
cg1.4xlarge
t1.micro
m2.xlarge
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
hs1.8xlarge
m3.xlarge
m3.2xlarge
hi1.4xlarge
m1.medium
cc2.8xlarge
cc1.4xlarge
cg1.4xlarge
t1.micro
m2.xlarge
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
cc1.4xlarge
cg1.4xlarge
t1.micro
m2.xlarge
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
c3.large
c3.xlarge
c3.2xlarge
c3.4xlarge
c3.8xlarge
i2.large
i2.xlarge
i2.2xlarge
i2.4xlarge
i2.8xlarge
g2.2xlarge
cr1.8xlarge
hs1.8xlarge
m3.xlarge
m3.2xlarge
hi1.4xlarge
m1.medium
cc2.8xlarge
cc1.4xlarge
cg1.4xlarge
t1.micro
m2.xlarge
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
インスタンスタイプの歴史
AWSを開始した2006年より、様々な用途に応じた インスタンス
タイプを随時追加し、利用可能
(2014年4月10日時点で34タイプ)
今後も新しいインスタンスタイプを追加予定
2014
r3.large
r3.xlarge
r3.2xlarge
r3.4xlarge
r3.8xlarge
c3.large
c3.xlarge
c3.2xlarge
c3.4xlarge
c3.8xlarge
i2.large
i2.xlarge
i2.2xlarge
i2.4xlarge
i2.8xlarge
g2.2xlarge
cr1.8xlarge
hs1.8xlarge
m3.xlarge
m3.2xlarge
hi1.4xlarge
m1.medium
cc2.8xlarge
cc1.4xlarge
cg1.4xlarge
t1.micro
m2.xlarge
m2.2xlarge
m2.4xlarge
c1.medium
c1.xlarge
m1.xlarge
m1.large
m1.small
33. 33
AWS HPCインスタンス
タイプ c3.8xlarge R3.8xlarge hs1.8xlarge i2.8xlarge
ファミリー コンピューティ
ング最適化
メモリ最適化 ストレージ最適化 I/O最適化
プロセッサー Intel Xeon E5-
2680v2
Intel Xeon E5-
2670v2
Intel Xeon E5-
2650
Intel Xeon E5-
2670v2
vCPU 32 32 16 32
メモリー 60GiB 244GiB 117GB 244GiB
ネットワーク 10Gbps
Ethernet
10Gbps
Ethernet
10Gbps Ethernet 10Gbps
Ethernet
ローカルスト
レージ
2 x 320 GB
SSD
2 x 320 GB SSD 24 x 2048 GB 8 x 800 GB SSD
※ AVX, Turbo 有効
34. 34
EBS (Elastic Block Storage) Region
Availability Zone - a
EBS EBS EBS
Availability Zone - b
EBS EBS
Amazon S3
EBS
スナップ
ショット
EC2 EC2
EBSとは、EC2に仮想外付けされる
ブロックレベルのストレージサービス
サイズは1GB単位で~1TBまで
サイズ/期間(/IO)で課金される
各EC2インスタンスで、複数EBSを使える
詳細
データは永続的に保存される
いつでもバックアップ(スナップショット)
スナップショットから、EBSを作成可能
(他のAZに作成できる)
Provisioned IOPSでIOパフォーマンス指定
• 2014年3月時点で最大4000IOPS
SSD EBS登場 ( 2014年6月17日)
• 3IOPS/GBの性能保証
他のEC2インスタンスに付け替え可能
36. 36
I/Oスピードの高速化+安定化を実現
EBS-Optimized + Provisioned IOPS
Random Read/Write 4kB
• 1-EBS当りのIOPS数を4000 IOPSに設定してランダムIOを発生させ、
EBSを1~8 disksまでの性能を計測。
• IOPS数はリニアにスケールし、32,000 IOPS (4,000IOPS x8EBS)を計測。
0
20,000
40,000
60,000
80,000
100,000
120,000
140,000
0
5000
10000
15000
20000
25000
30000
35000
1disks 2disks 4disks 6disks 8disks
IOPS
Rand ReadWrite : Blocksize = 4KB
MB/sec
IOPS
43. 43
様々なAWSのサービス
EBS, S3, Glacier, Storage Gateway
コンテンツ配信
CloudFront
Route 53, Direct Connect
と
CloudTrail, Cloud Formation
EC2, Auto Scaling, Elastic Load Balancing,
Workspaces
RDS, DynamoDB, Redshift, ElastiCache Elastic MapReduce, Kinesis, Data Pipeline
アプリケーションサービス
AppStream, Cloud Search, SWF, SQS, SES, SNS, Elastic Transcoder
47. 47
Amazon RDSとは?
構築
数クリック or APIでDBサーバを操作
EC2同様、初期費用無し、時間単位の従量課金
移行
4種類のエンジンをサポート
既存アプリケーションの変更不要
運用
可用性向上のための機能
モニタリング、障害検出/復旧、パッチ、スケーリングが容易
セキュリテイ
セキュリティグループ、VPC対応
https://aws.amazon.com/jp/rds/
48. 48
自社構築 vs. RDS
Power, HVAC, net
Rack & stack
Server maintenance
OS patches
DB s/w patches
Database backups
Scaling
High availability
DB s/w installs
OS installation
App optimization
Power, HVAC, net
Rack & stack
Server maintenance
OS patches
DB s/w patches
Database backups
Scaling
High availability
DB s/w installs
OS installation
App optimization
Power, HVAC, net
Rack & stack
Server maintenance
OS patches
DB s/w patches
Database backups
Scaling
High availability
DB s/w installs
OS installation
App optimization
オンプレミス On EC2 RDS
お客様がご担当する作業 AWSが提供するマネージド機能
52. 52
DBインスタンスクラスのスペック
DB Instance Class メモリ(GiB) vCPU ネットワーク 価格 ($/h)
db.t1.micro 0.615 1 非常に低 $0.032
db.m1.small 1.7 1 低 $0.070
db.m3.medium 3.75 1 中 $0.120
db.m3.large 7.5 2 中 $0.240
db.m3.xlarge 15 4 中 $0.485
db.m3.2xlarge 30 8 高 $0.970
db.r3.large 15 2 中 $0.300
db.r3.xlarge 30.5 4 中 $0.600
db.r3.2xlarge 61 8 高 $1.195
db.r3.4xlarge 122 16 高 $2.390
db.r3.8xlarge 244 32 10Gbit $4.775
http://aws.amazon.com/jp/rds/details/
※価格は東京リージョンのPostgreSQL(2014年6月21時点)
54. 54
プロビジョンドIOPS (PIOPS)ストレージ
高性能なストレージオプション
ストレージパフォーマンスの性能(IOPS)を指定可能
低レイテンシと高スループットを安定して実現
標準ストレージからオンラインでPIOPSに変更可能
フェイルオーバー、クラッシュリカバリの時間短縮にも有効
DBエンジン IOPS サイズ 動的増量
MySQL 1000-30,000 100GB-3TB
PostgreSQL 1000-30,000 100GB-3TB
Oracle 1000-30,000 100GB-3TB
SQL Server( Web , Ex) 1000-10,000 100GB-1TB
SQL Server (SE, EE) 1000-10,000 200GB-1TB
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.html
55. 55
プロビジョンドIOPS ストレージ(続き)
IOPSについての注意点
各DBエンジンの仕様、Page Sizeや仮想化技術の違いで実際のIOPSは以下の表
のような目安になる
大きいPIOPSで、低レイテンシ・高スループットが増す
小さなインスタンスタイプではストレージとのN/W帯域不足で設定したIOPSに
達しない場合がある(m3.xlarge以上を推奨)
DBエンジン
(最大サイズ、IOPS)
Page Size Max IOPS
MySQL(3TB, 30,000) 16KB 20,000
PostgreSQL(3TB, 30,000) 8KB 25,000
Oracle(3TB, 30,000) 8KB 25,000
SQL Server(1TB, 10,000) 8KB 10,000
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.ProvisionedIOPS.html#US
ER_PIOPS.Realized
※ Read 50%, Write 50%の場合
66. 66
イベント通知 (DB Event Subscriptions)
RDSで発生した40以上のイベントをSNS経由でPush通知
シャットダウン、再起動、バックアップ開始終了、フェイルオーバー、設定変更、
メンテナンス開始終了、etc
アプリケーションと組み合わせた自動化やログ保存が容易に
DB event
Alarm
Queue
Email
Notification
Message
HTTP
Notification
Amazon SNS
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Event
s.html
67. 67
DBエンジン ログ種別 保持期間
MySQL Error, Slow Query※1, General※1 24時間
PostgreSQL - (ログ種別という概念がない) 7日間※2
Oracle Alert, Trace 7日間※2
SQL Server Error, Agent, Trace 7日間※2
ログアクセス機能
各種ログを直接参照する機能
API経由 でダウンロード or マネジメントコンソールで表示
※1 Parameter Groupで有効化するとアクセス可能
※2 Parameter Groupで調整可能
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html
72. 72
アクセス制御
Security Groupで実現
EC2インスタンスからDBインスタンスへのアクセス制御を実現
アクセス元 EC2 インスタンスに適用しているSecurity Groupとの紐付けによりアクセス可
能になる
注意事項
DBインスタンスの起動場所によって設定対象が異なる
VPC Default環境では DB Security Groupの替りにSecurity Groupを使う
DB Security Groupでは、アクセス元としてSecurity Groupのみ指定可能
起動場所 設定対象
EC2 Classic DB Security Group
EC2 VPC VPC Security Group
VPC Default VPC Security Group
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.RDSSecurityGroups.
html
74. 74
DBエンジン – PostgreSQL -
バージョン
9.3.1 - 9.3.3
標準機能
SSL接続がデフォルトで有効
多くの拡張モジュールをインストール可能
• 拡張モジュールをインストールすることで利用できる機能の例
– プロシージャ
– データ暗号化
– 外部DBからのデータ取得
PostGISをRDSオリジナルの拡張モジュールとして提供
RDS機能
Multi-AZ, プロビジョンドIOPSなどの主要なRDSの機能をサポート
詳細情報
https://aws.amazon.com/jp/rds/postgresql/
75. 75
拡張モジュール(contrib)
btree_gin earthdistance pgrowlocks sslinfo
btree_gist fuzzystrmatch pg_trgm tablefunc
chkpass hstore plperl tsearch2
citext intagg plpgsql unaccent
cube intarray pltcl uuid-ossp
dblink isn postgis
dict_int ltree postgis_tiger_geocoder
dict_xsyn pgcrypto postgis_topology
=> SHOW rds.extensions;
76. 76
拡張モジュール(contrib)
btree_gin earthdistance pgrowlocks sslinfo
btree_gist fuzzystrmatch pg_trgm tablefunc
chkpass hstore plperl tsearch2
citext intagg plpgsql unaccent
cube intarray pltcl uuid-ossp
dblink isn postgis
dict_int ltree postgis_tiger_geocoder
dict_xsyn pgcrypto postgis_topology
手続き言語(プロシー
ジャ)を使用できる。
GIS (地理情報システ
ム) オブジェクトを扱
うことができる
データを暗号/複合化
できる
Key-Value形式でデー
タを格納できる
外部のPostgreSQLに
アクセスできる
• その他の拡張モジュールについては以下を参照。
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#SQLSer
ver.Concepts.General.FeatureSupport
=> SHOW rds.extensions;
78. 78
Tips
ロケールの設定
RDS for PostgreSQLのデフォルトのロケール:「en_US」
→ 日本語を使う場合、インデックスが使われないなど、問題となる可能性がある
ため、データベースLaunch後に、ロケールを設定したデータベースを作り直す必
要がある。
=> CREATE DATABASE newdb WITH template template0 encoding
'utf8' lc_collate 'C' lc_ctype 'C’;
※ 日本語を使用する場合は、ロケールにCを設定するとよい
82. 82
Tips
その他Tipsはこちら
Appendix: Common DBA Tasks for PostgreSQL - Amazon Relational Database Service
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBAT
asks.html
Creating Roles
Managing PostgreSQL Database Access
Working with PostgreSQL Parameters
Setting up PostGIS
Using pgBadger for Log Analysis with RDS PostgreSQL
84. 84
参考文献
Amazon RDS
http://aws.amazon.com/jp/rds/
Amazon RDS ドキュメント
http://aws.amazon.com/jp/documentation/rds/
Amazon RDS チュートリアル
http://aws.amazon.com/articles/Amazon-RDS
ディスカッション・フォーラム
https://forums.aws.amazon.com/forum.jspa?forumID=60
ブログ
Amazon Web Services Japan blog
http://aws.typepad.com/aws_japan/
AWS Solutions Architect ブログ
http://aws.typepad.com/sajp/
89. 89
AWS無料試用枠
AWSでは、無料試用枠( Free Tier)を用意しています
http://aws.amazon.com/jp/free/
RDSでの無料試用枠 適用条件
MySQL, Oracle (BYOL), SQL Server Express, PostgreSQL
Single-AZ db.t1.micro 750時間/月
スタンダードストレージ20GB (スナップショット20GB含む)
1,000万 I/O
https://aws.amazon.com/jp/rds/free/
91. AWS Summit Tokyo 2014
• 2014年7月17日(木) 〜 18日(金)
• グランドプリンス新高輪 (国際館パミール)
• 来場無料 (要事前登録)
• http://www.awssummittokyo.com/
- 申し込み受付中!
• 登壇企業様
- 積水化学工業様、コーセー様、良品計画様、SAPジャパン様、
NTTデータ様、すかいらーく様、日通情報システム様、NTTドコ
モ様、日立製作所様、丸紅様、ソニー銀行様、他多数
Notas del editor http://www.ieice.org/iss/de/DEWS/DEWS2008/proceedings/files/d2/d2-4.pdf 非常に安いサーバからラインナップしているからなんですね。
一番安いので2円くらいです。
今回SAPの本番機で利用できるのはこの上位のハイスペックなインスタンスのみになります。
SAPもAmazonもSAPにはハイスペックなサーバが必要だと認識しています。
どのくらいハイスペックか? 確かに仮想サーバでマルチテナントだとIO性能が遅いという印象があるかと思います。 安く売りたい、というDNAがある。ITの中ではユニークではないかと思います。
今後この傾向は続くという流れです。
今だけ値下げしているのではなくて、創業当時からこれは続けてきたモデルであり、
このように少し変わったバックボーンを持ったポジションを持っています。 ちょっと偏った比較ですが、、、
SQL ServerのBYOL
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Concepts.General.Licensing.html
SA Software Assuaranceでカバーされた Volume License が必要。 License Mobilityプログラムで取り決められている。
SQL Serverは、標準からPIOPSへの変換は Export->Import? 障害後切り替わる。
復旧後、また同期状態に自動的に戻る。
障害後切り替わる。
復旧後、また同期状態に自動的に戻る。
障害後切り替わる。
復旧後、また同期状態に自動的に戻る。
データ容量は減らせないので、注意。
DBによって最低容量が異なる。MySQL=5GB, Oracle=10GB, SQL=20/200GB PostgreSQLは、1つのデータベースクラスタの中に複数データベースを持つことができますが、そのデータベース単位でのアクセス設定やユーザごとのアクセス設定はできません。
Security Groupによるインスタンスごとのアクセス設定か、GRANT文によるスキーマ単位やテーブル単位でのアクセス設定で代替できないか考えましょう。 General Information FAQ
Billing
Reserved Instances
Multi-AZ Deployments
Hardware and Scaling
Automated Backups and Snapshots
Security and VPC
DB Parameter Groups
Provisioned IOPS
Replication
MySQL Database Engine
Oracle Database Engine
SQL Server Database Engine