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
290
Progress the system operation drastically with Cloud Automator — AMIMOTO side—
amimoto
0
160
[東京]Cloud_Automatorで攻めのシステム運用 AMIMOTO スタック編
amimoto
0
840
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
バーチャルバナナとリアルバナナ #iotlt #TouchDesigner
n0bisuke2
0
110
本気でコミュニティを成功させたいなら_株式会社コミュカル Mitz
comucal
PRO
0
830
Learning from Firefighters
ksatirli
PRO
0
140
BlueTeamer勉強会 Security Onion編 激闘!Importノード
disconinja
1
110
miiboとamiibo繋げてみた。 #miibo #amiibo #iotlt
n0bisuke2
1
290
ラズパイカメラ向け ケーブル延長基板・ハウジングの開発
koheimasaki
PRO
1
120
電気工事士を取ったら一瞬で元が取れた件
bicstone
3
4.6k
スクフェス福岡前夜祭 LT
pokotyamu
0
200
Invitation to Okinawa.rb in 2024
yasslab
PRO
1
730
リアル登壇だから気をつけたい「マイクの使い方」のコツ
shirayanagiryuji
0
190
「AITRIOS」でトカゲの活動量を可視化
hoshinoresearch
0
320
LT(Lightning Talk)のドキドキ感を共有する IoT ぼっとキーホルダ!
scbc1167
0
270
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
A Tale of Four Properties
chriscoyier
157
23k
How STYLIGHT went responsive
nonsquared
95
5.2k
Writing Fast Ruby
sferik
628
61k
Building Your Own Lightsaber
phodgson
103
6.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
4 Signs Your Business is Dying
shpigford
181
21k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Why Our Code Smells
bkeepers
PRO
335
57k
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