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
280
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
470
WooCommerce with Elasticsearch
amimoto
1
440
[日本語] WooCommerce with Elasticsearch
amimoto
0
210
Amazon CloudFront with AWS Certificate Manager
amimoto
0
190
WordPress with CloudFront + AMAZON RDS + S3
amimoto
1
660
Other Decks in How-to & DIY
See All in How-to & DIY
「RubyでLチカ」に挑戦してみた
isaka1022
0
120
obnizを制御するChatGPT自作プラグイン #iotlt #chatgpt
n0bisuke2
3
560
GPT-4oに遅刻理由を考えてもらうボタン #gpt_4o #iotlt #chatgpt
n0bisuke2
0
240
電気工事士を取ったら一瞬で元が取れた件
bicstone
3
4.3k
[너구리랑! 회고 밋업 2023] CTO 1년 회고와 회고를 바탕으로 만든 프로젝트에 대한 회고 - 전문가가 되는 방법 // 한날 님
develop_neoguri
0
140
地域JAWSの現状とベストプラクティス
awsjcpm
0
360
How to Hire a Driver for Long Distance Travel?
greaterservice
0
110
BVEと連動する誤自宅運転台のススメ!
usashirou
0
590
GPTsとラズパイ5で監視カメラを作ってみた #iotlt #chatgpt #raspberrypi
n0bisuke2
0
480
安全に失敗するための手遊び-未定義動作を引き出そう-
zilmina
0
450
Discover the Quality Coach role and their Toolbox
emna__ayadi
0
120
【バスケ】ボックススコアを用いたオールインワンメトリクス作成手続き
rnsr0371
0
430
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Ruby is Unlike a Banana
tanoku
97
11k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Visualization
eitanlees
145
15k
Speed Design
sergeychernyshev
24
610
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
What's in a price? How to price your products and services
michaelherold
243
12k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Facilitating Awesome Meetings
lara
50
6.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
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