ã¯ããã«
ããã«ã¡ã¯ãã¤ã³ãã©ã¨ã³ã¸ãã¢ã®é´æ¨ã§ãã
ãã®è¨äºã¯ãæ ªå¼ä¼ç¤¾asken (ãããã) Advent Calendar 2024 ã®20æ¥ç®ã®è¨äºã§ãã
ããããã§ã¯ãä¸é¨æ©è½ã§OpenSearchã使ãå§ãã¦ãã¾ãã
ãã¨ãã°ãåã«ããã¯ã¨ã³ãã®é«æ©ãããOpenSearchãæ´»ç¨ããã¡ãã¥ã¼æ¤ç´¢ãè¨äºã«ãã¦ããã¦ãã¾ãã
ä»åã¯ãOpenSearchãåç¨ãµã¼ãã¹ã§åå¹´éç¨ããçµé¨ã§å¾ããããã¦ãã¦ã¨ãã¦ãåç¨éç¨ã«ããã注æç¹ããããã©ã¼ãã³ã¹ãä¸ããããã®æ¹æ³ãè¨è¼ãã¾ãã
â»æ¬è¨äºã§ã¯ãAmazon OpenSearch Serviceï¼AWSä¸ã§æä¾ãããOpenSearchï¼ãåæã¨ãã¦ãã¾ãã
OpenSearchã¯ä½ã«ä½¿ãã
OpenSearchã¯ä¸»ã«æ¤ç´¢ã«ä½¿ç¨ãã代表çãªç¨éã¯ãæååæ¤ç´¢ããããã¯ãã«æ¤ç´¢ãã§ãã
ç¹ã«ãæååã®é¨åä¸è´æ¤ç´¢ã¯RDBMSãªã©ã®ãã¼ã¿ãã¼ã¹ã§ã¯éããªããã¡ãªãããOpenSearchã®æ´»ç¨ãé©ãã¦ãã¾ãã
OpenSearchã®åºæ¬çãªæ§æã«ã¤ãã¦ã¯ãã¡ãã®ããã°ãåèã«ãªãã¾ãã
OpenSearchãå©ç¨ããéã®ãã¦ãã¦
æ¬è¨äºã§ç´¹ä»ãããã¦ãã¦ã¯ãæååæ¤ç´¢ããã¯ãã«æ¤ç´¢ã¨ãã£ãç°ãªãæ¤ç´¢ç¨éã«ããã¦ãå
±éãã¦é©ç¨å¯è½ãªãã®ã§ãã
éç¨ä¸ãåªå
ãã¦æ¼ããã¦ããã¹ããã¦ãã¦ã以ä¸ã«ã¾ã¨ãã¾ããã
ãã£ã¨å¹
åºã詳細ãªãã¦ãã¦ãç¥ãããæ¹ã¯AWSå
¬å¼ã®ãã¹ããã©ã¯ãã£ã¹ã«è¨è¼ããã¦ããããããã¡ããåç
§ãã¦ãã ããã
1. VPCå ï¼ãã©ã¤ãã¼ããããã¯ã¼ã¯ï¼ã«é ç½®ããã
- ãã¤ã³ãï¼ã»ãã¥ãªãã£å¼·åã®ãããOpenSearchã¯VPCå
ã«é
ç½®ãã¾ãããã
- VPCå ã«é ç½®ãããã¨ã§ãæ¥ç¶å ãã»ãã¥ãªãã£ã°ã«ã¼ãã§éå®ã§ãã¾ãã
- ãããªãã¯é ç½®ã§ãIPå¶éãªã©ãå¯è½ã§ãããã¢ã¯ã»ã¹èªä½ã¯ã§ãã¦æ¨©éãç¡ãã¨ããã¨ã©ã¼ã«ãªããããåå¨ã第ä¸è ã«èªèããããªã¹ã¯ãããã¾ãã
- 課é¡ã¨è§£æ±ºçï¼
- VPCå
ã«é
ç½®ããã¨ãOpenSearchãæã£ã¦ããããã·ã¥ãã¼ãï¼Kibanaï¼ã¸ã®ã¢ã¯ã»ã¹ã課é¡ã¨ãªãã¾ãã
- ããã·ã¥ãã¼ãã表示ããã«ã¯VPCå¤ã®ãã¼ã«ã«ãã·ã³ããVPCå ã«ã¢ã¯ã»ã¹ã§ããå¿ è¦ãããã¾ãã
- 以ä¸ã®ãããªè§£æ±ºçãããã¾ãã
ã»ãã·ã§ã³ããã¼ã¸ã£ã§ãã¼ããã©ã¯ã¼ãã£ã³ã°ãã¦ããã©ã¦ã¶ããã¢ã¯ã»ã¹ï¼åèããã°ï¼
ãã¼ããã©ã¯ã¼ãã£ã³ã°è¨å®ã®ã³ãã³ãä¾
aws ssm start-session --target [SSMæ¥ç¶ã§ããEC2ã®ã¤ã³ã¹ã¿ã³ã¹ID] \ --document-name AWS-StartPortForwardingSessionToRemoteHost \ --parameters '{"host":["OpenSearchã¨ã³ããã¤ã³ã"],"portNumber":["443(OpenSearchã®ãã¼ã)"],"localPortNumber":["ãã©ã¦ã¶ããæ¥ç¶ãããã¼ã"]}'
Amazon WorkSpaces Secure Browserã使ã£ã¦ããã©ã¦ã¶ããã¢ã¯ã»ã¹ï¼åèããã°)ï¼
- VPCå
ã«é
ç½®ããã¨ãOpenSearchãæã£ã¦ããããã·ã¥ãã¼ãï¼Kibanaï¼ã¸ã®ã¢ã¯ã»ã¹ã課é¡ã¨ãªãã¾ãã
2. é«å¯ç¨æ§æ§æãä½ãã
- ãã¤ã³ãï¼OpenSearchã®åç¨éç¨ã§ã¯ãå¯ç¨æ§ãé«ããããã«ä»¥ä¸ãå®æ½ãã¾ãããã
- 3AZæ§æï¼ãã¼ãã3ã¤ã®AZã«åæ£é ç½®
- ã¹ã¿ã³ãã¤AZãè¨å®ï¼ 1ã¤ã®AZãã¹ã¿ã³ãã¤å°ç¨ã«è¨å®
- ãã¹ã¿ã¼ãã¼ãã®å°å ¥ï¼æ¤ç´¢å¦çã¨ã¯å¥ã«ãã¼ã管çãæ å½ããå°ç¨ãã¼ããè¨å®
- æ±äº¬ãªã¼ã¸ã§ã³ã§ã®æ§æä¾
- AZã«åããã¦ãã¼ããä½æãããããã3ã®åæ°ãã§ãã¼ããä½æãã¾ãã
- ä¾: ãã¼ã¿ãã¼ã6å°ããã¹ã¿ã¼ãã¼ã3å°ã§æ§æ
- AZã«åããã¦ãã¼ããä½æãããããã3ã®åæ°ãã§ãã¼ããä½æãã¾ãã
[è£è¶³]
- ã¹ã¿ã³ãã¤AZ
- 3AZã«é ç½®ãããã¨ã§å¯ç¨æ§ãé«ã¾ãã¾ãããããã«OpenSearchã§ã¯å¯ç¨æ§ãé«ããããã«1ã¤ã®AZãã¾ããã¨ã¹ã¿ã³ãã¤ã«ããæ©è½ãããã¾ãã
- ã¹ã¿ã³ãã¤ã«ãªãAZã¯ä¸å®æéã§å ¥ãæ¿ããã®ã§ãAZé害ã®ã¨ãã«ããã®è¨å®ã ãã§å¯¾å¿ã§ãã¾ãã
- ãã¹ã¿ã¼ãã¼ã
- ãã¼ãã®å¢æ¸ããããã¤ãªã©ã®ç®¡çä½æ¥ãå°éã«å®æ½ãããã¼ãã§ãã
- ãã¹ã¿ã¼ãã¼ããä½ããã¨ãããã¼ã¿ãã¼ãã§åããã¨ã¯ãã¦ãããã®ã§ãããæ¬æ¥ã®æ¤ç´¢å¦çã¨ã¯å¥ã®ãã¨ããããã®ã§å®å®æ§ãä¸ããã¾ãã
3. ã·ã£ã¼ãã¨ã¬ããªã«é ç½®ã®æ¦ç¥ãèããã
OpenSearchãæ±ãä¸ã§é¿ããããã©é¿ããããªããã®ãããã¾ããããããã·ã£ã¼ããã§ãã
ãã©ã¤ããªã·ã£ã¼ãã¨ã¬ããªã«ã·ã£ã¼ããããã¾ãããã©ãè¨å®ãã¦è¯ããæ©ãç®æã§ãã
ããã©ã¤ããªã·ã£ã¼ããï¼å
ãã¼ã¿ãåå²ãããã®ã
ãã¬ããªã«ã·ã£ã¼ããï¼ãã©ã¤ããªã·ã£ã¼ããè¤è£½ãããã®ã
ã·ã£ã¼ãã®è¨å®ãOpenSearchã®æ§è½ã«å½±é¿ãã¦ãã¾ãã
- ãã¤ã³ãï¼ç¨éãã¹ãã¬ã¼ã¸ãµã¤ãºããã¼ãæ°ããã·ã£ã¼ãæ°ãèãã¾ãããã
- ã·ã£ã¼ãæ°ãèããåºæ¬å¼ã¯ä»¥ä¸ã«ãªãã¾ãã
å ¨ã·ã£ã¼ãæ° = ãã©ã¤ããªã·ã£ã¼ãæ° + (ãã©ã¤ããªã·ã£ã¼ãæ° Ã ã¬ããªã«ã·ã£ã¼ãæ°)
- ã·ã£ã¼ãæ°ãèããåºæ¬å¼ã¯ä»¥ä¸ã«ãªãã¾ãã
[åã·ã£ã¼ãæ°ã®èãæ¹]
- ãã©ã¤ããªã·ã£ã¼ãæ°ï¼ç¨éã¨ã¹ãã¬ã¼ã¸ãµã¤ãºãå
ã«æ±ºå®
- 1ã¤ã®ã·ã£ã¼ãã10ï½30 GiB (æ¤ç´¢ã¯ã¼ã¯ãã¼ãã®å ´å) ã¾ã㯠30ï½50 GiB (ãã°ã¯ã¼ã¯ãã¼ãã®å ´å)ã«ãªãããã«åå²ãã¾ãã
- ã¬ããªã«ã·ã£ã¼ãæ°ï¼ãã¼ã¿ãã¼ãã®æ°ãå
ã«æ±ºå®
- ãã¹ã¦ã®ãã¼ã¿ãã¼ãã«ã·ã£ã¼ããé
ç½®ãããããã«ãã¾ãã
- ä¾ï¼ãã¼ã¿ãã¼ã3å°ãªãããã©ã¤ããªã·ã£ã¼ã1ã¤ã«å¯¾ãã¬ããªã«ã·ã£ã¼ã2ã¤
ãã¼ã¿ãã¼ãã«å¯¾ãã¦ã¬ããªã«ãå«ããã·ã£ã¼ãã®æ°ã¯è¶³ãã¦ããã®ããããããã¤ã³ãã«ãªãããã以ä¸ã®ããã«å³ç¤ºãã¦æ´çããã¨ããããããã§ãã
ï¼å®éã¯åãã¼ãã«å¯¾ãã¦ããã£ã¨ãã©ãã©ã«é ç½®ããã¾ãããåããããã並ã¹ã¦ã¾ãï¼
- ä¾ï¼ãã¼ã¿ãã¼ã3å°ãªãããã©ã¤ããªã·ã£ã¼ã1ã¤ã«å¯¾ãã¬ããªã«ã·ã£ã¼ã2ã¤
- ãã¹ã¦ã®ãã¼ã¿ãã¼ãã«ã·ã£ã¼ããé
ç½®ãããããã«ãã¾ãã
4. JVM ã¡ã¢ãªãç£è¦ããã
OpenSearchã¯Javaãã¼ã¹ã§åä½ãã¦ãããJVMã¡ã¢ãªã®ç¶æ ãæ§è½ã«å¤§ããªå½±é¿ãä¸ãã¾ãã
ãã¤ã³ãï¼ã¡ã¢ãªä½¿ç¨çã§ã¯ãªãã
JVMMemoryPressure
ãï¼JVMã¡ã¢ãªè² è·ï¼ãç£è¦ãã¾ãããJVMMemoryPressureï¼å¹³åå¤ï¼ã¯ããã¤ã§ããã°è¯ãã®ãï¼åèï¼
- 40-60%以ä¸ï¼å®éã«éç¨ãã¦ã¿ã¦ã®çµé¨ãããå®å®éç¨å¯è½ã§ã
- 75%以ä¸ï¼GarbageCollectorï¼GCï¼çºåã«ããæ§è½ä½ä¸ã®å¯è½æ§ãããã¾ããJVMã¡ã¢ãªè² è·ã 75% ã«éããã¨ãGCãçºåãã¦é度ãè½ã¡ã¾ã
- 92%以ä¸ï¼æ¸ãè¾¼ã¿ãªãã¬ã¼ã·ã§ã³ããããã¯ãã¾ã
100%ï¼JVMã¡ã¢ãªä¸è¶³ã«ããããã»ã¹å¼·å¶çµäºï¼OOMï¼ãå¼ãèµ·ããã¾ã
以ä¸ã¯å®éã«éç¨ãã¦ããã¨ãã®
JVMMemoryPressure
ã®æç²ã§ããç·è²ã®ç·ãå¹³åå¤ã§40-60%以ä¸ã§å®å®æ¨ç§»ãã¦ãã¾ãã
ã¾ã¨ã
ãããã§ããã§ããããã
ããããOpenSearchãå°å
¥ããæ¹ãåç¨éç¨ã§èª²é¡ãæãã¦ããæ¹ã®åèã«ãªãã°å¹¸ãã§ãã
OpenSearchã«éãããããããã£ã¦ã¿ããã¨ã³ã¸ãã¢ã®æ¹ãaskenã§ã¯å¹
åºãåéãã¦ãã¾ãã
ãã²ãæ°è»½ã«ãé£çµ¡ãã ããï¼
www.asken.inc