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
150
EdgeCase - A speaker series by J2 Design
amimoto
0
340
Progress the system operation drastically with Cloud Automator — AMIMOTO side—
amimoto
0
180
[東京]Cloud_Automatorで攻めのシステム運用 AMIMOTO スタック編
amimoto
0
880
AMIMOTO Design Pattern + Server-less Architecture
amimoto
0
490
WooCommerce with Elasticsearch
amimoto
1
470
[日本語] WooCommerce with Elasticsearch
amimoto
0
240
Amazon CloudFront with AWS Certificate Manager
amimoto
0
210
WordPress with CloudFront + AMAZON RDS + S3
amimoto
1
690
Other Decks in How-to & DIY
See All in How-to & DIY
未来大生の胃を支える函館グルメ
deflis
0
510
とある航空会社の飛行機の乗り方をお教えします。/20240913-lt
kwada
3
300
PlatformIO IDE用M5Stack定型コード環境の紹介
3110
1
560
苦手の克服方法 / How to overcome weaknesses
toma_sm
0
270
チームビルディングを受けてみた
harukahosokawa
3
180
苦いビールを避ける冴えたやり方
watany
2
420
#Stampfly #M5Stack 開発ストーリーと今後の可能性 前説
takasumasakazu
0
120
ジャンカーよ、車も買え ~10分でわかる!? 中古車選び入門~
arkw
1
130
ミシンと刺繍とOSS
godan
3
120
テストも、国際化も! 小中高生クリエータ支援プログラム『未踏ジュニア』を支える技術
yasulab
PRO
1
200
How to make the Groovebox
asonas
2
1.5k
Within the team, I grow as a tester and continuously pursue product quality
camel_404
7
2.3k
Featured
See All Featured
Thoughts on Productivity
jonyablonski
69
4.8k
4 Signs Your Business is Dying
shpigford
184
22k
Being A Developer After 40
akosma
90
590k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Language of Interfaces
destraynor
158
25k
How to Ace a Technical Interview
jacobian
278
23k
Facilitating Awesome Meetings
lara
54
6.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Art, The Web, and Tiny UX
lynnandtonic
301
21k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Embracing the Ebb and Flow
colly
86
4.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
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