Posted 鏋侀摼绉戞妧

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了相关的知识,希望对你有一定的参考价值。


鏍忕洰馃摪锛?/span>鐮佸啘鎵嬭 馃捇

鎾版枃鉁嶐煆伙細鏋侀摼鍚庣Team 妗斿瓙

缂栬緫馃摎锛?/span>鏋滄灉

鍏抽敭璇?/span>馃搶锛?/span> 娑堟伅闃熷垪 銆?/span> Kafka鐨勭壒鐐?nbsp;銆?/span> Kafka浣撶郴鏋舵瀯 銆?/span> Topic&Partition 銆?/span> Kafka鐨勫鍒舵満鍒?nbsp;銆?/span> Kafka鐨勫悓姝ユ満鍒?nbsp;銆?/span> 娑堟伅浼犺緭淇濋殰 銆?/span> Kafka浣滀负娑堟伅闃熷垪 銆?/span> Kafka浣滀负鍌ㄥ瓨绯荤粺 銆?/span> Kafka娴佸鐞?nbsp;


鉁嶏笍
 鐮佸啘鎵嬭 


灏嗕細閭€璇?/span>


涓€鐩村湪骞曞悗
鐢ㄤ唬鐮佸拰绠楁硶鏀瑰彉涓栫晫鐨?/span>
鎶€鏈ぇ浣滑
灏嗕細涓嶅畾鏈熸帹閫佷粬浠?/span>
鎵€鍐欑殑鍦ㄦ妧鏈笓涓氫腑鐨?/strong>
鎶€鏈粡楠?鐮旂┒/璁烘枃


涓轰綘鍛堢幇
/ 鏇村墠娌跨殑鎶€鏈€濊€?/
 / 鏇翠笓涓氱殑鎶€鏈共璐?/


#鐮佸啘鎵嬭# 绗?9鏈?/span>
鏂?| Video++鏋侀摼绉戞妧鍚庣team-妗斿瓙

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?></p> 
<section class=

Kafka鏄熀浜庡彂甯冭闃呯殑娑堟伅绯荤粺銆傛渶鍒濊捣婧愪簬LinkedIn锛屼簬2011骞存垚涓哄紑婧怉pache椤圭洰锛岀劧鍚庝簬2012骞存垚涓篈pache椤剁骇椤圭洰銆侹afka鐢⊿cala鍜孞ava缂栧啓锛屽洜鍏?span>鍒嗗竷寮忓彲鎵╁睍鏋舵瀯鍙?span>鍙寔涔呭寲銆?span>楂樺悶鍚愮巼鐗瑰緛鑰岃骞挎硾浣跨敤銆?/span>


 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<p class=閫氬父鍦ㄩ」鐩腑锛屾垜浠細鍥犱负濡備笅闇€姹傝€?span>寮曞叆娑堟伅闃熷垪妯″潡锛?/span>


 1  瑙h€?nbsp;  

 

 2  缂撳啿   

娑堟伅绯荤粺浣滀负涓€涓紦鍐叉睜锛屽簲瀵瑰父瑙佺殑璁块棶閲忎笉鍧囪 鎯呭舰銆?/span>姣斿鐗规畩鑺傚亣鏃ョ殑娴侀噺鍓у鍜屾瘡鏃ヤ笉鍚屾椂娈电殑璁块棶閲忓樊寮傘€備互鍙婂鐞嗕笉鍚屾暟鎹被鍨嬫墍闇€鐨勪笉鍚屽疄鏃舵€с€備娇鏁翠釜涓氬姟澶勭悊鏋舵瀯浠ヨ緝浣庢垚鏈幏寰椾竴瀹氱伒娲绘€с€?/span>

 

 3  寮傛 

