±à¼ÍƼö: |
±¾ÎÄÖ÷Òª½éÉÜkuduÊÇʲô£¬kuduÔÀí¼Ü¹¹£¬¶ÁдÁ÷³ÌµÈµÈ£¬¸ü¶àÇë¿´ÏÂÎÄ¡£
±¾ÎÄÀ´×Ôcnblogs£¬ÓÉ»ðÁú¹ûÈí¼þAnna±à¼¡¢ÍƼö¡£ |
|
1¡¢kudu½éÉÜ
kudu ¶¨Î»ÊÇ ¡¸Fast Analytics on Fast Data¡¹£¬ÊÇÒ»¸ö¼ÈÖ§³ÖËæ»ú¶Áд¡¢ÓÖÖ§³Ö
OLAP ·ÖÎöµÄ´óÊý¾Ý´æ´¢ÒýÇæ¡£
ÔÊý¾Ý´æ´¢ÓÚHDFS»òHBase¶¼ÓÐÓÅȱµã£º
Ö±½Ó´æ·ÅÓÚHDFSÖУ¬ÊʺÏÀëÏß·ÖÎö£¬È´²»ÀûÓڼǼ¼¶±ðµÄËæ»ú¶Áд¡£
Ö±½Ó½«Êý¾Ý´æ·ÅÓÚHBase/CassandraÖУ¬ÊʺϼǼ¼¶±ðµÄËæ»ú¶Áд£¬¶ÔÀëÏß·ÖÎöÈ´²»ÓѺá£

2¡¢kuduÔÀí¼Ü¹¹
²ÉÓÃÁËMaster-SlaveÐÎʽµÄÖÐÐĽڵã¼Ü¹¹£¬¹ÜÀí½Úµã±»³Æ×÷ Master Server£¬Êý¾Ý½Úµã±»³Æ×÷Tablet
Server£¨¿É¶Ô±ÈÀí½âHBaseÖеÄRegionServer½ÇÉ«£©¡£
Mater Server£º¸ºÔð¼¯Èº£¨TS£©¹ÜÀí¡¢ÔªÊý¾Ý¹ÜÀíµÈ¹¦ÄÜ
Tablet Server£º¸ºÔðÊý¾Ý´æ´¢£¬²¢ÌṩÊý¾Ý¶Áд·þÎñ
Ò»¸ö±íµÄÊý¾Ý£¬±»·Ö¸î³É1¸ö»ò¶à¸öTablet£¬Tablet±»²¿ÊðÔÚTablet ServerÀ´ÌṩÊý¾Ý¶Áд·þÎñ¡£
Kudu MasterÔÚKudu¼¯ÈºÖУ¬·¢»ÓÈçϵÄһЩ×÷Óãº
ÓÃÀ´´æ·ÅһЩ±íµÄSchemaÐÅÏ¢£¬ÇÒ¸ºÔð´¦Àí½¨±íµÈÇëÇó¡£
¸ú×Ù¹ÜÀí¼¯ÈºÖеÄËùÓеÄTablet Server£¬²¢ÇÒÔÚTablet ServerÒì³£Ö®ºóе÷Êý¾ÝµÄÖØ²¿Êð¡£
´æ·ÅTabletµ½Tablet ServerµÄ²¿ÊðÐÅÏ¢¡£

tablets ÔÚ Kudu ÀïÃæ±»ÇзֳɸüСµÄµ¥Ôª RowSets£º

MemRowSets¿ÉÒÔ¶Ô±ÈÀí½â³ÉHBaseÖеÄMemStore, ¶øDiskRowSets¿ÉÀí½â³ÉHBaseÖеÄHFile¡£MemRowSetsÖеÄÊý¾Ý°´ÕÕÐÐÊÔͼ½øÐд洢£¬Êý¾Ý½á¹¹ÎªB-Tree¡£MemRowSetsÖеÄÊý¾Ý±»Flushµ½´ÅÅÌÖ®ºó£¬ÐγÉDiskRowSets¡£
DiskRowSetÖеÄÊý¾Ý°´ÕÕColumn½øÐÐ×éÖ¯£¬ÓëParquetÀàËÆ¡£ÕâÊÇKudu¿ÉÖ§³ÖһЩ·ÖÎöÐÔ²éѯµÄ»ù´¡¡£
Ò»¸öDiskRowSet°üº¬Á½²¿·ÖÊý¾Ý£º»ù´¡Êý¾Ý(Base Data)£¬ÒÔ¼°±ä¸üÊý¾Ý(Delta
Stores)¡£¸üÐÂ/ɾ³ý²Ù×÷ËùÉú³ÉµÄÊý¾Ý¼Ç¼£¬±»±£´æÔÚ±ä¸üÊý¾Ý²¿·Ö¡£

