33. 관계형데이터베이스
SELECT customer_info.firstname, customer_info.lastname, purchases.item
FROM customer_info INNER JOIN purchases
ON customer_info.customer_number = purchases.customer_number;
34. Relational Database Service
Database-as-a-Service
No need to install or manage database instances
Scalable and fault tolerant configurations
Feature
Details
Platform support
Create MySQL, SQL Server and Oracle RDBMS
Preconfigured
Get started instantly with sensible default settings
Automated patching
Keep your database platform up to date automatically
Backups
Automatic backups and point in time recovery and full DB backups
Provisioned IOPS
Specify IO throughput depending on requirements
Failover
Automated failover to slave hosts in event of a failure
Replication
Easily create read-replicas of your data and seamlessly replicate data across availability zones
Compute
Storage
AWS Global Infrastructure
Database
App Services
Deployment & Administration
Networking
38. RDS 에서는Multi-AZ,Read replication 등DB engine 중가장다양하고많은기능을지원
DB engine 에서는timezone 변경이아직불가능.UTC 기반
클라이언트접속시설정변경또는코드에서적용해야함
사용이매우편리,dump/restore 역시기존에사용하는mysqldump / mysql 클라이언트를사용하여가능
OS root 는확보불가능
순후하게MySQL 만사용하면서EC2에직접설치하여사용하는경우요구사항은많지않음.
Maria 와같은DB 의사용
MMM / Galera 와같은별도의3rdparty 도구를사용하고자하는경우에유용
Scale-up 의방법은EC2 의방법과동일
MySQL
39. Region
Availability
Zone A
Availability
Zone B
S3
EC2
• 게임은 언제나 “Write heavy”
• 캐싱이 언제나 통하는것은 아님
• 키 밸류 / 키 밸류
• 잦은 바이너리의 사용
• 데이터베이스는 언제나 병목
ELB
EC2
CloudFront
CDN
CUID 는 괴롭다
ㅠㅠ
(creat/update/delete/insert)
42. Availability Zonea
Availability Zoneb
MSSQL
Master
MSSQL
Standby
4 SSD
Stripped Instance Store
(Main DB data store)
4 SSD
Stripped Instance Store
(Mirrored DB data store)
30G
EBS
nG
EBS
root
TX
LOG
30G
EBS
nG
EBS
Mirroring
root
TX
LOG
Create volume snapshot
Volume create
From snapshot
Attach volume
For restoration
43. Availability Zonea
Availability Zoneb
MSSQL
Master
MSSQL
Standby
4 SSD
Stripped Instance Store
(Main DB data store)
4 SSD
Stripped Instance Store
(Mirrored DB data store)
30G
EBS
nG
EBS
root
TX
LOG
30G
EBS
nG
EBS
Mirroring
root
TX
LOG
Create volume snapshot
Volume create
From snapshot
Attach volume
For restoration
Instance Store 는재부팅시데이터가사라짐
따라서복제/복구/백업에대해확실한대비가필요
확실한대비없이는사용에주의!!!!!
44. Availability Zonea
Availability Zoneb
MSSQL
Master
MSSQL
Standby
n X PIOPS EBS
Not raided, for Windows Server
(table partition, table space)
(Main DB data store)
n X PIOPS EBS
Not raided, for Windows Server
(table partition, table space)
(Mirrored DB data store)
30G
EBS
nG
EBS
root
TX
LOG
30G
EBS
nG
EBS
Mirroring
root
TX
LOG
Create volume snapshot
Volume create
From snapshot
Attach volume
For restoration
45. NoSQL
redis> MSET one 1 two 2 three 3 four 4
OK
redis> KEYS *o*
1) "four"
2) "two"
3) "one"
redis> KEYS t??
1) "two"
redis> KEYS *
1) "four"
2) "two"
3) "one"
4) "three"
redis>
54. Minimum production
45GiB (20 x m1.large)
5Gbps access EBS
Up to 80,000 IOPS
Medium production
410GiB
10Gbps access EBS
Up to 640,000 IOPS
55. Large production
360GiB (30 instances)
10Gbps access EBS
Up to 500,000 IOPS
Extra large production
1.5TiB (30 instances)
20Gbps access EBS
Up to 640,000 IOPS
67. DynamoDB
Provisioned throughput NoSQL database
Fast, predictable performance
Fully distributed, fault tolerant architecture
Feature
Details
Provisioned throughput
Dial up or down provisioned read/write capacity
Predictable performance
Average single digit millisecond latencies from SSD backed infrastructure
Strong consistency
Be sure you are reading the most up to date values
Fault tolerant
Data replicated across availability zones
Monitoring
Integrated to Cloud Watch
Secure
Integrates with AWS Identity and Access Management (IAM)
Elastic MapReduce
Integrates with Elastic MapReduce for complex analytics on large datasets
Compute
Storage
AWS Global Infrastructure
Database
App Services
Deployment & Administration
Networking
81. 공식SDK 이외에도
Perl
Net::Amazon::DynamoDB
Erlang
wagerlabs/ddb
https://github.com/wagerlabs/ddb
Go
go-dynamodbhttps://github.com/fabiokung/go-dynamodb
82. 테이블디자인을위한요소(1)
Table
Primary Key 로”Hash key” 혹은”Hash key & Range key”를선택
기본키:Hash key
Hash key 단체로데이터를고유하게식별할수있는경우사용
기본키:Hash key & Range key
Hash key에해당하는여러데이터에서Range key 로검색가능
Local Secondary Indexes
Range key 이외에필터검색을위한키를가질수있음
Global Secondary Indexes
기존Hash key & Range key 외다른attribute 를key 로지정가능
83. 테이블디자인을위한요소(2)
Attributes
데이터의내용. Hash key 에해당하는Attributes 이외에는미리정의할필요는없다. 또한레코드에서Attributes 가불규칙하더라도문제없다.
Attributes 형식
String
Number
Binary
Array of String
Array of Number
Array of Binary
95. User
(Hash)
Timestamp
(Range)
Opponent
Result
Alice
2014-02-21 12:21:20
Bob
Lost
Alice
2014-02-21 12:42:01
Bob
Won
Alice
2014-02-24 09:48:00
Dan
Won
Alice
2014-02-25 16:21:11
Charlie
Won
Battle History
사용자가자신의전투기록을확인하는경우
–User(Alice)가timestamp range-key 를이용하여지난7일간의전투기록을확인
Charlie
02-25 16:21
Won!
Your Battle History
Dan
02-24 09:48
Won!
Alice
02-21 12:42
Won!
게이머의플레이데이터이력
96. 사진공유SNS 앱
Home
My Posts
My Profile
Bob
Steak!
10:18
Carol
BBQ! w/Alice
10:12
Dan
Riajuee…
10:11
Alice
Beer!
10:21
Alice
BBQ! w/Carol
10:12
Alice
Starting BBQ!
10:09
Name:
Alice
Mail: foo
Profile: some texts
98. User(Hash)
Nicknames
Bob
[ Rob, Bobby]
Alice
[Allie ]
Carol
[ Caroline ]
Dan
[ Daniel, Danny ]
Users Table
Item
Attribute
(string, number, binary, set)
Primary Key
(Hash)
친구목록검색
99. User(Hash)
Nicknames
Bob
[ Rob, Bobby]
Alice
[Allie ]
Carol
[ Caroline ]
Dan
[ Daniel, Danny ]
Friends Table
User(Hash)
Friend(Range)
Bob
Alice
Alice
Bob
Alice
Carol
Alice
Dan
Users Table
Hash + Range
Primary Key
친구목록검색
100. Friends Table
Users Table
User(Hash)
Nicknames
Bob
[ Rob, Bobby]
Alice
[Allie ]
Carol
[ Caroline ]
Dan
[ Daniel, Danny ]
User(Hash)
Friend(Range)
Bob
Alice
Alice
Bob
Alice
Carol
Alice
Dan
Alice의친구목록검색
1.Query (Table = Friends, Hash = Alice, Range = *)
2. BatchGetItem(Bob, Carol, Dan)
친구목록검색
101. Friends Table
Users Table
User(Hash)
Nicknames
Bob
[ Rob, Bobby]
Alice
[Allie ]
Carol
[ Caroline ]
Dan
[ Daniel, Danny ]
User(Hash)
Friend(Range)
Bob
Alice
Alice
Bob
Alice
Carol
Alice
Dan
Alice의게시물및이미지검색
1.Query (Table = Friends, Hash = Alice, Range = *)
2. BatchGetItem(Bob, Carol, Dan)
게시물검색
102. Images Table
User(Hash)
Image(Range)
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
Bob
Bob의게시물목록을검색
Query (Table=Images, Hash= Bob, Range=*)
만약특정시간이후의사진목록을가져오고싶다면?
이미지검색
103. Images Table
User
Image
Date
Link
Bob
aed4c
2013-10-01
s3://…
Bob
cf2e2
2013-09-05
s3://…
Bob
f93bae
2013-10-08
s3://…
Alice
ca61a
2013-09-12
s3://…
User
Date
Image
Bob
2013-09-05
cf2e2
Bob
2013-10-01
aed4c
Bob
2013-10-08
f93bae
Alice
2013-09-12
ca61a
Table
ByDate Local Secondary Index
Local Secondary Index 를Date속성에적용
날짜및시간이미지수집
104. ImageTags Table
Image
User
aed4c
Alice
aed4c
Bob
f93bae
Alice
f93bae
Bob
Image f93bae에Alice를태그PutItem(Table = ImageTags,
Hash = f93bae, Range = Alice)
Bob
만약사용자가태그된이미지목록으로검색하고자한다면?
Image f93bae에태그된사용자목록Query(Table = ImageTags,
Hash = f93bae, Range = *)
이미지에사용자를태그
105. ImageTags Table
UserImage의Range를Global Secondary Index로적용
User(Hash)
Image(Range)
Bob
aed4c
Bob
f93bae
Alice
aed4c
Alice
f93bae
ByUser Global Secondary Index
Image(Hash)
User(Range)
aed4c
Alice
aed4c
Bob
f93bae
Alice
f93bae
Bob
Table
Bob
Alice가태그된사진목록
사용자의태그이미지목록
126. Write once
Read many then,
s3://mys3database/HASHasFILENAME.JSON
127. S3 -Durable storage, any object
99.999999999% durability of objects
Unlimited storage of objects of any type
Up to 5TB size per object
Feature
Details
Flexible object store
Buckets act like drives, folder structures within
Access control
Granular control over object permissions
Server-side encryption
256bit AES encryption of objects
Multi-part uploads
Improved throughput & control
Object versioning
Archive old objects and version new ones
Object expiry
Automatically remove old objects
Access logging
Full audit log of bucket/object actions
Web content hosting
Serve content as web site with built in page handling
Notifications
Receive notifications on key events
Import/Export
Physical device import/export service
Compute
Storage
AWS Global Infrastructure
Database
App Services
Deployment & Administration
Networking