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
170
[日本語] 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
300
Progress the system operation drastically with Cloud Automator — AMIMOTO side—
amimoto
0
160
[東京]Cloud_Automatorで攻めのシステム運用 AMIMOTO スタック編
amimoto
0
850
AMIMOTO Design Pattern + Server-less Architecture
amimoto
0
480
WooCommerce with Elasticsearch
amimoto
1
440
[日本語] WooCommerce with Elasticsearch
amimoto
0
220
Amazon CloudFront with AWS Certificate Manager
amimoto
0
190
WordPress with CloudFront + AMAZON RDS + S3
amimoto
1
670
Other Decks in How-to & DIY
See All in How-to & DIY
3ヶ月でできる! 探査機自作ゼミ教材自作入門
sksat
6
1.3k
Invitation to Okinawa.rb in 2024
yasslab
PRO
1
750
「おうちクラウド」が今も熱い!
hirosat
2
1k
DroidKaigi 2024 - 海外就職というキャリアの選択肢
iyotetsuya
1
570
コロナ後の世界メイカーフェア事情 高須正和@Nico-Tech Shenzhen #KMMF2024 #KariyaMMF2024
takasumasakazu
0
280
「RubyでLチカ」に挑戦してみた
isaka1022
0
150
enebular Update for the second half of 2023
taokiuhuru
0
180
PlatformIO IDE用M5Stack定型コード環境の紹介
3110
1
390
Terra Charge|普通充電器ご利用ガイドブック / Terra Charge Ordinary Charger Guidebook
contents
1
160
こんなにあるの? 最近のIPAトレンドを ざっくりまとめてみた
watany
3
650
[너구리랑! 회고 밋업 2023] CTO 1년 회고와 회고를 바탕으로 만든 프로젝트에 대한 회고 - 전문가가 되는 방법 // 한날 님
develop_neoguri
0
160
電気工事士を取ったら一瞬で元が取れた件
bicstone
3
4.9k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Optimising Largest Contentful Paint
csswizardry
33
3k
Music & Morning Musume
bryan
46
6.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building an army of robots
kneath
302
45k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Adopting Sorbet at Scale
ufuk
74
9.2k
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