ã¡ãã£ã¨æ¥é±ã®ä¸å¤®ç· Meetup ã§çºè¡¨ãã Consul ã®è³æãã¤ãã£ã¦ãããã ãã©ãã¤ãã£ã¦ããããããè奮ãã¦ãã¦ç°å¸¸ã«è奮ãã¦ãã¦ã ãããã£ã±ã Consul ã£ã¦ã¹ã´ããããã¿ãããªç±ãæ°æã¡ãåé²ããããªã£ãã®ã§çºè¡¨è³æã¾ã ããããä½ã£ã¦ãªããã§ããã©ããã«çºé²ãã¾ãã
ãã¤ãã¯çµæ§ç¢ºèªããªããã¨ã³ããªãããã§ããã©ä»æ¥ã¯ä¸æ°ã«çæéã§ã¬ã¼ã£ã¦æ¸ããã®ã§ã¾ã¡ããã¨ãããããããã¨æãã¾ããã©ããããã
- ãã¤ã¦æãæãã¦ããåæ£ã·ã¹ãã ã®æªæ¥
- å ±æãããã¼ã¿ã«ãã£ã¦åºããæªæ¥
- ä¼æ¬ã·ã¹ãã ã¨ãã¦ã
- ä»ã®ãããã¯ãã¨ã®çµã¿åãã
- ããããããã§
ãã¤ã¦æãæãã¦ããåæ£ã·ã¹ãã ã®æªæ¥
ãªã«ãããããã£ã¦ããã£ã±ãèªå¾åæ£çãªã¨ãã㧠Gossiping 㨠Raft ã使ã£ã¦æ´åæ§ã®ããæ å ±å ±æãã§ããããã«ãªã£ã¦ããã£ã¦ããã¨ããããããã¨æããã§ããã ãããããæ å ±å ±æã«é¢ããç 究ããã¦ãããã¼ãã足ãã¤ã£ããã§ã¯ãããã§ããã©ãå®éã«ä½¿ãããããããã¯ãã¨ãã¦å®ç¾ãããããã£ã±ããªã©ããã£ã¦ãªããããªãã§ããããã¾ããã ãã©ãã
ããã¹ã¤ã« Raft 使ãã°æ´åæ§ã®ããæ å ±å ±æã¯å¯è½ãªãã ãã©ããããªãã¨ãªããªãã¹ã±ã¼ã«ããªãã¿ãããªãã§ããããRaft çµæ§ããã©ãããã
ãããã Consul 㯠Raft ã® Peer 㯠1 ã¯ã©ã¹ã¿ããã 3 å°ã¨ã 5 å°ã«ãã¦ããã¨æ°åã¨ãæ°ä¸å°ã®ãã¼ã㯠Gossiping (SWIM) ãã¨ãã°è¯ãã§ããã£ã¦ããã¢ã¼ããã¯ãã£ãæ¡ç¨ãã¦ããã ãããããã¼ãã¯ãã¨ããããèªãã¼ãã¨èªãã¼ãä¸ã§åããµã¼ãã¹ãç£è¦ãã¦ãã®çµæã Gossiping ãã¨ãã°è¯ãã¦ããã®çµæã Anti-Entropy ã¨ã㦠Consul Server (Raft ã® Peer) ã«åæãã¦ããã°ããã¨ã¯ Consul Server ã Raft ã§ãããããã£ã¦ãããã
ããã§ãªãããæ å ±å ±æã§ããããããRaft ã§é¸åºããã Leader ãåãã¦ããæ å ±ã¯ä»ã® Raft Peer ã«ã¬ããªã±ã¼ã·ã§ã³ããã¦ããã SPoF ãªããã ãã£ã±ãåæ£ã·ã¹ãã 㧠SPoF ãªãã£ã¦ããã¨ããã«ãã ãã£ã¦ãã®ãããè¯ããªã¨æãã¾ãã
SWIM 㯠SWIM ã§ããããããã§ãããããã¿ã¤ãã®æ å ±ä¼æ¬ã·ã¹ãã ã£ã¦ã©ããã¦ãã³ãã¥ãã±ã¼ã·ã§ã³ã®è² è·ãã§ãããªããã¡ãªãã ãã©ããã®åé¡ããããããã«è§£æ±ºãã¦ããã¦ãã æ å ±ä¼æ¬ã¨åæ£æ éæ¤åºãçµã¿åããã¦ãããããã®å®ç¾ããã®ã£ã¦ããããHashiCorp ãããã
å ±æãããã¼ã¿ã«ãã£ã¦åºããæªæ¥
Consul ã¨ããã¨ã©ããã¦ã Service Discovery ã¨ãã®å¿ç¨ã注ç®ãããã¡ãªæ°ããã¦ãããã§ãããService Discovery 㯠ãã¼ãã Service ã®ãã«ã¹ãã§ãã¯ã®çµæãå ±æãããã¨ããçã¾ããã¦ã¼ã¹ã±ã¼ã¹ã®ä¸ã¤ã§ãããªãã¦ãConsul ã®ã¦ã¼ã¹ã±ã¼ã¹ã¯ãã£ã¨åºç¯ã ã¨æã£ã¦ã¾ãã
ãã¶ãèªå¾åæ£ã·ã¹ãã ã®ä¸ã§è¨å®æ
å ±ãå
±æãããã¨æã£ãã®ã Consul ã® Key-Value Store ã ã¨æããã
ããã¯ãå
±æã§ããã°è¯ãããããã£ã¦ã®ã consul lock
ã§ã§ããåæ£ããã¯/åæ£ã»ããã©ã«ç¹ãã£ã¦ãããã«æãã¾ãã
Consul Connect ãªãã¦ã®ã¯ã証ææ¸ã¨éä¿¡ã«ã¼ã«ã Consul ä¸ã§å
±æã§ããããã§ãã¦ãããã¨ã ã¨æãã¾ãã
大ãããããããªããã©ãConsul ãåæ£ã·ã¹ãã ä¸ã®æ å ±å ±æã·ã¹ãã ã¨è¦ç«ã¦ããã¨ã§ããã®ã¦ã¼ã¹ã±ã¼ã¹ã£ã¦ããªãåºå¤§ãªæãããã¦ãã¦ã ãã®åºå¤§ãªå¹³éãã¡ãã£ã¨ãã¤è¦ãã¦ãã¦ããæ°ãããã
ä¼æ¬ã·ã¹ãã ã¨ãã¦ã
å
±æã¨ã¨ãã«ä¼æ¬ã·ã¹ãã ã¨ãã¦ã使ããã¨ãã§ãã¦ããã¤ãã£ããªã¤ãã ã¨ãconsul exec
ã§ãã¼ãã«é©å½ãªã³ãã³ããå®è¡ããããã§ãããã
consul watch
㨠consul event
ã®çµã¿åããã§ãã¤ãã³ãã«åå¿ãããã·ã¹ãã ãã¤ãããã¨ãã§ããã
ããããã®ããããã«å©ç¨ããã®ã stretcher ã ã¨æãããã¾ã ä»ã«ãå¿ç¨ä¾ã£ã¦ããããããããã
ä»ã®ãããã¯ãã¨ã®çµã¿åãã
ã§ããããã Consul ã®ã¦ã¼ã¹ã±ã¼ã¹ãåºãããããã¯ããé åçãªã®å¤ãã¦ããã¨ãã° consul ã® key-vaule store ã§ç°å¢å¤æ°ãä¸å 管çããã楽ãããã£ã¦ã®ã envconsul ã£ã¦ã¤ãã§ã ãªã«ãã£ã¦ããã¨ãconsul ã® key-value store ã«ç°å¢å¤æ°ã®ãã¦ããã¨ãåæã«ãããç£è¦ãããã¼ã¢ã³ã§ãã
ãã®ãã¼ã¢ã³ã¯ãµãããã»ã¹ãç«ã¡ä¸ããããããã«ãªã£ã¦ã¦ãk/v store ä¸ã®ç°å¢å¤æ°ã«å¤æ´ããã£ããããã®ç°å¢å¤æ°ãåæ ãããµãããã»ã¹ãåèµ·åãã¦ãããã£ã¦ããæ©è½ãæã£ã¦ã¦ã12 factor app ããã©ããçãªã¤ãã§ãã
ã»ãã«ããconsul ã£ã¦åºæ¬çã«ãã¼ãã«ã¤ã³ã¹ãã¼ã«ãããã¨ãåæãªãã ãã©ãä¸ã®ä¸ã«ã¯ãããããã¨ãã§ããªããã¼ãã£ã¦ã®ããã£ã¦ã ãªãããã£ã¡ãã¬ã¬ã·ã¼ãªã·ã¹ãã ã¨ãããªããã®ã¢ãã©ã¤ã¢ã³ã¹ã¨ããããããªãã§ãããããããã®ã®ä¸ã§åããµã¼ãã¹ã¨ãããã§ãã¯ã¨ãã§ããããã«ã£ã¦ããã®ããconsul-esm ã£ã¦ã¤ãã
ãã¨ããã¶ãä¸çªæåãªã®ã¯ consul-template ã ã¨æããã©ãããã¯ã°ã°ã£ãããããã§ã解説è¨äºããã®ã§ããã£ã¡è¦ãã便å©ããåããã¨æãã
ãã¨ãªãã consul ã«å®å ¨å¯¾å¿ãã Reverse Proxy 㧠Fabio ã¨ãããã®ããã£ã¦ãConsul ã®ãã«ã¹ãã§ãã¯çµæããã®ã¾ã¾ãã©ã³ã·ã³ã°ã«ä½¿ãããããã
ããããããã§
ã¼ãã¯ãã£ããããããããã¯ãã ãªã£ã¦æã£ã¦ãã¦ãConsul Connect ã¯æåããããããããã©ãConsul ã¯ãããããã©ãã©ãå©ç¨ããã¦ã»ãããªã£ã¦æããã ä»å¾ã¨ã注ç®ãç¶ãã¦ãããããªã¨æãæåã§ãã