scribeã«ãããã°é
éã«ã¤ãã¦ãããã試ããããã¤ã¤å®æ¦æå
¥ãã¦ããã®ã§ãã®è©±ã
ä»ã®ã¨ãããã¼ã¯æã§20Mbpsç¨åº¦ã®æµéã§ã100Mbpsãè¶
ãã¦ããããã«ãªãã¨æµéå¶éãã·ãã¢ã«èãããä¸ç¶ãµã¼ããè¤æ°å°æ§æã«ãããèãããã¨ã«ãªãã®ããªã¼ã¨æã£ã¦ããããç¾ç¶ã¯ã¾ã ããã¾ã§ãã£ã¦ãªããä¸ã®ä¸ã«ã¯èãã¦ãã人ããã£ããããã¯ããªã®ã§è©±ãèãã¦ã¿ãããªãããªãããåããã¦ã¿ããã¬ãã«ã®è©±ããããã£ã¦ãè¦ä»ãããªããæ²ããã
ãµã¼ãæ§æ
åãµã¼ããããã°ã(ã»ã¼)ãªã¢ã«ã¿ã¤ã ã«scribedã«æµãã®ã¯ããã¨ãã¦ã1å°ç«ã¦ã¦ãã ãã ã¨é害ããã£ããå
¨ã¦çµäºãã¦ãã¾ããããã¯ã¾ããã®ã§ãè¤æ°å°æ§æã«ããã
scribedã¯deliverã¨centralã®ä¸¡æ¹ã§èµ·åããã(è¨å®ã¯ãã¡ããç°ãªããå¾è¿°ã)
é常ã¯åãµã¼ãã¯ãã¹ã¦ deliver ãµã¼ãã«æ¥ç¶ãã¦ãã°ãéããdeliverãµã¼ãã¯ãããã¡ãªã³ã°ã®ã¿ãæ
å½ããåãåã£ããã°ã¯åºæ¬çã«ã¯ãã®ã¾ã¾ãã¹ã¦centralãµã¼ãã¸ã¨ä¸ç¶ãããcentralãµã¼ãã¯ä¿åãæ
å½ãããã£ã¹ã¯ã¸ã®æ¸ãè¾¼ã¿(ã¨åæã«hdfsã¸ã®æ¸ãè¾¼ã¿)ãè¡ãã
centralãµã¼ãã®é害æã«ã¯ãdeliverãµã¼ãã¯åãåã£ããã°ããã¼ã«ã«ãã£ã¹ã¯ã«ãããã¡ãªã³ã°ãããcentralãµã¼ããæ¥ç¶å¯è½ãªç¶æ ã«å¾©å¸°ããããããã¡ããããã°ã¯èªåçã«åéãããã®ã§ããã¼ã«ã«ãã£ã¹ã¯ã溢ããåã«centralã復帰ãããããã°ä½ãåé¡ã¯ãªãã(åéã«ã¤ãã¦ã¯è¨å®ä¸ã®æ³¨æç¹ããããå¾è¿°ã)
deliverãµã¼ãã®é害æã«ã¯å½ç¶ã ããåwwwãµã¼ãããã®ãã°é
éç¨ã³ãã¯ã·ã§ã³ãåãã¦éä¿¡ä¸å¯è½ãªç¶æ
ã«ãªãããã®ãã scribe_line ã§ã¯è¤æ°ã®scribedãæå®å¯è½ãªããã«ãã¦ãããæåã«æå®ãããµã¼ãã¸ã®éä¿¡ã失æããå ´åã¯èªåçã«2çªç®ä»¥éã®ãµã¼ãã«æ¥ç¶ãããå®éã«ä½¿ç¨ããã¨ãã«ã¯2çªç®ã«centralãµã¼ããæå®ãã¦ããã°ãdeliverãµã¼ãé害æã«ã¯æ¥ç¶ã¯centralã¸ãã§ã¤ã«ãªã¼ããããããåé¡ãªããã°ã®åéãç¶ç¶ã§ããã*1
scribedè¨å®
ä¸è¿°ããæ§æã§æ£å¸¸ã«åä½ãããããã以ä¸ã®ãããªæãã§è¨å®ãããä»ã®ã¨ããæµéå¶å¾¡ãããã©ã¼ãã³ã¹æ大åã«é¢ãã¦ã¯ãã¥ã¼ãã³ã°ãã¦ãªã(ã»ã¼ããã©ã«ãã®ã¾ã¾)ã®ã§ããã®ãããã¯ä¿¡ç¨ããªããã¨ã
deliver
port=1463 max_msg_per_second=1000000 check_interval=1 max_queue_size=100000000 num_thrift_server_threads=3 <store> category=default type=buffer target_write_size=20480 max_write_interval=1 retry_interval=120 retry_interval_range=60 buffer_send_rate=5 <primary> type=network remote_host=central.scribe.server remote_port=1463 add_newline=0 </primary> <secondary> type=file fs_type=std file_path=/home/deliver_buffer base_filename=access_log max_size=100000000 add_newline=0 </secondary> </store>
åç´ãª buffer store ã§ãé常㯠primary ã¨ãã¦è¨å®ãã network store(central) ã¸é
éãããprimaryã¸ã®é
éãä¸å¯è½ãªå ´åãsecondary(ãã¼ã«ã«ãã£ã¹ã¯)ã«ãããã¡ãªã³ã°ããã
ã¡ããã¨éç¨ããå ´åãsecondaryã®file storeã®ãã¹ã¯å®¹éãååã«ãããã¼ãã£ã·ã§ã³ãæå®ãããã¨ããã£ãããã¹ãæã®ã¾ã¾ /tmp ã¨ããã¦ããã¨é·æéç¨æã«ãã¯ã§ããªããã©ãã«ã«è¦èãããå¯è½æ§ããããã¾ã secondary ã® max_size ã«ã注æã(å¾è¿°)
central
port=1463 max_msg_per_second=1000000 check_interval=1 max_queue_size=100000000 num_thrift_server_threads=3 <store> category=default type=multi target_write_size=20480 max_write_interval=1 <store0> type=file fs_type=hdfs file_path=hdfs://node01.hadoop-cluster:50071/scribe base_filename=access_log create_symlink=no rotate_period=hourly rotate_minute=0 add_newline=0 </store0> <store1> type=file fs_type=std file_path=/home/archive base_filename=access_log create_symlink=no rotate_period=hourly rotate_minute=0 add_newline=0 </store1> </store>
ãã¡ãã¯åç´ãª multi store ã§ãä¿åå
ã¯hdfsã¨ãã¼ã«ã«ãã£ã¹ã¯ã®2ã¶æãè¨å®å
容ã¯ããã¾ãä½ãèãã¦ãªããcentralãé害ãã復帰ããã¨ãã«ç¡å¶éã«åéããã¦ãã¨ãããã¯ã¼ã¯ã®å¸¯åã使ãæ½°ããããªãã®ã§ããããæãå ´å㯠max_msg_per_second ã®å¤ãçµã£ã¦ããã°é©å½ã«å¶å¾¡ããªããåéãã¦ãããã
create_symlink=no ã«ãã¦ããã®ã¯ãsymlinkãã£ã¦ãå¥ã«å½¹ã«ç«ã£ãè¦ãããªãå²ã«é害試é¨ãã£ã¦ãã復帰æã«ãã©ãã«ã«ãªããã¨ããã£ããããå¥é tail -f ãã¤ã¥ãããã¨ãããè¦æã§ããªããã° no ã§ããã¨æãã
rotate_period 㯠hourly 以å¤ã«æå®ãã¦ããªãããããã©ã«ã㧠max_size 1,000,000,000 bytes ãå®ã¾ã£ã¦ããããã1æéã®ãã¡ã«ãããè¶
ããéãæ¸ãè¾¼ã¾ããå ´åã¯èªåçã«rotateããããã ããçæããããã¡ã¤ã«å(æ¥ä»+çæé ã®é£çª)ã¯æå»ã¨ã¤ã³ã¼ã«ã«ã¯ãªããªãã*2
deliverãµã¼ãã«ããã buffer store ã®è¨å®ã¨åä½
deliverãµã¼ãã®è¨å®ã«ããã¦ãé害æã«åé¡ã«ãªãé
ç®ã1ç¹ããã£ã¦ãã¦ãsecondary ã® max_size ã ããã£ããããã¨å²ã¨è´å½çãªã®ã§ãæåããæèãã¦ãããæ¹ãããããã(ã¾ãããã©ã«ãã®ã¾ã¾ã§åé¡ãªããã ãã©ã)
ç°¡åã«è¨ãã°ãbuffer store ã® max_size ã«å¤§ããå¤ãæå®ãã¦ã¯ãããªãã8GBã¡ã¢ãªãç©ãã§ãããã·ã³ã2.4GBãããã§æ»äº¡ããã®ã§å¤åGBã®ãªã¼ãã¯å±éºã ãããã©ã«ãã®100MBã§ããã°æ¥µãã¦å®å®ãã¦åä½ããã®ã§ãããããå¤ããªãã®ãè¯ãã
以ä¸ãbuffer storeã®åéã¡ã«ããºã ã®èª¬æãããªãã説æããã
åã«ãæ¸ããããbuffer storeã¯é常ã¯ä½ãããã«åãåã£ããã°ããã®ã¾ã¾ primary store ã¸ã¨æ¸¡ããä»ã®å ´å㯠primary ã« network ãæå®ãã¦ãã£ã¦ãé
éå
㯠central ãµã¼ãã ãsecondaryã«æå®ãããã¹ã«ã¯ 0 byte ã®ãã¡ã¤ã«ãä½ãããã ãã¨ãªãã
primaryã¸ã®æ¸ãè¾¼ã¿ãä¸å¯è½ãªç¶æ
ã¨ãªã£ãã¨ããbuffer storeã¯secodary storeãæ¹ãã¦openããåãåã£ããã¼ã¿ãããã«æ¸ãè¾¼ãã
ãã®æ¸ãè¾¼ã¿å
ãã¡ã¤ã«ã¯å®¹éã max_size ã«ãªãã¨ãã¼ãã¼ããããããmax_size ã大ããå¤ã«è¨å®ããã¦ããå ´å*3ã¯åä¸ãã¡ã¤ã«ã®ã¾ã¾ããããã¨æ¸ãè¾¼ã¿ãç¶ããã
å®éã®ã¨ãããæ¸ãã¦ããã ãã®ãã¡ã¯ç¹ã«åé¡ã¯ãªããããã primary store ã«æå®ãã¦ããcentralãµã¼ããæ¥ç¶å¯è½ãªç¶æ
ã«å¾©å¸°ããã¨åé¡ãçºçããã
buffer storeã¯primary復帰æã®åé(BUFFER_SENDINGç¶æ
)ã«ããã¦ã次ã®ããã«åä½ããã
- secondaryã«åå¨ãããã°ãã¡ã¤ã«ã«å¯¾ãã¦
- ãã¡ã°ãå¤ããã°ãã¡ã¤ã«ãé¸æã
- ãã®ãã¡ã¤ã«ã«å¯¾ããæ¸ãè¾¼ã¿ãããã¯ãã¦
- ãã¡ã¤ã«å ¨ä½ãä¸æ°ã« primary ã«éã
ãã®ãã以ä¸ã®2ç¹ã注æãã¹ããã¨ã¨ãªãã
- ã¡ã¢ãªã®ä½¿ç¨é
- ãã¡ã¤ã«å ¨ä½ãéãã¨ããã©ããä¸åº¦ã¡ã¢ãªã«èªã¿è¾¼ãããã£ã¦ãã£ã½ãããã¡ã¤ã«ãµã¤ãºã大ããã¨scribedã®ã¡ã¢ãªä½¿ç¨éãè·³ãä¸ããã2.4GBã®ãã¡ã¤ã«ãåéãããã¨ããã¨ãã¯8GBãã£ãã¡ã¢ãªã使ãæ½°ãã¦åä½ãã¹ã¿ãã¯ãã¦ããã£ã½ãã£ãã100MBã®ãã¡ã¤ã«ã«å¯¾ãã¦ã¯1GBãã¡ã¢ãªã使ã£ã¦ãªãã£ãããã«è¦ããã(åé¡ã«ãªããªãç¨åº¦ã ã£ãã®ã§ããã¾ãã¡ããã¨ç¢ºèªãã¦ãªãã)
- åéä¸ã«åãåããã°
- deliverãµã¼ããåéä¸ã«æ°ããåãåã£ããã°ã¯ secondary store ã«ããããææ°ã®ãã¡ã¤ã«ãã«æ¸ãè¾¼ã¾ãããããã¦ãææ°ã®ãã¡ã¤ã«ã == ããã¡ã°ãå¤ããã¡ã¤ã«ãã®ç¶æ (secondary storeã«ãã¡ã¤ã«ãã²ã¨ã¤ã ãã®ç¶æ )ã§ã¯æ¸ãè¾¼ã¿å¯¾è±¡ã®ãã¡ã¤ã«ã¯ããã¯ããã¦ãããããã¯ã©ã¤ã¢ã³ã㯠TRY_LATER ã¬ã¹ãã³ã¹ãåãåã£ã¦æ¸ãè¾¼ã¿ã¯ã§ããªãç¶æ ã¨ãªãã
ç¹ã«2ç¹ç®ã«ã¤ãã¦ã¯ãã©ã®ããã«è¨å®ãã¦ã secondary store ã®æå¾ã®1ãã¡ã¤ã«ãåéããæã«ä¸æçã«ã¯ãã°ãåãåããªãç¶æ ã¨ãªãã®ã ããåéå¦çã«æéããããã¨ãã°åä¿¡ãä¸å¯è½ãªæéãé·æéã«ããã£ã¦ãã¾ããããã©ã®ãããªåé¡ãèµ·ãããããããªãã*4
secondary store ã® max_size ãå°ããå¤(100MBç¨åº¦)ã«ãã¦ãã㨠primary store ã«æ¸ãè¾¼ããªãéã«åãåã£ããã°ã¯100MBã®å°ãããã¡ã¤ã«ã«åå²ãããªããæ ¼ç´ãããã
secondary storeã®ãã¡ã¤ã«ãè¤æ°ã«åå²ããã¦ããç¶æ
ã§primary storeã復帰ããã¨åéãè¡ããããã対象ã¯ãã£ã¨ãå¤ããã®ããé çªã«ã¨ãªãããããã®éã«éããã¦ãããã°ã¯ææ°ã®ãã¡ã¤ã«ã«å¼ãç¶ãæ¸ãè¾¼ã¿ãç¶ãããããã°ã®åªå¤±ã¯é¿ããããã
åéãçµãã£ããã¡ã¤ã«ã¯åé¤ãããããå¾ã
ã«æ®ãã®ãã¡ã¤ã«æ°ãæ¸ã£ã¦ãããæå¾ã®1ãã¡ã¤ã«ã®åé(ãã®ã¨ãã¯æ°ãããã°ã®åä¿¡ã¯å¾
ãããã)ãå®äºããã°ãæåã®ç¶æ
ã«æ»ã£ã¦å¾©å¸°å®äºã ã
æå ã®ç°å¢ã§ã¯ secodary store ã® max_size ã100MBã®ã¨ãã1ãã¡ã¤ã«ã®åéã«ããã£ãæéã¯10ç§ç¨åº¦ã ã£ããæå¾ã®1ãã¡ã¤ã«ã®å¦çã§æ°è¦ãã°ã®åä¿¡ãå¾ ããããæéãæ大ã§ã10ç§ç¨åº¦ã ã¨ããã¨ãã¾ã許容ç¯å²å ãããªãã ãããã
çµè«
ããã©ã«ãå¤ãä¿¡ãããæå³ãããããè¿éã«ãã«ãå¤ã¨ãè¨å®ããããããã
ããã ãã§ãããã»ãã¨ããã¾ãããããé害ãã¹ããã£ã¦ã¦ããã£ããããããã ãã©ãã
*1:ãªã30ååå¾ã§ã³ãã¯ã·ã§ã³ãå¼µãç´ãããã«ãã¦ããããã®éã¯1çªç®ã«æå®ããããµã¼ãããé 次æ¥ç¶ã試è¡ãããããdeliverã復帰ããããã®ãã¡å ¨ã¦ã®ã³ãã¯ã·ã§ã³ãdeliverã¸ã®æ¥ç¶ã«èªåã§ãã§ã¤ã«ããã¯ãããã¾ãscribe_line.pyã¸SIGHUPãéãã°å³åº§ã«ãã§ã¤ã«ããã¯ããã
*2:ã©ããã¦ãã¤ã³ã¼ã«ã«ããããã° max_size ã«éç¾å®çãªãµã¤ãºãæ¸ãã¦ããã°ããã¨æããã©ãããã¾ãããããã§ããªããªãã
*3:ã§ãã㤠rotate_period ãæå®ããã¦ããªãå ´åãbuffer storeã®secondaryã«rotate_periodãæå®ããæå³ã¯çç¡ãªã®ã§ãã¾ãèããªãã¦ããã ããã
*4:å ·ä½çã«ã¯ããã®ã¨ãwwwãµã¼ãå´ã§ãã°ãã¡ã¤ã«ãrotateãããã¨ãå¤årotateåã®ãã°ã¯é信対象ããå¤ãã¦ãã¾ããããã©ãããªãå¾®å¦ããã試ãã¦ã¯ããªãã