寰堝鏃跺€欙紝鐢ㄦ埛涓嶆兂涔熶笉闇€瑕佺珛鍗冲鐞嗘秷鎭€?span>娑堟伅闃熷垪鎻愪緵浜嗗紓姝ュ鐞嗘満鍒?/strong>锛?span>鍏佽鐢ㄦ埛鎶婁竴涓秷鎭斁鍏ラ槦鍒楋紝浣嗗苟涓嶇珛鍗冲鐞嗗畠銆傛兂鍚戦槦鍒椾腑鏀惧叆澶氬皯娑堟伅灏辨斁澶氬皯锛岀劧鍚庡湪闇€瑕佺殑鏃跺€欏啀鍘诲鐞嗗畠浠€?/span>


 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<p class=浣滀负涓€绉嶅垎甯冨紡鐨勶紝鍩轰簬鍙戝竷/璁㈤槄鐨勬秷鎭郴缁?/strong>銆侹afka鐨勪富瑕佽璁$洰鏍囧涓嬶細


 1  浠ユ椂闂村鏉傚害涓篛(1)鐨勬柟寮?span>鎻愪緵娑堟伅鎸佷箙鍖栬兘鍔?/strong>锛屽嵆浣垮TB绾т互涓婃暟鎹篃鑳戒繚璇佸父鏁版椂闂村鏉傚害鐨勮闂€ц兘銆?/span>
 2   楂樺悶鍚愮巼銆傚嵆浣垮湪闈炲父寤変环鐨勫晢鐢ㄦ満鍣ㄤ笂涔熻兘鍋氬埌鍗曟満鏀寔姣忕100K鏉′互涓婃秷鎭殑浼犺緭銆?/span>
 3  鏀寔Kafka Server闂寸殑娑堟伅鍒嗗尯锛屽強鍒嗗竷寮忔秷璐癸紝鍚屾椂淇濊瘉姣忎釜Partition鍐呯殑娑堟伅椤哄簭浼犺緭銆?/span>
 4   鍚屾椂鏀寔绂荤嚎鏁版嵁澶勭悊鍜屽疄鏃舵暟鎹鐞嗐€?/span>

 5  鏀寔鍦ㄧ嚎姘村钩鎵╁睍銆?/span>

 

 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p class=

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<section class=

濡備笂鍥炬墍绀猴紝涓€涓?span>鍏稿瀷鐨凨afka浣撶郴鏋舵瀯鍖呮嫭鑻ュ共Producer锛堝彲浠ユ槸鏈嶅姟鍣ㄦ棩蹇楋紝涓氬姟鏁版嵁锛岄〉闈㈠墠绔骇鐢熺殑page view绛夌瓑锛夛紝鑻ュ共broker锛圞afka鏀寔姘村钩鎵╁睍锛屼竴鑸琤roker鏁伴噺瓒婂锛岄泦缇ゅ悶鍚愮巼瓒婇珮锛夛紝鑻ュ共Consumer (Group)锛屼互鍙婁竴涓猌ookeeper闆嗙兢銆?/span>


Kafka閫氳繃Zookeeper绠$悊闆嗙兢閰嶇疆锛岄€変妇leader锛屼互鍙婂湪consumer group鍙戠敓鍙樺寲鏃惰繘琛宺ebalance銆侾roducer浣跨敤push妯″紡灏嗘秷鎭彂甯冨埌broker锛孋onsumer浣跨敤pull妯″紡浠巄roker璁㈤槄骞舵秷璐规秷鎭€?/span>

 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p class=


鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<p class=涓€涓猼opic鍙互璁や负涓€涓竴绫绘秷鎭紝姣忎釜topic灏嗚鍒嗘垚澶氫釜partition锛屾瘡涓猵artition鍦ㄥ瓨鍌ㄥ眰闈㈡槸append log鏂囦欢銆備换浣曞彂甯冨埌姝artition鐨勬秷鎭兘浼氳杩藉姞鍒發og鏂囦欢鐨勫熬閮紝姣忔潯娑堟伅鍦ㄦ枃浠朵腑鐨勪綅缃О涓簅ffset(鍋忕Щ閲?锛宱ffset涓轰竴涓猯ong鍨嬬殑鏁板瓧锛屽畠鍞竴鏍囪涓€鏉℃秷鎭€?span>姣忔潯娑堟伅閮借append鍒皃artition涓紝椤哄簭鍐欑鐩樺洜姝ゆ晥鐜囬潪甯搁珮銆傝繖鏄疜afka楂樺悶鍚愮巼鐨勯噸瑕佸熀纭€銆?/span>

 

Producer鍙戦€佹秷鎭埌broker鏃讹紝浼氭牴鎹甈aritition鏈哄埗閫夋嫨灏嗗叾瀛樺偍鍒板摢涓€涓狿artition銆傚鏋淧artition鏈哄埗璁剧疆鍚堢悊锛屾墍鏈夋秷鎭彲浠ュ潎鍖€鍒嗗竷鍒颁笉鍚岀殑Partition閲岋紝杩欐牱灏卞疄鐜颁簡璐熻浇鍧囪 銆?/span>


濡傛灉涓€涓猅opic瀵瑰簲涓€涓枃浠讹紝閭h繖涓枃浠舵墍鍦ㄧ殑鏈哄櫒I/O灏嗕細鎴愪负杩欎釜Topic鐨勬€ц兘鐡堕锛岃€屾湁浜哖artition鍚庯紝涓嶅悓鐨勬秷鎭彲浠ュ苟琛屽啓鍏ヤ笉鍚宐roker鐨勪笉鍚孭artition閲岋紝鏋佸ぇ鐨勬彁楂樹簡鍚炲悙鐜囥€傚彲浠ラ€氳繃閰嶇疆椤筺um.partitions鏉ユ寚瀹氭柊寤篢opic鐨勯粯璁artition鏁伴噺锛屼篃鍙湪鍒涘缓Topic鏃堕€氳繃鍙傛暟鎸囧畾锛屽悓鏃朵篃鍙互鍦═opic鍒涘缓涔嬪悗閫氳繃Kafka鎻愪緵鐨勫伐鍏蜂慨鏀广€?/span>

 


鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<p class=Kafka 涓殑姣忎釜涓婚鍒嗗尯閮借澶嶅埗浜?n 娆★紝鍏朵腑鐨?n 鏄富棰樼殑澶嶅埗鍥犲瓙锛坮eplication factor锛夈€傝繖鍏佽 Kafka 鍦ㄩ泦缇ゆ湇鍔″櫒鍙戠敓鏁呴殰鏃惰嚜鍔ㄥ垏鎹㈠埌杩欎簺鍓湰锛屼互渚垮湪鍑虹幇鏁呴殰鏃舵秷鎭粛鐒跺彲鐢ㄣ€侹afka 鐨勫鍒舵槸浠ュ垎鍖轰负绮掑害鐨勶紝鍒嗗尯鐨勯鍐欐棩蹇楄澶嶅埗鍒?n 涓湇鍔″櫒銆?nbsp;鍦?n 涓壇鏈腑锛屼竴涓壇鏈綔涓?leader锛屽叾浠栧壇鏈垚涓?followers銆傞【鍚嶆€濅箟锛宲roducer 鍙兘寰€ leader 鍒嗗尯涓婂啓鏁版嵁锛堣涔熷彧鑳戒粠 leader 鍒嗗尯涓婅繘琛岋級锛宖ollowers 鍙寜椤哄簭浠?leader 涓婂鍒舵棩蹇椼€?/span>

 

鏃ュ織澶嶅埗绠楁硶锛坙og replication algorithm锛夊繀椤绘彁渚涚殑鍩烘湰淇濊瘉鏄紝濡傛灉瀹冨憡璇夊鎴风娑堟伅宸茶鎻愪氦锛岃€屽綋鍓?leader 鍑虹幇鏁呴殰锛屾柊閫夊嚭鐨?leader 涔熷繀椤诲叿鏈夎娑堟伅銆傚湪鍑虹幇鏁呴殰鏃讹紝Kafka 浼氫粠澶卞幓 leader 鐨?ISR 閲岄潰閫夋嫨涓€涓?follower 浣滀负杩欎釜鍒嗗尯鏂扮殑 leader 锛涙崲鍙ヨ瘽璇达紝鏄洜涓鸿繖涓?span> follower 鏄窡涓?leader 鍐欒繘搴︾殑銆?/span>


姣忎釜鍒嗗尯鐨?leader 浼氱淮鎶や竴涓?ISR銆傚綋 producer 寰€ broker 鍙戦€佹秷鎭紝娑堟伅鍏堝啓鍏ュ埌瀵瑰簲 leader 鍒嗗尯涓婏紝鐒跺悗澶嶅埗鍒拌繖涓垎鍖虹殑鎵€鏈夊壇鏈腑銆傚彧鏈夊皢娑堟伅鎴愬姛澶嶅埗鍒版墍鏈夊悓姝ュ壇鏈紙ISR锛夊悗锛岃繖鏉℃秷鎭墠绠楄鎻愪氦銆傜敱浜庢秷鎭鍒跺欢杩熷彈鍒版渶鎱㈠悓姝ュ壇鏈殑闄愬埗锛屽洜姝ゅ揩閫熸娴嬫參鍓湰骞跺皢鍏朵粠 ISR 涓垹闄ら潪甯搁噸瑕併€侹afka 澶嶅埗鍗忚鐨勭粏鑺備細鏈変簺缁嗗井宸埆銆?/span>



鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?></p> 
<p><br></p> 
<p class=Kafka涓嶆槸瀹屽叏鍚屾锛屼篃涓嶆槸瀹屽叏寮傛锛岃€屾槸涓€绉?span>ISR(In-Sync Replicas)鏈哄埗锛?nbsp; 


 1   leader浼氱淮鎶や竴涓笌鍏跺熀鏈繚鎸佸悓姝ョ殑Replica鍒楄〃锛岃鍒楄〃绉颁负ISR锛屾瘡涓狿artition閮戒細鏈変竴涓狪SR锛岃€屼笖鏄敱leader鍔ㄦ€佺淮鎶?nbsp;銆?/span>


 2   濡傛灉涓€涓猣ollower姣斾竴涓猯eader钀藉悗澶锛屾垨鑰呰秴杩囦竴瀹氭椂闂存湭鍙戣捣鏁版嵁澶嶅埗璇锋眰锛屽垯leader灏嗗叾浠嶪SR涓Щ闄ゃ€?/span>


 3  褰揑SR涓墍鏈塕eplica閮藉悜Leader鍙戦€丄CK鏃讹紝leader鎵峜ommit锛岃繖鏃跺€檖roducer鎵嶈兘璁や负涓€涓姹備腑鐨勬秷鎭兘commit浜嗐€?/span>


Kafka鎻愪緵浜嗘暟鎹鍒剁畻娉曚繚璇侊紝濡傛灉leader鍙戠敓鏁呴殰鎴栨寕鎺夛紝涓€涓柊leader琚€変妇骞惰鎺ュ彈瀹㈡埛绔殑娑堟伅鎴愬姛鍐欏叆銆侹afka纭繚浠庡悓姝ュ壇鏈垪琛ㄤ腑閫変妇涓€涓壇鏈负leader锛屾垨鑰呰follower杩借刀leader鏁版嵁銆?/span>leader璐熻矗缁存姢鍜岃窡韪狪SR涓墍鏈塮ollower婊炲悗鐨勭姸鎬?/span>銆?/span>


褰損roducer鍙戦€佷竴鏉℃秷鎭埌broker鍚庯紝leader鍐欏叆娑堟伅骞跺鍒跺埌鎵€鏈塮ollower銆傛秷鎭彁浜や箣鍚庢墠琚垚鍔熷鍒跺埌鎵€鏈夌殑鍚屾鍓湰銆傛秷鎭鍒跺欢杩熷彈鏈€鎱㈢殑follower闄愬埗锛岄噸瑕佺殑鏄揩閫熸娴嬫參鍓湰锛屽鏋渇ollower鈥滆惤鍚庘€濆お澶氭垨鑰呭け鏁堬紝leader灏嗕細鎶婂畠浠嶪SR涓垹闄ゃ€?/span>


 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><span class= 

鍓嶉潰宸茬粡浠嬬粛浜咾afka濡備綍杩涜鏈夋晥鐨勫瓨鍌紝浠ュ強浜嗚В浜唒roducer鍜宑onsumer濡備綍宸ヤ綔銆傛帴涓嬫潵璁ㄨ鐨勬槸Kafka濡備綍纭繚娑堟伅鍦╬roducer鍜宑onsumer涔嬮棿浼犺緭銆傛湁浠ヤ笅涓夌鍙兘鐨勪紶杈撲繚闅滐紙delivery guarantee锛?

 

  • At most once: 娑堟伅鍙兘浼氫涪锛屼絾缁濅笉浼氶噸澶嶄紶杈?/span>

  • At least once锛氭秷鎭粷涓嶄細涓紝浣嗗彲鑳戒細閲嶅浼犺緭

  • Exactly once锛氭瘡鏉℃秷鎭偗瀹氫細琚紶杈撲竴娆′笖浠呬紶杈撲竴娆?/span>

 

Kafka鐨勬秷鎭紶杈撲繚闅滄満鍒堕潪甯哥洿瑙傘€傚綋producer鍚慴roker鍙戦€佹秷鎭椂锛屼竴鏃﹁繖鏉℃秷鎭commit锛岀敱浜庡壇鏈満鍒讹紙replication锛夌殑瀛樺湪锛屽畠灏变笉浼氫涪澶便€備絾鏄鏋減roducer鍙戦€佹暟鎹粰broker鍚庯紝閬囧埌鐨勭綉缁滈棶棰樿€岄€犳垚閫氫俊涓柇锛岄偅producer灏辨棤娉曞垽鏂鏉℃秷鎭槸鍚﹀凡缁忔彁浜わ紙commit锛夈€?/span>铏界劧Kafka鏃犳硶纭畾缃戠粶鏁呴殰鏈熼棿鍙戠敓浜嗕粈涔堬紝浣嗘槸producer鍙互retry澶氭锛岀‘淇濇秷鎭凡缁忔纭紶杈撳埌broker涓紝鎵€浠ョ洰鍓岾afka瀹炵幇鐨勬槸at least once銆?/span>


consumer浠巄roker涓鍙栨秷鎭悗锛屽彲浠ラ€夋嫨commit锛岃鎿嶄綔浼氬湪Zookeeper涓瓨涓嬭consumer鍦ㄨpartition涓嬭鍙栫殑娑堟伅鐨刼ffset銆傝consumer涓嬩竴娆″啀璇昏partition鏃朵細浠庝笅涓€鏉″紑濮嬭鍙栥€傚鏈猚ommit锛屼笅涓€娆¤鍙栫殑寮€濮嬩綅缃細璺熶笂涓€娆ommit涔嬪悗鐨勫紑濮嬩綅缃浉鍚屻€傚綋鐒朵篃鍙互灏哻onsumer璁剧疆涓篴utocommit锛屽嵆consumer涓€鏃﹁鍙栧埌鏁版嵁绔嬪嵆鑷姩commit銆傚鏋滃彧璁ㄨ杩欎竴璇诲彇娑堟伅鐨勮繃绋嬶紝閭afka鏄‘淇濅簡exactly once, 浣嗘槸濡傛灉鐢变簬鍓嶉潰producer涓巄roker涔嬮棿鐨勬煇绉嶅師鍥犲鑷存秷鎭殑閲嶅锛岄偅涔堣繖閲屽氨鏄痑t least once銆?/span>


鑰冭檻杩欐牱涓€绉嶆儏鍐碉紝褰揷onsumer璇诲畬娑堟伅涔嬪悗鍏坈ommit鍐嶅鐞嗘秷鎭紝鍦ㄨ繖绉嶆ā寮忎笅锛屽鏋渃onsumer鍦╟ommit鍚庤繕娌℃潵寰楀強澶勭悊娑堟伅灏眂rash浜嗭紝涓嬫閲嶆柊寮€濮嬪伐浣滃悗灏辨棤娉曡鍒板垰鍒氬凡鎻愪氦鑰屾湭澶勭悊鐨勬秷鎭紝杩欏氨瀵瑰簲浜巃t most once浜嗐€傝瀹屾秷鎭厛澶勭悊鍐峜ommit銆傝繖绉嶆ā寮忎笅锛屽鏋滃鐞嗗畬浜嗘秷鎭湪commit涔嬪墠consumer crash浜嗭紝涓嬫閲嶆柊寮€濮嬪伐浣滄椂杩樹細澶勭悊鍒氬垰鏈猚ommit鐨勬秷鎭紝瀹為檯涓婅娑堟伅宸茬粡琚鐞嗚繃浜嗭紝杩欏氨瀵瑰簲浜巃t least once銆?/span>



涓嶅彧鏄疜afka, 绫讳技RabbitMQ浠ュ強RocketMQ杩欑被鍟嗕笟绾т腑闂翠欢涔熷彧淇濋殰at least once, 涓斾篃鏃犳硶浠庤嚜韬幓杩涜娑堟伅鍘婚噸銆傛墍浠ユ垜浠缓璁笟鍔℃柟鏍规嵁鑷韩鐨勪笟鍔$壒鐐硅繘琛屽幓閲嶏紝姣斿涓氬姟娑堟伅鏈韩鍏峰骞傜瓑鎬э紝鎴栬€呭€熷姪Redis绛夊叾浠栦骇鍝佽繘琛屽幓閲嶅鐞嗐€?/span>

 

 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<section class= 浼犵粺鐨勬秷鎭湁涓ょ妯″紡锛?/strong>闃熷垪鍜屽彂甯冭闃?/strong>銆?nbsp;鍦ㄩ槦鍒楁ā寮忎腑锛屾秷璐硅€呮睜浠庢湇鍔″櫒璇诲彇娑堟伅锛堟瘡涓秷鎭彧琚叾涓竴涓鍙栵級; 鍙戝竷璁㈤槄妯″紡锛氭秷鎭箍鎾粰鎵€鏈夌殑娑堣垂鑰呫€傝繖涓ょ妯″紡閮芥湁浼樼己鐐癸紝闃熷垪鐨勪紭鐐规槸鍏佽澶氫釜娑堣垂鑰呯摐鍒嗗鐞嗘暟鎹?/strong>锛岃繖鏍峰彲浠ユ墿灞曞鐞嗐€?/span>

浣嗘槸锛岄槦鍒椾笉鍍忓涓闃呰€咃紝涓€鏃︽秷鎭€呰繘绋嬭鍙栧悗鏁呴殰浜嗭紝閭d箞娑堟伅灏变涪浜嗐€傝€屽彂甯冨拰璁㈤槄鍏佽浣犲箍鎾暟鎹埌澶氫釜娑堣垂鑰咃紝鐢变簬姣忎釜璁㈤槄鑰呴兘璁㈤槄浜嗘秷鎭紝鎵€浠ユ病鍔炴硶缂╂斁澶勭悊銆?/span>

kafka涓殑Consumer Group鏈変袱绉嶅舰寮忥細
  • 闃熷垪锛氬厑璁稿悓鍚嶇殑娑堣垂鑰呯粍鎴愬憳鍏卞悓澶勭悊銆?/span>

  • 鍙戝竷璁㈤槄锛氬箍鎾秷鎭粰澶氫釜娑堣垂鑰呯粍銆?/span>

kafka鐨勬瘡涓猼opic閮藉叿鏈夎繖涓ょ妯″紡銆?/strong>
 
浼犵粺鐨勬秷鎭郴缁熸寜椤哄簭淇濆瓨鏁版嵁锛屽鏋滃涓秷璐硅€呬粠闃熷垪娑堣垂锛屽垯鏈嶅姟鍣ㄦ寜瀛樺偍鐨勯『搴忓彂閫佹秷鎭紝浣嗘槸锛屽敖绠℃湇鍔″櫒鎸夐『搴忓彂閫侊紝澶氫釜骞惰璇锋眰灏嗕細鏄紓姝ョ殑锛屽洜姝ゆ秷鎭彲鑳戒贡搴忓埌杈俱€傝繖鎰忓懗鐫€鍙娑堟伅瀛樺湪骞惰娑堣垂鐨勬儏鍐碉紝椤哄簭灏辨棤娉曚繚璇併€傛秷鎭郴缁熷父甯搁€氳繃浠呰1涓秷璐硅€呮潵瑙e喅杩欎釜闂锛屼絾鏄繖鎰忓懗鐫€娌$敤鍒板苟琛屽鐞嗐€?/span>

kafka鏈夋瘮浼犵粺鐨勬秷鎭郴缁熸洿寮虹殑椤哄簭淇濊瘉 銆傞€氳繃骞惰topic鐨刾arition锛宬afka鎻愪緵浜嗛『搴忎繚璇佸拰璐熻浇鍧囪 銆傛瘡涓猵artition浠呯敱鍚屼竴涓秷璐硅€呯粍涓殑涓€涓秷璐硅€呮秷璐瑰埌銆傚苟纭繚娑堣垂鑰呮槸璇artition鐨勫敮涓€娑堣垂鑰咃紝骞舵寜椤哄簭娑堣垂鏁版嵁銆傛瘡涓猼opic鏈夊涓垎鍖猴紝鍒欓渶瑕佸澶氫釜娑堣垂鑰呭仛璐熻浇鍧囪 锛屼絾璇锋敞鎰忥紝鐩稿悓鐨勬秷璐硅€呯粍涓笉鑳芥湁姣斿垎鍖烘洿澶氱殑娑堣垂鑰咃紝鍚﹀垯澶氬嚭鐨勬秷璐硅€呬竴鐩村浜庣┖绛夊緟锛屼笉浼氭敹鍒版秷鎭€?/span>
 

鐮佸啘鎵嬭 | Apache Kafka蹇€熷叆闂ㄦ寚鍗?> 
</section> 
<p><br></p> 
<p class=鎵€鏈夊彂甯冩秷鎭埌娑堟伅闃熷垪鍜屾秷璐瑰垎绂荤殑绯荤粺锛屽疄闄呬笂閮藉厖褰撲簡涓€涓?span>涓存椂瀛樺偍绯荤粺銆侹afka杩樻槸涓€涓潪甯搁珮鎬ц兘鐨勫瓨鍌ㄧ郴缁熴€傚啓鍏ュ埌kafka鐨勬暟鎹皢鍐欏埌纾佺洏骞跺鍒跺埌闆嗙兢涓繚璇佸閿欐€с€傚苟鍏佽鐢熶骇鑰呯瓑寰呮秷鎭簲绛旓紝鐩村埌娑堟伅瀹屽叏鍐欏叆銆俴afka鐨勫瓨鍌ㄧ粨鏋勪繚璇佹棤璁烘湇鍔″櫒涓婃湁50KB鎴?0TB鏁版嵁锛屾墽琛屾晥鐜囨槸鐩镐技鐨勶紝鍥犳鍙揪鍒版按骞虫墿灞曠殑鐩爣銆傝繕鍙互璁や负kafka鏄竴绉嶄笓鐢ㄤ簬楂樻€ц兘锛屼綆寤惰繜锛屾彁浜ゆ棩蹇楀瓨鍌紝澶嶅埗锛屽拰浼犳挱鐗规畩鐢ㄩ€旂殑鍒嗗竷寮忔枃浠剁郴缁?/strong>銆?/span>


 


Kafka鐨勬洿楂樼洰鏍囨槸瀹炴椂娴佸鐞嗐€?span>鍦╧afka涓紝娴佸鐞嗘寔缁幏鍙栬緭鍏opic鐨勬暟鎹紝杩涜澶勭悊鍔犲伐锛岀劧鍚庡啓鍏ヨ緭鍑簍opic銆?/strong>渚嬪锛屼竴涓浂鍞瓵PP锛屾帴鏀堕攢鍞拰鍑鸿揣鐨勮緭鍏ユ祦锛岀粺璁℃暟閲忔垨璋冩暣浠锋牸鍚庤緭鍑恒€?/span>


绠€鍗曠殑闇€姹傚彲浠ョ洿鎺ヤ娇鐢╬roducer鍜宑onsumer API杩涜澶勭悊銆傚浜庡鏉傜殑杞崲锛孠afka鎻愪緵浜嗘洿寮哄ぇ鐨凷treams API銆?span>鍙瀯寤鸿仛鍚堣绠楁垨杩炴帴娴佸埌涓€璧风殑澶嶆潅搴旂敤绋嬪簭銆?/span>


缁间笂鎵€杩帮紝Kafka 鐨勮璁″彲浠ュ府鍔╂垜浠В鍐冲緢澶氭灦鏋勪笂鐨勯棶棰樸€備絾鏄兂瑕佺敤濂?Kafka 鐨?span>楂樻€ц兘銆佷綆鑰﹀悎銆侀珮鍙潬鎬?/strong>绛夌壒鎬э紝鎴戜滑闇€瑕侀潪甯镐簡瑙?Kafka锛屼互鍙婃垜浠嚜韬殑涓氬姟闇€姹傦紝缁煎悎鑰冭檻搴旂敤鍦烘櫙銆?/span>




馃殌

 鏋侀摼绉戞妧Video++ 
 鑱氱劍浜庤棰戜簰鑱旂綉鐨凙I绉戞妧鍏徃 


馃憞馃徎鐐瑰嚮銆岄槄璇诲師鏂囥€?/strong>鏌ョ湅鏇村娣卞害鎶€鏈ソ鏂?/span>

以上是关于的主要内容,如果未能解决你的问题,请参考以下文章

Python 操作Redis

python爬虫入门----- 阿里巴巴供应商爬虫

Python词典设置默认值小技巧

《python学习手册(第4版)》pdf

Django settings.py 的media路径设置

Python中的赋值,浅拷贝和深拷贝的区别

(c)2006-2024 SYSTEM All Rights Reserved IT常识