ãã®ããŠããŠãç®æšã«åããŠç±å¿ã«è¿œæ±ããŠããŸãããŸããæ¹æ³ãå¿ããªãããã«ããããšããããŠæ¬¡ã«ã誰ããGoogleã¯ã©ãŠãã§ã€ã³ã¹ã¿ã³ã¹ãäœæã§ããããã«ããããšãç®æšã«ããŠããŸãã
解決ãã¹ãã¿ã¹ã¯ïŒ
- ãšãŒããããŸãŒã³ã®ç°ãªãå°åã®3ã€ã®ã€ã³ã¹ã¿ã³ã¹
- 2ã€ã®ã€ã³ã¹ã¿ã³ã¹ã®å ±æãã£ã¹ã¯
- httpããŒããã©ã³ãµãŒ
- MySQLã¯ã©ãŠãããŒã¹
- 3çªç®ã®ã€ã³ã¹ã¿ã³ã¹ãããã¡ã€ã«ãGoogleãã±ããã«ã¢ããããŒãããŸã
質åïŒããªãcloud.googleãªã®ãïŒã顧客ã®è¯å¿ã«ä»»ããŠãã ããã ã¢ãããã¯ç§ã®ãã®ã§ã¯ãªããç§ã¯èªåã§æ°ããVPSå¶åŸ¡ã·ã¹ãã ãèŠã€ããŸããã ãããŠã以äžãææ¡ãããŠããŸãïŒç§ã¯è«æãè¿°ã¹ãŠããŸãïŒïŒ
- App Engine-ã¢ããªã±ãŒã·ã§ã³ããã³ã³ãŒãã³ã©ãã¬ãŒã·ã§ã³ã®ããã®ãµãŒãã¹ã 誰ãããã¥ã¡ã³ããæ°ã«ããŸããïŒ
- Compute Engine-å®éã«ã¯VPSããããã®ãã£ã¹ã¯ããã¡ã€ã¢ãŠã©ãŒã«ããã©ã³ãµãŒïŒãããã«ã€ããŠã¯åŸã§è©³ãã説æããŸããããªã2ã€ããã®ã§ããããïŒãã¹ãããã·ã§ãããšã¯ã©ãŒã¿ã®ç®¡ç
- ãããã¯ãŒãã³ã°-Googleããã³VPNããã®ã¯ã©ãŠãDNS
- ã¹ãã¬ãŒãž-ã¯ã©ãŠãã¹ãã¬ãŒãžãããŒã¿ã¹ãã¬ãŒãžãã¯ã©ãŠãSQLïŒMySQLïŒ
- BigData-éåžžã«ã·ã³ãã«ã§å®å šã«ãããã«ãããã®
Compute EngineãStorageãNetworkingãStorageã»ã¯ã·ã§ã³ã䜿çšããŸããã
1.ã€ã³ã¹ã¿ã³ã¹ãäœæããŸãã
ãã£ã¹ã¯ãèšèšããããšã§ãä»®æ³ãã·ã³ã®å±éãéå§ããŸãã ç»é¢ã®äžïŒ
ã¹ã¯ãªãŒã³ã·ã§ããã¯ããã£ã¹ã¯ãäœæã§ããé åã瀺ããŠããŸãã ãšãŒãããã«èå³ããããŸãã ãšãŒãããã®ããŒã¿ã»ã³ã¿ãŒãaããééããããšããäºå®ã«æ³šç®ããŸãã 奜å¥å¿readerçãªèªè ã¯ãã»ã³ã¿ãŒbãcãdã®å Žæãæ¢ãããšãã§ããŸããå®éãç§ã¯ç©ççãªå Žæã«ã€ããŠå¿é ããŠããŸããã
ç§ã®ã¢ã«ãŠã³ãã§ã¯ãæ倧ãµã€ãºãæ倧240 GBã®ãæšæºæ°žç¶ãã£ã¹ã¯ããäœæã§ããŸãã 以äžã®èªã¿åã/æžã蟌ã¿ãã£ã¹ã¯é床ã®ããªããã£ããã¹ãïŒ
ãã£ã¹ã¯ã®ãœãŒã¹ã¿ã€ãïŒãœãŒã¹ã¿ã€ãïŒïŒã€ã¡ãŒãžãã¹ãããã·ã§ããããã©ã³ã¯ããããããã·ã¹ãã ã®ã¹ãããã·ã§ãããŸãã¯ç©ºã®ãã£ã¹ã¯ããã®ããªã€ã³ã¹ããŒã«ãããOSã€ã¡ãŒãžã
å人çã«ã¯ãDebianã«èå³ããããŸãããããã以å€ã«ãGoogleã¯CentOSãCoreOSãOpenSUSEãUbuntuãRHELãSlesãããã³Windows Server 2008ã®å°å ¥ãææ¡ããŠããŸãã
ãBãããã³ãCããšãŒãããå°åã§Debian Wheezyã䜿çšããŠ10 GBã®ãã©ã€ããäœæããŸããã ãã®åŸããšãªã¢ãCãã§åé€ãããŸããã 課é¡ã¯ãéçšãµãŒããŒãå±éããŠãã©ãŒã«ããããšã§ãã ãã®å ŽåããBãé åã®ãã£ã¹ã¯ã®ã¹ãããã·ã§ãããããCãé åã«ãã£ã¹ã¯ãå±éããŸãã
次ã«ãã€ã³ã¹ã¿ã³ã¹èªäœãäœæããŸãã
å¯èœãªïŒç§ãå©çšã§ããïŒVPSãªãã·ã§ã³ã®ãªã¹ãããã ããGoogleã®ããã©ã«ãã®ãã¡ã€ã¢ãŠã©ãŒã«ãªãã·ã§ã³ã®éžæãã«ããŒããŠããŸãïŒHTTPãã©ãã£ãã¯ãšHTTPSãã©ãã£ãã¯
äž¡æ¹ã®ãªãã·ã§ã³ã«æ³šæããå ã«é²ã¿ãŸã-Exiting DiskãéžæããŠããã·ã³ã«æ¥ç¶ãããã£ã¹ã¯ãèšããŸãã 2çªç®ã®ãã£ã¹ã¯ã«ããã¿ã€ãããšãããã¹ãŠããããããã«è¡ããããšèšãå¿ èŠããããŸã-/ dev / sdbã衚瀺ãããã€ã³ã¹ã¿ã³ã¹ãåèµ·åããã«ã¯ã©ãã·ã¥ãšããŠã³ãã«æåããŸããã
ãšããã§ãã€ã³ã¹ã¿ã³ã¹ã®åé€äžã«ãã£ã¹ã¯ãåé€ã§ããŸãããã£ã¹ã¯ã¿ã€ãã®éžæã®äžã§å¯Ÿå¿ããé ç®ãéžæããå¿ èŠããããŸãã
IPã¢ãã¬ã¹ã®ã¿ãäœæããå Žåã®ãããã¯ãŒã¯ã»ã¯ã·ã§ã³-å éšãããã¯ãŒã¯ãŸãã¯ã¹ãã£ãã¯ãã¯ã€ãIPã
ãšããã§ãISPanelã¯ããããã¯ãŒã¯èšå®ã«IPã¢ãã¬ã¹ãç»é²ããªãAmazonãGoogleãããã³ãã®ä»ã®ãµãŒãã¹ãããããšããŸã ç解ããŠããŸããã ããã«ã®ã€ã³ã¹ããŒã«ãšã©ã€ã»ã³ã¹äŸäžã¯ããã¯ãã«ã«ãµããŒããåŸ ã€ããç®çã®ISPanelã¢ãã¬ã¹ã§ä»®æ³ã€ã³ã¿ãŒãã§ãŒã¹ãäœæãããããè€éã«ãªããŸãã ãŸããããã¯äžäŸ¿ã§ãïŒ
ã€ã³ã¹ã¿ã³ã¹ãäœæããããšãèšå®ã«ç§»åããŠæ¬¡ã確èªã§ããŸãã
ãããŠåœŒã¯ããSSHçµç±ã§ã¢ã¯ã»ã¹ããæ¹æ³ããšãã質åã«æžæããŸãã ã ããç§ã¯å®éã«çŽ30åéäž»é¡ãç 究ãã次ã®ããšãæããã«ãªããŸããã
SSHããŒç®¡çãŠãããã«ã¯ãPuttyGenãªã©ã«ãã£ãŠçæãããããŒãå ¥åãããŸãã
aïŒå®è¡
bïŒ[çæ]ãã¯ãªãã¯ããŸã
cïŒããŠã¹ã§ãã£ãã
dïŒããŒãååŸãã
eïŒããŒã³ã¡ã³ãããŠãŒã¶ãŒåã«å€æŽãã
fïŒå ¬ééµãä¿åãã
gïŒç§å¯éµãä¿å-ãã¡ã€ã«ããã¹ã¯ãŒãã§ä¿è·ããªãã§ãã ãã
hïŒSSHããŒã®ãŠã£ã³ããŠããssh-rsa ABRAKADABRA dmitryã®åœ¢åŒã®è¡ãã³ããŒ/貌ãä»ã
çœãIPã䜿çšããŠããå Žåã¯ãäœæããã€ã³ã¹ã¿ã³ã¹ã®ãŠãŒã¶ãŒåã§ãã°ã€ã³ã§ããŸãïŒPuttyã§ã¯ãããŒãã¡ã€ã«ã¯èšå®ã§æå®ãããŸãïŒæ¥ç¶-> SSH->èªèšŒïŒã ãŸããGoogleã®Webã€ã³ã¿ãŒãã§ã€ã¹ïŒSSHãã¿ã³ã®äžéšïŒããã³ã³ãœãŒã«ã«ã¢ã¯ã»ã¹ã§ããŸãã ãŸããé©åãªã»ã¯ã·ã§ã³ããVPNãæ§æããŠãéãããµãŒããŒã«ã¢ã¯ã»ã¹ããããšãã§ããŸãããè©Šããããšã¯ãããŸããã
ã¹ã¯ãªãŒã³ã·ã§ããã¯ããã£ã¹ã¯ãäœæã§ããé åã瀺ããŠããŸãã ãšãŒãããã«èå³ããããŸãã ãšãŒãããã®ããŒã¿ã»ã³ã¿ãŒãaããééããããšããäºå®ã«æ³šç®ããŸãã 奜å¥å¿readerçãªèªè ã¯ãã»ã³ã¿ãŒbãcãdã®å Žæãæ¢ãããšãã§ããŸããå®éãç§ã¯ç©ççãªå Žæã«ã€ããŠå¿é ããŠããŸããã
ç§ã®ã¢ã«ãŠã³ãã§ã¯ãæ倧ãµã€ãºãæ倧240 GBã®ãæšæºæ°žç¶ãã£ã¹ã¯ããäœæã§ããŸãã 以äžã®èªã¿åã/æžã蟌ã¿ãã£ã¹ã¯é床ã®ããªããã£ããã¹ãïŒ
sync; dd if=/dev/zero of=/tempfile bs=1M count=4096; sync && dd if=/tempfile of=/dev/null bs=1M count=4096 && /sbin/sysctl -w vm.drop_caches=3 && dd if=/tempfile of=/dev/null bs=1M count=4096 4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB) copied, 112.806 s, 38.1 MB/s 4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB) copied, 52.036 s, 82.5 MB/s vm.drop_caches = 3 4096+0 records in 4096+0 records out 4294967296 bytes (4.3 GB) copied, 52.7394 s, 81.4 MB/s
ãã£ã¹ã¯ã®ãœãŒã¹ã¿ã€ãïŒãœãŒã¹ã¿ã€ãïŒïŒã€ã¡ãŒãžãã¹ãããã·ã§ããããã©ã³ã¯ããããããã·ã¹ãã ã®ã¹ãããã·ã§ãããŸãã¯ç©ºã®ãã£ã¹ã¯ããã®ããªã€ã³ã¹ããŒã«ãããOSã€ã¡ãŒãžã
å人çã«ã¯ãDebianã«èå³ããããŸãããããã以å€ã«ãGoogleã¯CentOSãCoreOSãOpenSUSEãUbuntuãRHELãSlesãããã³Windows Server 2008ã®å°å ¥ãææ¡ããŠããŸãã
ãBãããã³ãCããšãŒãããå°åã§Debian Wheezyã䜿çšããŠ10 GBã®ãã©ã€ããäœæããŸããã ãã®åŸããšãªã¢ãCãã§åé€ãããŸããã 課é¡ã¯ãéçšãµãŒããŒãå±éããŠãã©ãŒã«ããããšã§ãã ãã®å ŽåããBãé åã®ãã£ã¹ã¯ã®ã¹ãããã·ã§ãããããCãé åã«ãã£ã¹ã¯ãå±éããŸãã
次ã«ãã€ã³ã¹ã¿ã³ã¹èªäœãäœæããŸãã
å¯èœãªïŒç§ãå©çšã§ããïŒVPSãªãã·ã§ã³ã®ãªã¹ãããã ããGoogleã®ããã©ã«ãã®ãã¡ã€ã¢ãŠã©ãŒã«ãªãã·ã§ã³ã®éžæãã«ããŒããŠããŸãïŒHTTPãã©ãã£ãã¯ãšHTTPSãã©ãã£ãã¯
äž¡æ¹ã®ãªãã·ã§ã³ã«æ³šæããå ã«é²ã¿ãŸã-Exiting DiskãéžæããŠããã·ã³ã«æ¥ç¶ãããã£ã¹ã¯ãèšããŸãã 2çªç®ã®ãã£ã¹ã¯ã«ããã¿ã€ãããšãããã¹ãŠããããããã«è¡ããããšèšãå¿ èŠããããŸã-/ dev / sdbã衚瀺ãããã€ã³ã¹ã¿ã³ã¹ãåèµ·åããã«ã¯ã©ãã·ã¥ãšããŠã³ãã«æåããŸããã
ãšããã§ãã€ã³ã¹ã¿ã³ã¹ã®åé€äžã«ãã£ã¹ã¯ãåé€ã§ããŸãããã£ã¹ã¯ã¿ã€ãã®éžæã®äžã§å¯Ÿå¿ããé ç®ãéžæããå¿ èŠããããŸãã
IPã¢ãã¬ã¹ã®ã¿ãäœæããå Žåã®ãããã¯ãŒã¯ã»ã¯ã·ã§ã³-å éšãããã¯ãŒã¯ãŸãã¯ã¹ãã£ãã¯ãã¯ã€ãIPã
ãšããã§ãISPanelã¯ããããã¯ãŒã¯èšå®ã«IPã¢ãã¬ã¹ãç»é²ããªãAmazonãGoogleãããã³ãã®ä»ã®ãµãŒãã¹ãããããšããŸã ç解ããŠããŸããã ããã«ã®ã€ã³ã¹ããŒã«ãšã©ã€ã»ã³ã¹äŸäžã¯ããã¯ãã«ã«ãµããŒããåŸ ã€ããç®çã®ISPanelã¢ãã¬ã¹ã§ä»®æ³ã€ã³ã¿ãŒãã§ãŒã¹ãäœæãããããè€éã«ãªããŸãã ãŸããããã¯äžäŸ¿ã§ãïŒ
ã€ã³ã¹ã¿ã³ã¹ãäœæããããšãèšå®ã«ç§»åããŠæ¬¡ã確èªã§ããŸãã
ãããŠåœŒã¯ããSSHçµç±ã§ã¢ã¯ã»ã¹ããæ¹æ³ããšãã質åã«æžæããŸãã ã ããç§ã¯å®éã«çŽ30åéäž»é¡ãç 究ãã次ã®ããšãæããã«ãªããŸããã
SSHããŒç®¡çãŠãããã«ã¯ãPuttyGenãªã©ã«ãã£ãŠçæãããããŒãå ¥åãããŸãã
aïŒå®è¡
bïŒ[çæ]ãã¯ãªãã¯ããŸã
cïŒããŠã¹ã§ãã£ãã
dïŒããŒãååŸãã
eïŒããŒã³ã¡ã³ãããŠãŒã¶ãŒåã«å€æŽãã
fïŒå ¬ééµãä¿åãã
gïŒç§å¯éµãä¿å-ãã¡ã€ã«ããã¹ã¯ãŒãã§ä¿è·ããªãã§ãã ãã
hïŒSSHããŒã®ãŠã£ã³ããŠããssh-rsa ABRAKADABRA dmitryã®åœ¢åŒã®è¡ãã³ããŒ/貌ãä»ã
çœãIPã䜿çšããŠããå Žåã¯ãäœæããã€ã³ã¹ã¿ã³ã¹ã®ãŠãŒã¶ãŒåã§ãã°ã€ã³ã§ããŸãïŒPuttyã§ã¯ãããŒãã¡ã€ã«ã¯èšå®ã§æå®ãããŸãïŒæ¥ç¶-> SSH->èªèšŒïŒã ãŸããGoogleã®Webã€ã³ã¿ãŒãã§ã€ã¹ïŒSSHãã¿ã³ã®äžéšïŒããã³ã³ãœãŒã«ã«ã¢ã¯ã»ã¹ã§ããŸãã ãŸããé©åãªã»ã¯ã·ã§ã³ããVPNãæ§æããŠãéãããµãŒããŒã«ã¢ã¯ã»ã¹ããããšãã§ããŸãããè©Šããããšã¯ãããŸããã
2.ã€ã³ã¹ã¿ã³ã¹ã®ã¯ããŒã³äœæ
ãã€ãŠãªãã»ã©ç°¡åã«ãªããŸããã
ãã£ã¹ã¯ã§ãç®çã®é åã®ã¹ãããã·ã§ããããæ°ãããã£ã¹ã¯ãäœæããã€ã³ã¹ã¿ã³ã¹ã«åºå®ããŸãã ããã§ã¯ããŒã³äœæãå®äºããŸããã 10åããããŸããã
- Compute Engine-æ°ããã¹ãããã·ã§ãã
- ã¹ãããã·ã§ãããåŒã³åºããŠãç®çã®ãã©ã€ããéžæããŸã
- äœæãã
ãã£ã¹ã¯ã§ãç®çã®é åã®ã¹ãããã·ã§ããããæ°ãããã£ã¹ã¯ãäœæããã€ã³ã¹ã¿ã³ã¹ã«åºå®ããŸãã ããã§ã¯ããŒã³äœæãå®äºããŸããã 10åããããŸããã
3.ãã¡ã€ã¢ãŠã©ãŒã«
Compute Engine->ãããã¯ãŒã¯->ããã©ã«ãïŒãããã¯ãŒã¯ïŒ->ãã¡ã€ã¢ãŠã©ãŒã«ã«ãŒã«-æ°èŠ
ãã¡ã€ã¢ãŠã©ãŒã«ãæ§æãããšããç§ãã¡ã¯åžžèã«å°ãããŸãã æ§æã¯ç°¡åã§ãã
Google Chromeã¯å¥åŠã§ãçŽ30åéèµ·åããã«ãŒã«ãäœæããªãã£ããšèšããããåŸãŸããã Mozillaãä¿åããŸãããããã¡ã€ã¢ãŠã©ãŒã«ã®ã«ãŒã«ãååŸããã®ã«éåžžã«é·ãæéãããããçŽ3åããããŸããã
ãã¡ã€ã¢ãŠã©ãŒã«ãæ§æãããšããç§ãã¡ã¯åžžèã«å°ãããŸãã æ§æã¯ç°¡åã§ãã
Google Chromeã¯å¥åŠã§ãçŽ30åéèµ·åããã«ãŒã«ãäœæããªãã£ããšèšããããåŸãŸããã Mozillaãä¿åããŸãããããã¡ã€ã¢ãŠã©ãŒã«ã®ã«ãŒã«ãååŸããã®ã«éåžžã«é·ãæéãããããçŽ3åããããŸããã
4.è² è·åæ£
ãããã¯ãŒã¯è² è·åæ£ãšHTTPè² è·åæ£ã®éããç解ããŠããŸããã§ããã ããã©ã«ãã§ã¯ãããŒã80ã§httpããã¹ããããŸãã æ°ãããã©ã³ãµãŒãèµ·åããåæããã€ã³ã¹ã¿ã³ã¹ãéžæããŠãIPãå²ãåœãŠãŸãã
ããäœãä»ãå ããŸããããã¹ãŠãæšmallã®ãããªãã®ã§ãã
ããäœãä»ãå ããŸããããã¹ãŠãæšmallã®ãããªãã®ã§ãã
5. Cloud SQL
ã¯ã©ãŠãããŒã¹ã®MySQL-ããŒã¿ããŒã¹ã«æé©åãããã€ã³ã¹ã¿ã³ã¹ãäœæããã«ã¯ãã¹ãã¬ãŒãž-> Cloud SQL->æ°èŠã«ç§»åããŸãã ãªã¹ãã®2çªç®ã®1Gb RAMã250Gbãã£ã¹ã¯ãéžæããŸããã 800MbããŒã¹ã®ãã¹ã-é£è¡ã ããŠãã€ã³ã¹ã¿ã³ã¹ããISPanelããå€éšãMySQLãµãŒããŒã«ãªãã€ã¬ã¯ãããŸããã
PHPãPhytonãJAVAãã³ã³ãœãŒã«ãªã©ããããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ã§ããŸãã PHPã®äŸã瀺ããŸãã
ãããŠãç¹å¥ãªã³ã³ãœãŒã«ãããŠãŒã¶ãŒãäœæããŸãã
ãŸããéžæããã€ã³ã¹ã¿ã³ã¹ãŸãã¯IPã¢ãã¬ã¹ããã¢ã¯ã»ã¹ãèš±å¯ããŸãã
Cloud SQL管çã³ã³ãœãŒã«ã®[ç·šé]ãã¿ã³ãããmy.cnfã®éåžžã®èšå®ãèŠã€ããããšãã§ããŸãã
PHPãPhytonãJAVAãã³ã³ãœãŒã«ãªã©ããããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ã§ããŸãã PHPã®äŸã瀺ããŸãã
// Using PDO_MySQL (connecting from App Engine) $db = new pdo('mysql:unix_socket=/cloudsql/< ID>:< Cloud SQL>'), 'root', // username '' // password ); // Using mysqli (connecting from App Engine) $sql = new mysqli( null, // host 'root', // username '', // password '', // database name null, '/cloudsql/< ID>:< Cloud SQL>' ); // Using MySQL API (connecting from APp Engine) $conn = mysql_connect(':/cloudsql/< ID>:< Cloud SQL>, 'root', // username '' // password );
ãããŠãç¹å¥ãªã³ã³ãœãŒã«ãããŠãŒã¶ãŒãäœæããŸãã
ãŸããéžæããã€ã³ã¹ã¿ã³ã¹ãŸãã¯IPã¢ãã¬ã¹ããã¢ã¯ã»ã¹ãèš±å¯ããŸãã
Cloud SQL管çã³ã³ãœãŒã«ã®[ç·šé]ãã¿ã³ãããmy.cnfã®éåžžã®èšå®ãèŠã€ããããšãã§ããŸãã
6. Cling Cloud Storage
ç¥ããªããã¡ã«ãWebã³ã³ãœãŒã«ããBucketãäœæããŸãããããµãŒããŒã³ã³ãœãŒã«ã«ç§»åããŠããããäœæããæ¹ãç°¡åã ã£ãã§ãããã Googleã«ã¯ãã€ã³ã¹ã¿ã³ã¹ã«ããªã€ã³ã¹ããŒã«ãããŠããAPIããããŸãã gsutilãå©çšããŸããïŒ
æåã«æŽæ°ããå¿ èŠããããŸãïŒ
ãã°ã€ã³ïŒ
ãªã³ã¯ã¯10è¡ã§ããããå°ãçãããŸããã ãã®ãªã³ã¯ã«ãããGoogleãŠãŒã¶ãŒããã®ã¢ã¯ã»ã¹ãèš±å¯ãã確èªã³ãŒãã«æ¿å ¥ããIDãååŸããŸãã
ç§ã®å Žåããã±ããã«ã¢ã¯ã»ã¹ã§ããŸãã ããŠããŸãã¯äœæããããšãã§ããŸãïŒ
ããã«ãã¡ã€ã«ãæããŸããã
ãã±ãããšã·ã¹ãã ãã£ã¬ã¯ããªãåæã§ããŸãã
ãŸããªã©ãªã©ã
Bucket gsïŒ// zp-storage /ããã£ã¬ã¯ããªãšããŠããŠã³ãããã«ã¯ãããã€ãã®ãµãŒãããŒãã£ãŠãŒãã£ãªãã£ã䜿çšããå¿ èŠããããŸãã
s3fuseã¯ã Amazon S3ãããŠã³ããããªã©ã åæ§ã®ç®çã§äœ¿çšããããŠãŒãã£ãªãã£ã§ã ã Cloud StorageïŒgoogleïŒãããŠã³ãããããã«äœ¿çšã§ãããšåœŒãã¯æžããŠããŸãããäœããã®çç±ã§ãå°ãªããšããã®ã¢ã¯ã·ã§ã³ã«é¢ããã³ã¡ã³ããå«ãããããããæ§æã¯èŠã€ãããŸããã§ããã
gcsfsã¯ãCloud StorageïŒgoogleïŒã§åäœãããŠãŒãã£ãªãã£ã§ã ã
äŸåããã±ãŒãžããs3fuseã¯ç«ã¡äžãããããœãŒã¹ããåéãããŸããã ãã«ãã¯é²è¡äžã§ã./configure && make && make installãããã«äŸåé¢ä¿ã®ãªã¹ãããããŸãã
ããããgcsfsã¯debããã±ãŒãžããæãåºããŸããã
Google Cloud Storageãæ¥ç¶ããããã®confãã¡ã€ã«ã«å¿ èŠãªå€æŽïŒ
æåŸã®ã³ãã³ãã¯ããã©ãŒã ã®ãªã³ã¯ã䜿çšããŠWEBçµç±ã§èªèšŒãéå§ããŸã
accounts.google.com/o/oauth2/auth?client_idbLaBlABBBBBLLLLAAAA
ã¹ãã¬ãŒãžæ¥ç¶ããŒã¯ã³ãäœæããããã«è¡ã«å ¥åããå¿ èŠãããèªèšŒã³ãŒããåãåã次第ã
ç§ã¯ãã®ããã«ããŠã³ãããŸãïŒ
gsutil Usage: gsutil [-D] [-DD] [-h header]... [-m] [-o] [-q] [command [opts...] args...]
æåã«æŽæ°ããå¿ èŠããããŸãïŒ
gcloud components update
ãã°ã€ã³ïŒ
root@host:~# gcloud auth login You are running on a GCE VM. It is recommended that you use service accounts for authentication. You can run: $ gcloud config set account ``ACCOUNT'' to switch accounts if necessary. Your credentials may be visible to others with access to this virtual machine. Are you sure you want to authenticate with your personal account? Do you want to continue (Y/n)? y Go to the following link in your browser: https://accounts.google.com/o/oauth2/auth? Enter verification code:
ãªã³ã¯ã¯10è¡ã§ããããå°ãçãããŸããã ãã®ãªã³ã¯ã«ãããGoogleãŠãŒã¶ãŒããã®ã¢ã¯ã»ã¹ãèš±å¯ãã確èªã³ãŒãã«æ¿å ¥ããIDãååŸããŸãã
ç§ã®å Žåããã±ããã«ã¢ã¯ã»ã¹ã§ããŸãã ããŠããŸãã¯äœæããããšãã§ããŸãïŒ
:~# gsutil ls gs://storage/ Bucket gsutil mb CommandException: The mb command requires at least 1 argument. Usage: gsutil mb [-c class] [-l location] [-p proj_id] uri.. :~# gsutil ls gs://storage/ gs://storage/gcsfs_0.15-1_amd64.deb
ããã«ãã¡ã€ã«ãæããŸããã
ãã±ãããšã·ã¹ãã ãã£ã¬ã¯ããªãåæã§ããŸãã
gsutil rsync -d -r gs://zp-storage/ /usr/src
ãŸããªã©ãªã©ã
Bucket gsïŒ// zp-storage /ããã£ã¬ã¯ããªãšããŠããŠã³ãããã«ã¯ãããã€ãã®ãµãŒãããŒãã£ãŠãŒãã£ãªãã£ã䜿çšããå¿ èŠããããŸãã
s3fuseã¯ã Amazon S3ãããŠã³ããããªã©ã åæ§ã®ç®çã§äœ¿çšããããŠãŒãã£ãªãã£ã§ã ã Cloud StorageïŒgoogleïŒãããŠã³ãããããã«äœ¿çšã§ãããšåœŒãã¯æžããŠããŸãããäœããã®çç±ã§ãå°ãªããšããã®ã¢ã¯ã·ã§ã³ã«é¢ããã³ã¡ã³ããå«ãããããããæ§æã¯èŠã€ãããŸããã§ããã
gcsfsã¯ãCloud StorageïŒgoogleïŒã§åäœãããŠãŒãã£ãªãã£ã§ã ã
äŸåããã±ãŒãžããs3fuseã¯ç«ã¡äžãããããœãŒã¹ããåéãããŸããã ãã«ãã¯é²è¡äžã§ã./configure && make && make installãããã«äŸåé¢ä¿ã®ãªã¹ãããããŸãã
aptitude install mpi-default-bin mpi-default-dev libboost-all-dev povray libxml++2.6-2 libxml++2.6-dev libfuse-dev libfuse
ããããgcsfsã¯debããã±ãŒãžããæãåºããŸããã
Google Cloud Storageãæ¥ç¶ããããã®confãã¡ã€ã«ã«å¿ èŠãªå€æŽïŒ
nano /etc/gcsfs.conf bucket_name=< bucket-> service=google-storage gs_token_file=/etc/gs.token touch /etc/gs.token gcsfs_gs_get_token /etc/gs.token
æåŸã®ã³ãã³ãã¯ããã©ãŒã ã®ãªã³ã¯ã䜿çšããŠWEBçµç±ã§èªèšŒãéå§ããŸã
accounts.google.com/o/oauth2/auth?client_idbLaBlABBBBBLLLLAAAA
ã¹ãã¬ãŒãžæ¥ç¶ããŒã¯ã³ãäœæããããã«è¡ã«å ¥åããå¿ èŠãããèªèšŒã³ãŒããåãåã次第ã
:/etc# /usr/bin/gcsfs Usage: gcsfs [options] <mountpoint> Options: -f stay in the foreground (ie, do not daemonize) -h, --help print this help message and exit -o OPT... pass OPT (comma-separated) to FUSE, such as: allow_other allow other users to access the mounted file system allow_root allow root to access the mounted file system default_permissions enforce permissions (useful in multiuser scenarios) gid=<id> force group ID for all files to <id> config=<file> use <file> rather than the default configuration file uid=<id> force user ID for all files to <id> -v, --verbose enable logging to stderr (can be repeated for more verbosity) -vN, --verbose=N set verbosity to N -V, --version print version and exit
ç§ã¯ãã®ããã«ããŠã³ãããŸãïŒ
/usr/bin/gcsfs -o allow_other /<>
ããã§å°ãªããšã1ã€ã®ã¹ãã€ã©ãŒãéããhautushechkaçµäº-ãããã£ãã
倧ããªãªã¯ãšã¹ãã Habrahabreã«é¢ããèšäºãæžãã以åã®çµéšã«åºã¥ããŠããã€ãã¹ãæ£åœåãããããé¡ãããŸãã ãããªããã°ãç§ã®çæãäœã§ãããã決ããŠç解ããå±éºããããŸãããã¬ãŒã³ããŒã·ã§ã³ã®ã¹ã¿ã€ã«ã詳现ãç§ã«ããæ å ±ã®èªèãšãã¬ãŒã³ããŒã·ã§ã³ã§ãã ã³ã¡ã³ãããšã«ãããžãã£ããªå ç·ãéããŸãã
UPD <03/12/2015>ïŒGoogle Cloudã€ã³ã¹ã¿ã³ã¹ã§ããŒã25ãä»ããéä¿¡ãéããããŸããïŒãããŠããŒã25ã§å¥ã®ãµãŒããŒã«æ¥ç¶ããŸããïŒã 絶察ã«ã 代ããã«ãããŒã587ã§éä¿¡ãããªã¬ãŒã¡ãŒã«ãµãŒããŒã䜿çšããããšããå§ãããŸãã