1. 程式人生 > >kafka快速開始

kafka快速開始

cas 集合 body step ont creat end pan 參考

Step 1: Download the code

技術分享圖片

Step 2: Start the server

技術分享圖片

技術分享圖片

Step 3: Create a topic

技術分享圖片

Step 4: Send some messages

技術分享圖片

Step 5: Start a consumer

技術分享圖片

技術分享圖片

Step 6: Setting up a multi-broker cluster

技術分享圖片

技術分享圖片

分別配置如下

技術分享圖片

技術分享圖片

技術分享圖片

  • "leader" 這個節點負責指定分區的所有讀和寫操作
  • "replicas" 復制這個分區日誌的結點列表,不管是不是leader都算在內
  • "isr" 同步副本的集合,它是當前活著的副本列表的子集

接下來,發個消息試試

技術分享圖片

技術分享圖片技術分享圖片

消息是發布到localhost:9092上的,而當連接到localhost:9093和localhost:9094上也能收到消息,由此可見,replication-factor=3的作用

參考 http://kafka.apache.org/quickstart

kafka快速開始