Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[日本語] How to use Amazon RDS & S3 with AMIMOTO A...
Search
Amimoto - Flexible Cloud WordPress Hosting
April 07, 2016
How-to & DIY
0
160
[日本語] How to use Amazon RDS & S3 with AMIMOTO AMI WordPress
[日本語] How to use Amazon RDS & S3 with AMIMOTO AMI WordPress
Amimoto - Flexible Cloud WordPress Hosting
April 07, 2016
Tweet
Share
More Decks by Amimoto - Flexible Cloud WordPress Hosting
See All by Amimoto - Flexible Cloud WordPress Hosting
[日本語] AMIMOTO-AMI Lineup
amimoto
0
140
EdgeCase - A speaker series by J2 Design
amimoto
0
260
Progress the system operation drastically with Cloud Automator — AMIMOTO side—
amimoto
0
160
[東京]Cloud_Automatorで攻めのシステム運用 AMIMOTO スタック編
amimoto
0
830
AMIMOTO Design Pattern + Server-less Architecture
amimoto
0
470
WooCommerce with Elasticsearch
amimoto
1
440
[日本語] WooCommerce with Elasticsearch
amimoto
0
210
Amazon CloudFront with AWS Certificate Manager
amimoto
0
180
WordPress with CloudFront + AMAZON RDS + S3
amimoto
1
650
Other Decks in How-to & DIY
See All in How-to & DIY
Chaos V-Ray Render Pool (使い方)
renderpool
0
320
ITエンジニアにおすすめのゲームFactorio御紹介
zembutsu
PRO
1
930
240420MapillaryMeetup2024Tokyo
tosseto
0
140
Raspberry PiではじめるKiCad入門 / 20240226-rpi-jam
akkiesoft
1
3.2k
もくもく会? / mokumokukai?
tbshiki
0
380
[너구리랑! 회고 밋업 2023] GTD & PARA -머릿속이 복잡하던 일상에 적용한 정리법 // 토르 님
develop_neoguri
1
200
異形頭の作りかた
__allllllllez__
0
440
スカウト返信率を倍にするためにやったこと / 2024-01-29
tamago3keran
2
900
ドラムスティックケースを生まれ変わらせて一歩踏み出した話
scbc1167
0
140
enebularを活用したNode-REDによるIoTシステム開発と運用
taokiuhuru
0
380
Chaos V-Ray Render Pool Manual [EN]
renderpool
0
310
【技術カンファレンス運営の裏側】Iwaken Lab 技術好き学生の近況報告 & ことみんさんに技術カンファレンス運営の裏側を聞いちゃう会
kotomin_m
3
180
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
28
1.4k
Optimising Largest Contentful Paint
csswizardry
29
2.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
88
16k
Atom: Resistance is Futile
akmur
261
25k
Unsuck your backbone
ammeep
667
57k
Designing for humans not robots
tammielis
248
25k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.8k
From Idea to $5000 a Month in 5 Months
shpigford
378
46k
RailsConf 2023
tenderlove
27
800
Faster Mobile Websites
deanohume
304
30k
Rails Girls Zürich Keynote
gr2m
93
13k
Transcript
@Amimoto_Ami ja.amimoto-ami.com AMIMOTO (HHVM) + AMAZON RDS + S3
AMAZON RDS ͱ
εέʔϥϒϧ 6ͭͷσʔλϕʔεΤϯδϯ ϦϨʔγϣφϧσʔλϕʔε ༰қͳηοτΞοϓͱӡ༻
ϝϦοτ • εέʔϧՄೳͳCPUɼIOPSɼ ετϨʔδεϖʔε • εφοϓγϣοτϕʔεͷόοΫΞοϓ ࣗಈԽՄೳ • Ϛϧν AZσϓϩΠϝϯτ
• ϑΣΠϧΦʔόʔಉظࡁηΧϯμϦ͔Β
σϝϦοτ • DB ΠϯελϯεγΣϧΞΫηεෆՄ • Ϣʔβಛݖʹ੍ݶ͕͋Δ • MySQL ͷϨϓϦέʔγϣϯ͕ແޮ •
ຖि4࣌ؒͷϝϯςφϯεΟϯυ • RDS ΠϯελϯεࢭΊΔࣄ͕Ͱ͖ͳ͍
σʔλϕʔεΛ RDS Ҡߦ
RDS ͷͳ͍ΞʔΩςΫνϟ
RDS ͷ͋ΔΞʔΩςΫνϟ
AWS ίϯιʔϧ ϩάΠϯ
MySQL Λ Amazon RDS ʹ࡞
σʔλϕʔεΤϯδϯͷબ
σʔλϕʔεΤϯδϯͷબ
σʔλϕʔεͷ֤छઃఆ
σʔλϕʔεͷৄࡉઃఆ
σʔλϕʔεͷ࡞
࡞͞Εͨσʔλϕʔε
ΠϯελϯεϩάΠϯ
EC2 Λ RDS ଓ͠·͢ 1. SSH Λ͍ΠϯελϯεϩάΠϯ͠·͢ $ ssh
-i /Users/macpil/Desktop/example.pem ec2-user@instance_ip or domain 2. ࣍ͷίϚϯυΛ࣮ߦ͍ͯͩ͘͠͞ $ mysql -h {endpoint} -P 3306 -u {mymasteruser} -p
{endpoint} AWS ίϯιʔϧͷ RDS ใηΫγϣϯʹ͋Γ·͢ {mymasteruser} ͱύεϫʔυ RDS ࡞࣌ʹܾΊͨͷͰ͢
σʔλͷҠߦ wp-cli ͰσʔλϕʔεͷσʔλΛΤΫεϙʔτ: $ wp --path=/path/to/wordpress db export
/path/to/wordpress WordPress ͷΠϯετʔϧσΟϨΫτϦͰ͢ɻ AMIMOTO AMIͷσϑΥϧτ /var/www/vhosts/{instance_id} Ͱ͢ɻ
Data migration RDS σʔλΛΠϯϙʔτ: $ mysql -h {endpoint}
-P 3306 -u {mymasteruser} -p {databasename} < dump.sql {endpoint} AWS Ϛωʔδϝϯτίϯιʔϧʹදࣔ͞Ε͍ͯ·͢ɻ {mymasteruser} ͱ {databasename} RDS ࡞࣌ʹܾΊͨͷΛೖྗ͍ͯͩ͘͠͞ɻ
wp-config.php ͷมߋ // ** MySQL settings - You can get
this info from your web host ** // $db_data = false; if ( file_exists('/opt/aws/cloud_formation.json') ) { $db_data = json_decode(file_get_contents('/opt/aws/ cloud_formation.json'), true); if ( isset($db_data['rds']) ) { $db_data = $db_data['rds']; $db_data['host'] = $db_data['endpoint'] . ':' . $db_data['port']; } } if ( !$db_data ) { $db_data = array( 'database' => 'RDS_DATABASE_NAME_HERE', 'username' => 'RDS_USER_NAME_HERE', 'password' => 'RDS_PASSWORD_HERE', 'host' => 'RDS_ENDPOINT_HERE', ); }
wp-config.php ͷมߋ RDS_DATABASE_NAME_HERE: DB ͷৄࡉઃఆͰࢦఆͨ͠σʔλϕʔε໊ RDS_USER_NAME_HERE: DB ͷৄࡉઃఆͰࢦఆͯͨ͠ϚελʔϢʔβ໊ RDS_PASSWORD_HERE: DB
ͷৄࡉઃఆͰࢦఆͯͨ͠Ϛελʔύεϫʔυ RDS_ENDPOINT_HERE: RDS ͷΤϯυϙΠϯτ ͜ΕΒͷઃఆΛ wp-config.php ઃఆޙ WordPress ͕ಈ࡞͢Δ͔֬ೝ͍ͯͩ͘͠͞ɻ
AMIMOTO AMI ͷ MySQL Λఀࢭ͢Δ MySQL Λ RDS Ҡಈͤ͞Δͱ AMIMOTO
AMI ͷ MySQL ϓϩηε͕ෆཁʹͳΓ·͢ɻ ઃఆϑΝΠϧΛฤूͯ͠ MySQL ϓϩηεΛऴ͍ྃͤͯͩ͘͞͞ɻ AMIMOTO AMI ͰϛυϧΣΞͷઃఆ /opt/local/amimoto.json ʹ͋Δ chef-solo Λ͍ͬͯ·͢ɻ
Stoping MySQL in the AMIMOTO AMI MySQL Λ RDS Ҡಈͤ͞Δͱ
AMIMOTO AMI ͷ MySQL ϓϩηε͕ෆཁʹͳΓ·͢ɻ ઃఆϑΝΠϧΛฤूͯ͠ MySQL ϓϩηεΛऴ͍ྃͤͯͩ͘͞͞ɻ AMIMOTO AMI ͰϛυϧΣΞͷઃఆ /opt/local/amimoto.json ʹ͋Δ chef-solo Λ͍ͬͯ·͢ɻ MySQL Λఀࢭͤ͞ΔʹϑΝΠϧΛ࣍ͷΑ͏ʹॻ͖͍͑ͯͩ͘͞: { "nginx" : { "config" : { "user" : "nginx", "group" : "nginx" } }, "php" : { "config" : { "user" : "nginx", "group" : "nginx" } }, "mysql" : { "enabled" : false }, "phpfpm" : { "enabled" : true }, "run_list" : [ "recipe[amimoto]" ] }
AMIMOTO AMI ͷ MySQL ΛࢭΊΔ AMIMOTO AMI HHVM ൛ͷ߹ҎԼͷΑ͏ʹมߋ͍ͯͩ͘͠͞: {
"nginx" : { "config" : { "user" : "nginx", "group" : "nginx" } }, "php" : { "config" : { "user" : "nginx", "group" : "nginx" } }, "mysql" : { "enabled" : false }, "hhvm" : { "enabled" : true }, "run_list" : [ "recipe[amimoto]" ] }
AMIMOTO AMI ͷ MySQL ΛࢭΊΔ ࠷ޙʹ࣍ͷίϚϯυΛ࣮ߦ͍ͯͩ͘͠͞: $ sudo /opt/local/proviosion
$ mysql stop service
AMAZON S3 ͱ
AMAZON S3 • ΦϯϥΠϯόοΫΞοϓ͓Αͼ σʔλͷΞʔΧΠϒʹಛԽͨ͠ઃܭ • ੩తαΠτͷϗεςΟϯάՄೳ • 1ϑΝΠϧ͋ͨΓ 5GB
·ͰΞοϓϩʔυɼ ετϨʔδɼμϯϩʔυ͕Մೳ • ετϨʔδ͢ΔϑΝΠϧʹ্ݶͳ͠ • ෳͷσʔληϯλʹԽ͞ΕετΞ
AWS ίϯιʔϧ͔Β S3 Λબ͍ͯͩ͘͠͞
όέοτΛ࡞͠·͢
όέοτʹ໊લΛ͚ͯϦʔδϣϯΛબɼ࡞͍ͯͩ͘͠͞
όέοτͷ֓ཁ
ΣϒαΠτϗεςΟϯάΛ༗ޮԽ͍ͯͩ͘͠͞
ηΩϡϦςΟΫϨσϯγϟϧҠಈͯ͠……
ΞΫηεΩʔΛ࡞͍ͯͩ͘͠͞
ΞΫηεΩʔΛίϐʔɾμϯϩʔυ͍ͯͩ͘͠͞
WordPress ͷμογϡϘʔυͰ Nephila clavata ϓϥάΠϯΛ༗ޮԽ
ϓϥάΠϯΛઃఆ͠·͢
Amazon S3 ্Ҡಈͨ͠ WordPress ϝσΟΞϥΠϒϥϦ
ja.amimoto-ami.com/support/ ࣭͓͝ؾܰʹ:
@Amimoto_Ami ja.amimoto-ami.com THANK YOU! AMIMOTO (HHVM) + AMAZON RDS +
S3