DeltaÊý¾Ý²¿·Ö°üº¬REDOÓëUNDOÁ½²¿·Ö£º
REDO Delta Files°üº¬ÁËBase Data×ÔÉÏÒ»´Î±»Flush/CompactionÖ®ºóµÄ±ä¸üÖµ¡£REDO
Delta Files°´ÕÕTimestamp˳ÐòÅÅÁС£
UNDO Delta Files°üº¬ÁËBase Data×ÔÉÏÒ»´ÎFlush/Compaction֮ǰµÄ±ä¸üÖµ¡£ÕâÑù²Å¿ÉÒÔ±£ÕÏ»ùÓÚÒ»¸ö¾ÉTimestampµÄ²éѯÄܹ»¿´µ½Ò»¸öÒ»ÖÂÐÔÊÓͼ¡£UNDO°´ÕÕTimestampµ¹ÐòÅÅÁС£
kudu client Óë ·þÎñ¶Ë½»»¥£¬ÏÈ´Ó Master Server
»ñȡԪÊý¾ÝÐÅÏ¢£¬È»ºóÈ¥ Tablet Server ¶ÁдÊý¾Ý£¬ÈçÏÂͼ£º

3¡¢¶ÁдÁ÷³Ì
3.1¡¢Ð´Êý¾Ý


µ± Client ÇëÇóдÊý¾Ýʱ£¬Ïȸù¾ÝÖ÷¼ü´Ó Mater Server ÖлñȡҪ·ÃÎʵÄÄ¿±ê Tablets£¬È»ºóµ½ÒÀ´Î¶ÔÓ¦µÄ
Tablet »ñÈ¡Êý¾Ý¡£ÒòΪ KUDU ±í´æÔÚÖ÷¼üÔ¼Êø£¬ËùÒÔÐèÒª½øÐÐÖ÷¼üÊÇ·ñÒѾ´æÔÚµÄÅжϣ¬ÕâÀï¾ÍÉæ¼°µ½Ö®Ç°ËµµÄË÷Òý½á¹¹¶Ô¶ÁдµÄÓÅ»¯ÁË¡£Ò»¸ö
Tablet ÖдæÔںܶà¸ö RowSets£¬ÎªÁËÌáÉýÐÔÄÜ£¬ÎÒÃÇÒª¾¡¿ÉÄܵؼõÉÙҪɨÃèµÄ RowSets
ÊýÁ¿¡£Ê×ÏÈ£¬ÎÒÃÇÏÈͨ¹ýÿ¸ö RowSet ÖмǼµÄÖ÷¼üµÄ£¨×î´ó×îС£©·¶Î§£¬¹ýÂ˵ôÒ»Åú²»´æÔÚÄ¿±êÖ÷¼üµÄ
RowSets£¬È»ºóÔÚ¸ù¾Ý RowSet ÖеIJ¼Â¡¹ýÂËÆ÷£¬¹ýÂ˵ôÈ·¶¨²»´æÔÚÄ¿±êÖ÷¼üµÄ RowSets£¬×îºóÔÙͨ¹ý
RowSets ÖÐµÄ B-Ê÷Ë÷Òý£¬¾«È·¶¨Î»Ä¿±êÖ÷¼üÊÇ·ñ´æÔÚ¡£Èç¹ûÖ÷¼üÒѾ´æÔÚ£¬Ôò±¨´í£¨Ö÷¼üÖØ¸´£©£¬·ñÔò¾Í½øÐÐдÊý¾Ý£¨Ð´
MemRowSet£©¡£
3.2¡¢¸üÐÂÊý¾Ý
¶¨Î»µ½¾ßÌåλÖúó£¬È»ºó½«±ä¸üдµ½¶ÔÓ¦µÄ delta store ÖС£

3.3¡¢¶ÁÊý¾Ý
Ïȸù¾ÝҪɨÃèÊý¾ÝµÄÖ÷¼ü·¶Î§£¬¶¨Î»µ½Ä¿±êµÄ Tablets£¬È»ºó¶ÁÈ¡ Tablets ÖÐµÄ RowSets¡£ÔÚ¶Áȡÿ¸ö
RowSet ʱ£¬Ïȸù¾ÝÖ÷¼ü¹ýÂËÒª scan ·¶Î§£¬È»ºó¼ÓÔØ·¶Î§ÄÚµÄ base data£¬ÔÙÕÒµ½¶ÔÓ¦µÄ
delta stores£¬Ó¦ÓÃËùÓбä¸ü£¬×îºó union ÉÏ MenRowSet ÖеÄÄÚÈÝ£¬·µ»ØÊý¾Ý¸ø
Client¡£

4¡¢´æ´¢Éè¼Æ
ÁÐʽ´æ´¢
ÓÅÊÆ**
²éѯÉÙÁ¿ÁÐʱ IO ÉÙ£¬ËÙ¶È¿ì
Êý¾ÝѹËõ±È¸ß
±ãÓÚ²éѯÒýÇæÐÔÄÜÓÅ»¯£ºÑÓ³ÙÎﻯ¡¢Ö±½Ó²Ù×÷ѹËõÊý¾Ý¡¢ÏòÁ¿»¯Ö´ÐÐ
ÁÓÊÆ
²éѯÁÐÌ«¶àʱÐÔÄÜϽµ£¨KUDU ½¨ÒéÁÐÊý²»³¬¹ý 300 £©
²»ÊÊºÏ OLTP ³¡¾°

·ÖÇø
Óë´ó¶àÊý´óÊý¾Ý´æ´¢ÒýÇæÀàËÆ£¬KUDU ¶Ô±í½øÐкáÏò·ÖÇø£¬KUDU ±í»á±»ºáÏòÇзִ洢ÔÚ¶à¸ö tablets
ÖС£²»¹ýÏà±ÈÓëÆäËû´æ´¢ÒýÇæ£¬KUDU ÌṩÁ˸ü¼Ó·á¸»Áé»îµÄÊý¾Ý·ÖÇø²ßÂÔ¡£
Ò»°ãÊý¾Ý·ÖÇø²ßÂÔÖ÷ÒªÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇ Range Partitioning£¬°´ÕÕ×Ö¶ÎÖµ·¶Î§½øÐзÖÇø£¬HBase
¾Í²ÉÓÃÁËÕâÖÖ·½Ê½£¬ÈçÏÂͼ£º

Range Partitioning µÄÓÅÊÆÊÇÔÚÊý¾Ý½øÐÐÅúÁ¿¶ÁµÄʱºò£¬¿ÉÒ԰Ѵ󲿷ֵĶÁ±ä³Éͬһ¸ö
tablet ÖеÄ˳Ðò¶Á£¬Äܹ»ÌáÉýÊý¾Ý¶ÁÈ¡µÄÍÌÍÂÁ¿¡£²¢ÇÒ°´ÕÕ·¶Î§½øÐзÖÇø£¬ÎÒÃÇ¿ÉÒԺܷ½±ãµÄ½øÐзÖÇøÀ©Õ¹¡£ÆäÁÓÊÆÊÇͬһ¸ö·¶Î§ÄÚµÄÊý¾ÝдÈë¶¼»áÂäÔÚµ¥¸ö
tablet ÉÏ£¬Ð´µÄѹÁ¦´ó£¬ËÙ¶ÈÂý¡£
ÁíÒ»ÖÖ·ÖÇø²ßÂÔÊÇ Hash Partitioning£¬°´ÕÕ×Ö¶ÎµÄ Hash Öµ½øÐзÖÇø£¬Cassandra
²ÉÓÃÁËÕâ¸ö·½Ê½£¬¼ûÏÂͼ£º 
Óë Range Partitioning Ïà·´£¬ÓÉÓÚÊÇ Hash ·ÖÇø£¬Êý¾ÝµÄдÈë»á±»¾ùÔȵķÖÉ¢µ½¸÷¸ö
tablet ÖУ¬Ð´ÈëËٶȿ졣µ«ÊǶÔÓÚ˳Ðò¶ÁµÄ³¡¾°ÕâÒ»²ßÂԾͲ»Ì«ÊÊÓÃÁË£¬ÒòΪÊý¾Ý·ÖÉ¢£¬Ò»´Î˳Ðò¶ÁÐèÒª½«¸÷¸ö
tablet ÖеÄÊý¾Ý·Ö±ð¶ÁÈ¡²¢×éºÏ£¬ÍÌÍÂÁ¿µÍ¡£²¢ÇÒ Hash ·ÖÇøÎÞ·¨Ó¦¶Ô·ÖÇøÀ©Õ¹µÄÇé¿ö¡£
¸÷ÖÖ·ÖÇø²ßÂÔµÄÓÅÁӶԱȼûÏÂͼ£º

¼ÈÈ»¸÷·ÖÇø²ßÂÔ¸÷ÓÐÓÅÁÓ£¬ÄÜ·ñ½«²»Í¬·ÖÇø²ßÂÔ½øÐÐ×éºÏ£¬È¡³¤²¹¶ÌÄØ£¿ÕâÒ²ÊÇ KUDU µÄ˼·£¬KUDU
Ö§³ÖÓû§¶ÔÒ»¸ö±íÖ¸¶¨Ò»¸ö·¶Î§·ÖÇø¹æÔòºÍ¶à¸ö Hash ·ÖÇø¹æÔò£¬ÈçÏÂͼ£º

|