{"id":85032,"date":"2026-07-26T22:40:35","date_gmt":"2026-07-26T14:40:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/85032.html"},"modified":"2026-07-26T22:40:35","modified_gmt":"2026-07-26T14:40:35","slug":"kafka%ef%bc%8805%ef%bc%89%e6%90%ad%e5%bb%ba%e9%ab%98%e5%8f%af%e7%94%a8kafka%e9%9b%86%e7%be%a4%ef%bc%9a%e4%bb%8e%e4%b8%89%e5%8f%b0%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%bc%80%e5%a7%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/85032.html","title":{"rendered":"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb"},"content":{"rendered":"<p>\u672c\u6587\u624b\u628a\u624b\u6559\u4f60\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684Kafka\u96c6\u7fa4&#xff0c;\u6db5\u76d6Zookeeper\u9009\u4e3e\u3001Broker\u914d\u7f6e\u3001Topic\u5206\u533a\u7b56\u7565\u53ca\u6545\u969c\u6392\u67e5\u5168\u6d41\u7a0b\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u5f00\u7bc7&#xff1a;\u4ece\u5355\u673a\u5230\u96c6\u7fa4&#xff0c;\u8fc8\u51fa\u9ad8\u53ef\u7528\u7b2c\u4e00\u6b65<\/h3>\n<p>\u5728\u524d\u51e0\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u4f53\u9a8c\u4e86Kafka\u5355\u673a\u7248\u7684\u5a01\u529b\u3002\u4f46\u5728\u771f\u5b9e\u7684\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5355\u70b9\u6545\u969c\u548c\u5bb9\u91cf\u74f6\u9888\u662f\u5fc5\u987b\u89e3\u51b3\u7684\u95ee\u9898\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c06\u4e00\u8d77\u8fc8\u51fa\u5173\u952e\u4e00\u6b65\u2014\u2014\u4ece\u5355\u53f0\u670d\u52a1\u5668\u6269\u5c55\u5230\u4e09\u53f0\u670d\u52a1\u5668&#xff0c;\u642d\u5efa\u4e00\u4e2a\u5177\u5907\u9ad8\u53ef\u7528\u548c\u6a2a\u5411\u6269\u5c55\u80fd\u529b\u7684Kafka\u96c6\u7fa4\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b&#xff1a;\u4e00\u5bb6\u5feb\u9012\u516c\u53f8\u4ece\u53ea\u67091\u4e2a\u4ed3\u5e93&#xff0c;\u6269\u5c55\u52303\u4e2a\u533a\u57df\u5206\u62e8\u4e2d\u5fc3\u3002\u5373\u4f7f\u67d0\u4e2a\u5206\u62e8\u4e2d\u5fc3\u4e34\u65f6\u5173\u95ed&#xff0c;\u5feb\u9012\u7f51\u7edc\u4f9d\u7136\u80fd\u6b63\u5e38\u8fd0\u8f6c\u3002\u8fd9\u5c31\u662f\u96c6\u7fa4\u7684\u4ef7\u503c\u6240\u5728\u3002<\/p>\n<p>\u6d88\u606f\u5373\u8fde\u63a5&#xff0c;\u6570\u636e\u5373\u4ef7\u503c\u3002 \u800c\u9ad8\u53ef\u7528\u7684\u96c6\u7fa4&#xff0c;\u5c31\u662f\u4fdd\u969c\u8fd9\u4efd\u4ef7\u503c\u6c38\u4e0d\u4e2d\u65ad\u7684\u57fa\u77f3\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u4e3a\u4ec0\u4e48\u9700\u8981Kafka\u96c6\u7fa4&#xff1f;<\/h3>\n<p>\u5728\u5355\u673a\u73af\u5883\u4e0b&#xff0c;Kafka\u7684\u6027\u80fd\u5df2\u7ecf\u76f8\u5f53\u60ca\u4eba&#xff08;TPS\u53ef\u8fbe\u767e\u4e07\u7ea7\u522b&#xff09;\u3002\u4f46\u9762\u5bf9\u4ee5\u4e0b\u573a\u666f\u65f6&#xff0c;\u96c6\u7fa4\u6210\u4e3a\u5fc5\u7136\u9009\u62e9&#xff1a;<\/p>\n<h4>1. \u6570\u636e\u91cf\u592a\u5927&#xff0c;\u4e00\u53f0\u673a\u5668\u5b58\u4e0d\u4e0b<\/h4>\n<ul>\n<li>\u4e00\u4e2aTopic\u6bcf\u5929\u4ea7\u751fTB\u7ea7\u65e5\u5fd7<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u5c06\u6570\u636e\u62c6\u5206\u5230\u591a\u4e2aPartition&#xff0c;\u5206\u5e03\u5230\u4e0d\u540cBroker<\/li>\n<\/ul>\n<h4>2. \u5355\u70b9\u6545\u969c\u98ce\u9669\u9ad8<\/h4>\n<ul>\n<li>\u673a\u5668\u5b95\u673a \u2192 \u670d\u52a1\u4e2d\u65ad \u2192 \u6570\u636e\u4e22\u5931<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u6bcf\u4e2aPartition\u914d\u7f6e\u591a\u4e2a\u526f\u672c&#xff0c;\u4e3b\u4ece\u5907\u4efd<\/li>\n<\/ul>\n<h4>3. \u8bfb\u5199\u6027\u80fd\u9700\u8981\u7ebf\u6027\u6269\u5c55<\/h4>\n<ul>\n<li>\u5e76\u53d1\u7528\u6237\u6570\u4ece1\u4e07\u589e\u957f\u5230100\u4e07<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u589e\u52a0Broker\u8282\u70b9&#xff0c;\u5206\u6563\u8bfb\u5199\u538b\u529b<\/li>\n<\/ul>\n<h4>4. \u4e1a\u52a1\u9700\u8981\u9ad8\u53ef\u7528\u4fdd\u969c<\/h4>\n<ul>\n<li>\u91d1\u878d\u4ea4\u6613\u3001\u5b9e\u65f6\u76d1\u63a7\u7b49\u5173\u952e\u4e1a\u52a1<\/li>\n<li>\u89e3\u51b3\u65b9\u6848&#xff1a;\u8de8\u8282\u70b9\u5197\u4f59&#xff0c;\u81ea\u52a8\u6545\u969c\u8f6c\u79fb<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e09\u3001\u73af\u5883\u51c6\u5907&#xff1a;\u4e09\u53f0\u670d\u52a1\u5668\u7684\u4ea4\u54cd\u66f2<\/h3>\n<p>\u6211\u4eec\u5c06\u5728\u4e09\u53f0CentOS\u670d\u52a1\u5668\u4e0a\u642d\u5efa\u96c6\u7fa4&#xff0c;\u5b83\u4eec\u5c06\u626e\u6f14\u4e0d\u540c\u7684\u89d2\u8272&#xff1a;<\/p>\n<table>\n<tr>\u670d\u52a1\u5668\u4e3b\u673a\u540dIP\u793a\u4f8b\u89d2\u8272<\/tr>\n<tbody>\n<tr>\n<td>\u670d\u52a1\u56681<\/td>\n<td>worker1<\/td>\n<td>192.168.1.101<\/td>\n<td>ZK\u8282\u70b9 &#043; Kafka Broker<\/td>\n<\/tr>\n<tr>\n<td>\u670d\u52a1\u56682<\/td>\n<td>worker2<\/td>\n<td>192.168.1.102<\/td>\n<td>ZK\u8282\u70b9 &#043; Kafka Broker<\/td>\n<\/tr>\n<tr>\n<td>\u670d\u52a1\u56683<\/td>\n<td>worker3<\/td>\n<td>192.168.1.103<\/td>\n<td>ZK\u8282\u70b9 &#043; Kafka Broker<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u524d\u7f6e\u68c0\u67e5\u6e05\u5355&#xff1a;<\/h4>\n<p># 1. \u786e\u4fdd\u4e09\u53f0\u670d\u52a1\u5668\u65f6\u949f\u540c\u6b65&#xff08;\u96c6\u7fa4\u5fc5\u5907&#xff09;<br \/>\nsudo timedatectl set-ntp true<br \/>\ndate  # \u5728\u4e09\u53f0\u673a\u5668\u4e0a\u5206\u522b\u6267\u884c&#xff0c;\u65f6\u95f4\u5dee\u5e94\u5c0f\u4e8e1\u79d2<\/p>\n<p># 2. \u5173\u95ed\u9632\u706b\u5899\u6216\u5f00\u653e\u5fc5\u8981\u7aef\u53e3<br \/>\nsudo systemctl stop firewalld<br \/>\nsudo systemctl disable firewalld<\/p>\n<p># 3. \u914d\u7f6e\u4e3b\u673a\u540d\u89e3\u6790&#xff08;\u6bcf\u53f0\u673a\u5668\u90fd\u8981\u914d\u7f6e&#xff09;<br \/>\nsudo vi \/etc\/hosts<\/p>\n<p>\u5728\/etc\/hosts\u6587\u4ef6\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p>text<\/p>\n<p>192.168.1.101 worker1<br \/>\n192.168.1.102 worker2<br \/>\n192.168.1.103 worker3<\/p>\n<h2>4. \u5b89\u88c5JDK 1.8&#043;<\/h2>\n<p>sudo yum install -y java-1.8.0-openjdk-devel<br \/>\njava -version<\/p>\n<p>\u6ce8\u610f&#xff1a;\u751f\u4ea7\u73af\u5883\u4e2d\u5efa\u8bae\u914d\u7f6e\u4e13\u7528\u9632\u706b\u5899\u89c4\u5219&#xff0c;\u800c\u4e0d\u662f\u76f4\u63a5\u5173\u95ed\u9632\u706b\u5899\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u7b2c\u4e00\u6b65&#xff1a;\u90e8\u7f72Zookeeper\u96c6\u7fa4&#xff08;\u9009\u4e3e\u4e2d\u5fc3&#xff09;<\/h3>\n<p>Zookeeper\u662fKafka\u96c6\u7fa4\u7684\u201c\u5927\u8111\u201d&#xff0c;\u8d1f\u8d23Broker\u6ce8\u518c\u3001Leader\u9009\u4e3e\u3001\u914d\u7f6e\u7ba1\u7406\u7b49\u5173\u952e\u534f\u8c03\u5de5\u4f5c\u3002<\/p>\n<h4>1. \u4e0b\u8f7d\u4e0e\u5b89\u88c5&#xff08;\u4e09\u53f0\u673a\u5668\u90fd\u6267\u884c&#xff09;<\/h4>\n<p># \u4e0b\u8f7dZookeeper&#xff08;\u4ee53.8.4\u4e3a\u4f8b&#xff09;<br \/>\nwget https:\/\/downloads.apache.org\/zookeeper\/zookeeper-3.8.4\/apache-zookeeper-3.8.4-bin.tar.gz<\/p>\n<p># \u89e3\u538b\u5230\u6307\u5b9a\u76ee\u5f55<br \/>\nsudo mkdir -p \/app<br \/>\nsudo tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz -C \/app\/<br \/>\nsudo mv \/app\/apache-zookeeper-3.8.4-bin \/app\/zookeeper<\/p>\n<h4>2. \u914d\u7f6eZookeeper\u96c6\u7fa4<\/h4>\n<p># \u8fdb\u5165\u914d\u7f6e\u76ee\u5f55<br \/>\ncd \/app\/zookeeper\/conf<\/p>\n<p># \u590d\u5236\u793a\u4f8b\u914d\u7f6e\u6587\u4ef6<br \/>\ncp zoo_sample.cfg zoo.cfg<\/p>\n<p># \u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<br \/>\nvi zoo.cfg<\/p>\n<p>\u5173\u952e\u914d\u7f6e\u9879\u5982\u4e0b&#xff1a;<\/p>\n<p>properties<\/p>\n<p># \u6570\u636e\u5b58\u50a8\u76ee\u5f55&#xff08;\u91cd\u8981&#xff01;\u4e0d\u8981\u7528\u9ed8\u8ba4\u7684\/tmp&#xff09;<br \/>\ndataDir&#061;\/app\/zookeeper\/data<\/p>\n<p># \u5ba2\u6237\u7aef\u8fde\u63a5\u7aef\u53e3<br \/>\nclientPort&#061;2181<\/p>\n<p># \u96c6\u7fa4\u8282\u70b9\u914d\u7f6e&#xff08;\u4e09\u53f0\u673a\u5668\u914d\u7f6e\u76f8\u540c&#xff09;<br \/>\nserver.1&#061;worker1:2888:3888<br \/>\nserver.2&#061;worker2:2888:3888<br \/>\nserver.3&#061;worker3:2888:3888<\/p>\n<p>\u914d\u7f6e\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>server.x&#xff1a;x\u662f\u8282\u70b9\u7684\u552f\u4e00ID&#xff08;myid&#xff09;<\/li>\n<li>2888&#xff1a;\u96c6\u7fa4\u5185\u90e8\u6570\u636e\u540c\u6b65\u7aef\u53e3<\/li>\n<li>3888&#xff1a;\u96c6\u7fa4\u9009\u4e3e\u901a\u4fe1\u7aef\u53e3<\/li>\n<\/ul>\n<h4>3. \u521b\u5efamyid\u6587\u4ef6&#xff08;\u6bcf\u53f0\u673a\u5668\u4e0d\u540c&#xff09;<\/h4>\n<p># \u5728worker1\u4e0a\u6267\u884c<br \/>\necho 1 &gt; \/app\/zookeeper\/data\/myid<\/p>\n<p># \u5728worker2\u4e0a\u6267\u884c<br \/>\necho 2 &gt; \/app\/zookeeper\/data\/myid<\/p>\n<p># \u5728worker3\u4e0a\u6267\u884c<br \/>\necho 3 &gt; \/app\/zookeeper\/data\/myid<\/p>\n<p>\u6280\u5de7&#xff1a;\u53ef\u4ee5\u4f7f\u7528scp\u547d\u4ee4\u5c06\u914d\u7f6e\u597d\u7684zookeeper\u76ee\u5f55\u76f4\u63a5\u5206\u53d1\u5230\u5176\u4ed6\u673a\u5668&#xff0c;\u7136\u540e\u53ea\u9700\u4fee\u6539myid\u6587\u4ef6\u3002<\/p>\n<h4>4. \u542f\u52a8\u4e0e\u9a8c\u8bc1Zookeeper\u96c6\u7fa4<\/h4>\n<p># \u5728\u4e09\u53f0\u673a\u5668\u4e0a\u5206\u522b\u542f\u52a8&#xff08;\u4f7f\u7528\u540e\u53f0\u6a21\u5f0f&#xff09;<br \/>\ncd \/app\/zookeeper<br \/>\nbin\/zkServer.sh start<\/p>\n<p># \u68c0\u67e5\u542f\u52a8\u72b6\u6001<br \/>\nbin\/zkServer.sh status<\/p>\n<p>\u671f\u671b\u8f93\u51fa&#xff1a;<\/p>\n<p>text<\/p>\n<p># \u5176\u4e2d\u4e00\u53f0\u4f1a\u662fLeader<br \/>\nMode: leader<\/p>\n<p># \u53e6\u5916\u4e24\u53f0\u662fFollower<br \/>\nMode: follower<\/p>\n<p>\u5c0f\u8d34\u58eb&#xff1a;\u5982\u679c\u51fa\u73b0Error contacting service. It is probably not running.&#xff0c;\u68c0\u67e5\u9632\u706b\u5899\u548c\u7f51\u7edc\u8fde\u901a\u6027\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u7b2c\u4e8c\u6b65&#xff1a;\u90e8\u7f72Kafka\u96c6\u7fa4&#xff08;\u6d88\u606f\u5f15\u64ce&#xff09;<\/h3>\n<p>Zookeeper\u96c6\u7fa4\u5c31\u7eea\u540e&#xff0c;\u6211\u4eec\u6765\u90e8\u7f72Kafka Broker\u96c6\u7fa4\u3002<\/p>\n<h4>1. \u4e0b\u8f7d\u4e0e\u5b89\u88c5&#xff08;\u4e09\u53f0\u673a\u5668\u90fd\u6267\u884c&#xff09;<\/h4>\n<p># \u4e0b\u8f7dKafka&#xff08;\u4ee53.8.0\u4e3a\u4f8b&#xff09;<br \/>\nwget https:\/\/downloads.apache.org\/kafka\/3.8.0\/kafka_2.13-3.8.0.tgz<\/p>\n<p># \u89e3\u538b<br \/>\nsudo tar -zxvf kafka_2.13-3.8.0.tgz -C \/app\/<br \/>\nsudo mv \/app\/kafka_2.13-3.8.0 \/app\/kafka<\/p>\n<h4>2. \u914d\u7f6eKafka Broker<\/h4>\n<p># \u8fdb\u5165\u914d\u7f6e\u76ee\u5f55<br \/>\ncd \/app\/kafka\/config<\/p>\n<p># \u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<br \/>\nvi server.properties<\/p>\n<p>worker1\u4e0a\u7684\u5173\u952e\u914d\u7f6e&#xff1a;<\/p>\n<p>properties<\/p>\n<p># Broker\u552f\u4e00ID&#xff08;\u6bcf\u53f0\u673a\u5668\u5fc5\u987b\u4e0d\u540c&#xff09;<br \/>\nbroker.id&#061;1<\/p>\n<p># \u670d\u52a1\u76d1\u542c\u5730\u5740&#xff08;\u4f7f\u7528\u4e3b\u673a\u540d\u6216IP&#xff09;<br \/>\nlisteners&#061;PLAINTEXT:\/\/worker1:9092<\/p>\n<p># \u6570\u636e\u5b58\u50a8\u76ee\u5f55&#xff08;\u53ef\u914d\u7f6e\u591a\u4e2a&#xff0c;\u7528\u9017\u53f7\u5206\u9694&#xff09;<br \/>\nlog.dirs&#061;\/app\/kafka\/logs<\/p>\n<p># \u9ed8\u8ba4\u5206\u533a\u6570&#xff08;\u521b\u5efaTopic\u65f6\u7684\u9ed8\u8ba4\u503c&#xff09;<br \/>\nnum.partitions&#061;3<\/p>\n<p># \u9ed8\u8ba4\u526f\u672c\u56e0\u5b50&#xff08;\u5efa\u8bae\u8bbe\u7f6e\u4e3a2\u62163&#xff09;<br \/>\ndefault.replication.factor&#061;3<\/p>\n<p># Zookeeper\u96c6\u7fa4\u5730\u5740<br \/>\nzookeeper.connect&#061;worker1:2181,worker2:2181,worker3:2181<\/p>\n<p># \u4ee5\u4e0b\u4e3a\u53ef\u9009\u4f18\u5316\u914d\u7f6e<br \/>\n# \u6d88\u606f\u4fdd\u7559\u65f6\u95f4&#xff08;\u5c0f\u65f6&#xff09;<br \/>\nlog.retention.hours&#061;168<\/p>\n<p># \u662f\u5426\u5141\u8bb8\u5220\u9664Topic<br \/>\ndelete.topic.enable&#061;true<\/p>\n<p># \u6700\u5c0f\u540c\u6b65\u526f\u672c\u6570&#xff08;\u5f71\u54cd\u6d88\u606f\u6301\u4e45\u6027&#xff09;<br \/>\nmin.insync.replicas&#061;2<\/p>\n<p>worker2\u548cworker3\u7684\u914d\u7f6e\u533a\u522b&#xff1a;<\/p>\n<ul>\n<li>broker.id&#xff1a;\u5206\u522b\u8bbe\u7f6e\u4e3a2\u548c3<\/li>\n<li>listeners&#xff1a;\u5206\u522b\u8bbe\u7f6e\u4e3aworker2:9092\u548cworker3:9092<\/li>\n<li>\u5176\u4ed6\u914d\u7f6e\u53ef\u4ee5\u76f8\u540c<\/li>\n<\/ul>\n<h4>3. \u542f\u52a8Kafka\u96c6\u7fa4<\/h4>\n<p># \u5728\u4e09\u53f0\u673a\u5668\u4e0a\u5206\u522b\u542f\u52a8&#xff08;\u540e\u53f0\u6a21\u5f0f&#xff09;<br \/>\ncd \/app\/kafka<br \/>\nnohup bin\/kafka-server-start.sh config\/server.properties &gt; kafka.log 2&gt;&amp;1 &amp;<\/p>\n<p># \u68c0\u67e5\u8fdb\u7a0b<br \/>\njps | grep Kafka<\/p>\n<p>\u671f\u671b\u770b\u5230\u6bcf\u53f0\u673a\u5668\u4e0a\u90fd\u6709Kafka\u8fdb\u7a0b\u3002<\/p>\n<h4>4. \u9a8c\u8bc1\u96c6\u7fa4\u72b6\u6001<\/h4>\n<p># \u5728\u4efb\u4f55\u4e00\u53f0Broker\u4e0a\u6267\u884c<br \/>\nbin\/kafka-broker-api-versions.sh &#8211;bootstrap-server worker1:9092<\/p>\n<p># \u67e5\u770b\u96c6\u7fa4\u4e2d\u7684Broker<br \/>\nbin\/kafka-cluster.sh &#8211;bootstrap-server worker1:9092 cluster-id<\/p>\n<hr \/>\n<h3>\u516d\u3001\u7b2c\u4e09\u6b65&#xff1a;\u521b\u5efa\u5206\u5e03\u5f0fTopic&#xff0c;\u4f53\u9a8c\u96c6\u7fa4\u5a01\u529b<\/h3>\n<p>\u73b0\u5728\u96c6\u7fa4\u5df2\u7ecf\u8fd0\u884c&#xff0c;\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u771f\u6b63\u5206\u5e03\u5f0f\u7684Topic\u3002<\/p>\n<h4>1. \u521b\u5efa\u5177\u5907\u5197\u4f59\u7684Topic<\/h4>\n<p># \u5728\u4efb\u610f\u4e00\u53f0Broker\u4e0a\u6267\u884c<br \/>\nbin\/kafka-topics.sh \\\\<br \/>\n  &#8211;bootstrap-server worker1:9092 \\\\<br \/>\n  &#8211;create \\\\<br \/>\n  &#8211;topic cluster-topic \\\\<br \/>\n  &#8211;partitions 3 \\\\<br \/>\n  &#8211;replication-factor 2<\/p>\n<p>\u53c2\u6570\u89e3\u6790&#xff1a;<\/p>\n<ul>\n<li>&#8211;partitions 3&#xff1a;\u5c06Topic\u5206\u4e3a3\u4e2a\u5206\u533a&#xff0c;\u53ef\u5e76\u884c\u5904\u7406<\/li>\n<li>&#8211;replication-factor 2&#xff1a;\u6bcf\u4e2a\u5206\u533a\u67092\u4e2a\u526f\u672c&#xff0c;\u63d0\u9ad8\u53ef\u7528\u6027<\/li>\n<\/ul>\n<h4>2. \u67e5\u770bTopic\u8be6\u60c5<\/h4>\n<p>bin\/kafka-topics.sh \\\\<br \/>\n  &#8211;bootstrap-server worker1:9092 \\\\<br \/>\n  &#8211;describe \\\\<br \/>\n  &#8211;topic cluster-topic<\/p>\n<p>\u671f\u671b\u8f93\u51fa&#xff1a;<\/p>\n<p>text<\/p>\n<p>Topic: cluster-topic TopicId: xxxx PartitionCount: 3 ReplicationFactor: 2 Configs:<br \/>\n    Topic: cluster-topic Partition: 0 Leader: 1 Replicas: 1,2 Isr: 1,2<br \/>\n    Topic: cluster-topic Partition: 1 Leader: 2 Replicas: 2,3 Isr: 2,3<br \/>\n    Topic: cluster-topic Partition: 2 Leader: 3 Replicas: 3,1 Isr: 3,1<\/p>\n<p>\u8f93\u51fa\u89e3\u8bfb&#xff1a;<\/p>\n<ul>\n<li>Partition: 0&#xff1a;\u5206\u533a\u7f16\u53f7<\/li>\n<li>Leader: 1&#xff1a;\u8be5\u5206\u533a\u7684\u4e3b\u8282\u70b9\u662fbroker.id&#061;1\u7684\u673a\u5668<\/li>\n<li>Replicas: 1,2&#xff1a;\u8be5\u5206\u533a\u7684\u526f\u672c\u5206\u5e03\u5728broker1\u548cbroker2\u4e0a<\/li>\n<li>Isr: 1,2&#xff1a;\u5f53\u524d\u5b58\u6d3b\u7684\u540c\u6b65\u526f\u672c&#xff08;In-Sync Replicas&#xff09;<\/li>\n<\/ul>\n<h4>3. \u6d4b\u8bd5\u96c6\u7fa4\u6d88\u606f\u6536\u53d1<\/h4>\n<p># \u751f\u4ea7\u8005&#xff08;\u53d1\u9001\u5230\u96c6\u7fa4&#xff09;<br \/>\nbin\/kafka-console-producer.sh \\\\<br \/>\n  &#8211;broker-list worker1:9092,worker2:9092,worker3:9092 \\\\<br \/>\n  &#8211;topic cluster-topic<\/p>\n<p># \u6d88\u8d39\u8005&#xff08;\u4ece\u96c6\u7fa4\u6d88\u8d39&#xff09;<br \/>\nbin\/kafka-console-consumer.sh \\\\<br \/>\n  &#8211;bootstrap-server worker1:9092 \\\\<br \/>\n  &#8211;topic cluster-topic \\\\<br \/>\n  &#8211;from-beginning<\/p>\n<p>\u6ce8\u610f&#xff1a;\u751f\u4ea7\u8005\u7684&#8211;broker-list\u53c2\u6570\u5305\u542b\u6240\u6709Broker\u5730\u5740&#xff0c;\u8fd9\u6837\u5373\u4f7f\u67d0\u4e2aBroker\u5b95\u673a&#xff0c;\u751f\u4ea7\u8005\u4e5f\u80fd\u81ea\u52a8\u5207\u6362\u5230\u5176\u4ed6\u53ef\u7528Broker\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001\u96c6\u7fa4\u72b6\u6001\u68c0\u67e5\u4e0e\u6545\u969c\u6392\u67e5\u6307\u5357<\/h3>\n<h4>1. \u65e5\u5e38\u5065\u5eb7\u68c0\u67e5\u547d\u4ee4<\/h4>\n<p># 1. \u68c0\u67e5Broker\u662f\u5426\u5b58\u6d3b<br \/>\njps | grep -E &#034;(Kafka|QuorumPeerMain)&#034;<\/p>\n<p># 2. \u67e5\u770bTopic\u5206\u5e03\u72b6\u6001<br \/>\nbin\/kafka-topics.sh &#8211;bootstrap-server worker1:9092 &#8211;describe<\/p>\n<p># 3. \u67e5\u770b\u6d88\u8d39\u8005\u7ec4\u5ef6\u8fdf<br \/>\nbin\/kafka-consumer-groups.sh &#8211;bootstrap-server worker1:9092 &#8211;all-groups &#8211;describe<\/p>\n<p># 4. \u68c0\u67e5\u96c6\u7fa4\u63a7\u5236\u5668<br \/>\nbin\/kafka-metadata-quorum.sh &#8211;bootstrap-server worker1:9092 describe &#8211;status<\/p>\n<h4>2. \u5e38\u89c1\u6545\u969c\u4e0e\u89e3\u51b3\u65b9\u6848<\/h4>\n<h5>\u95ee\u98981&#xff1a;Zookeeper\u8282\u70b9\u65e0\u6cd5\u542f\u52a8<\/h5>\n<p>\u73b0\u8c61&#xff1a;Error contacting service. It is probably not running.<br \/>\n\u6392\u67e5\u6b65\u9aa4&#xff1a;<\/p>\n<p># \u68c0\u67e5myid\u6587\u4ef6\u662f\u5426\u6b63\u786e<br \/>\ncat \/app\/zookeeper\/data\/myid<\/p>\n<p># \u68c0\u67e5\u7aef\u53e3\u662f\u5426\u88ab\u5360\u7528<br \/>\nnetstat -tlnp | grep 2181<\/p>\n<p># \u67e5\u770b\u65e5\u5fd7<br \/>\ntail -100 \/app\/zookeeper\/logs\/zookeeper.out<\/p>\n<h5>\u95ee\u98982&#xff1a;Kafka Broker\u65e0\u6cd5\u52a0\u5165\u96c6\u7fa4<\/h5>\n<p>\u73b0\u8c61&#xff1a;Broker\u542f\u52a8\u540e\u7acb\u5373\u9000\u51fa<br \/>\n\u6392\u67e5\u6b65\u9aa4&#xff1a;<\/p>\n<p># \u68c0\u67e5broker.id\u662f\u5426\u91cd\u590d<br \/>\ngrep broker.id config\/server.properties<\/p>\n<p># \u68c0\u67e5Zookeeper\u8fde\u63a5<br \/>\ntelnet worker1 2181<\/p>\n<p># \u67e5\u770bKafka\u65e5\u5fd7<br \/>\ntail -100 \/app\/kafka\/logs\/server.log<\/p>\n<h5>\u95ee\u98983&#xff1a;\u751f\u4ea7\u8005\u53d1\u9001\u6d88\u606f\u5931\u8d25<\/h5>\n<p>\u73b0\u8c61&#xff1a;LEADER_NOT_AVAILABLE\u6216NOT_ENOUGH_REPLICAS<br \/>\n\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<p># \u68c0\u67e5Topic\u7684ISR\u5217\u8868<br \/>\nbin\/kafka-topics.sh &#8211;bootstrap-server worker1:9092 &#8211;describe &#8211;topic your-topic<\/p>\n<p># \u5982\u679cISR\u6570\u91cf\u5c0f\u4e8emin.insync.replicas&#xff0c;\u9700\u8981\u7b49\u5f85\u526f\u672c\u540c\u6b65<br \/>\n# \u6216\u4e34\u65f6\u964d\u4f4e\u751f\u4ea7\u8005\u7684acks\u8981\u6c42<\/p>\n<h4>3. \u6a21\u62df\u6545\u969c\u6f14\u7ec3&#xff08;\u5b66\u4e60\u73af\u5883&#xff09;<\/h4>\n<p># 1. \u505c\u6b62\u4e00\u4e2aBroker&#xff08;\u6a21\u62df\u5b95\u673a&#xff09;<br \/>\nps aux | grep kafka | grep -v grep | awk &#039;{print $2}&#039; | head -1 | xargs kill<\/p>\n<p># 2. \u89c2\u5bdfTopic\u7684Leader\u5207\u6362<br \/>\nwatch -n 1 &#034;bin\/kafka-topics.sh &#8211;bootstrap-server worker2:9092 &#8211;describe &#8211;topic cluster-topic&#034;<\/p>\n<p># 3. \u6d88\u606f\u6536\u53d1\u662f\u5426\u6b63\u5e38<br \/>\n# \u751f\u4ea7\u8005\u5e94\u81ea\u52a8\u5207\u6362\u5230\u5176\u4ed6Broker<br \/>\n# \u6d88\u8d39\u8005\u5e94\u7ee7\u7eed\u6d88\u8d39&#xff08;\u53ef\u80fd\u6709\u77ed\u6682\u6682\u505c&#xff09;<\/p>\n<hr \/>\n<h3>\u516b\u3001\u96c6\u7fa4\u4f18\u5316\u5efa\u8bae<\/h3>\n<h4>1. \u786c\u4ef6\u89c4\u5212<\/h4>\n<ul>\n<li>\u78c1\u76d8&#xff1a;\u4f7f\u7528SSD&#xff0c;\u914d\u7f6e\u591a\u4e2a\u6570\u636e\u76ee\u5f55<\/li>\n<li>\u5185\u5b58&#xff1a;\u81f3\u5c1116GB&#xff0c;JVM\u5806\u5185\u5b58\u8bbe\u7f6e4-8GB<\/li>\n<li>\u7f51\u7edc&#xff1a;\u5343\u5146\u6216\u4e07\u5146\u7f51\u5361&#xff0c;\u4f4e\u5ef6\u8fdf\u7f51\u7edc<\/li>\n<\/ul>\n<h4>2. \u914d\u7f6e\u4f18\u5316<\/h4>\n<p>properties<\/p>\n<p># server.properties\u4e2d\u7684\u5173\u952e\u4f18\u5316\u9879<\/p>\n<p># \u63d0\u9ad8\u541e\u5410\u91cf<br \/>\nnum.network.threads&#061;8<br \/>\nnum.io.threads&#061;16<\/p>\n<p># \u4f18\u5316\u5237\u76d8\u7b56\u7565<br \/>\nlog.flush.interval.messages&#061;10000<br \/>\nlog.flush.interval.ms&#061;1000<\/p>\n<p># \u8c03\u6574\u526f\u672c\u540c\u6b65<br \/>\nreplica.socket.timeout.ms&#061;30000<br \/>\nreplica.lag.time.max.ms&#061;10000<\/p>\n<h4>3. \u76d1\u63a7\u65b9\u6848<\/h4>\n<ul>\n<li>\u57fa\u7840\u76d1\u63a7&#xff1a;JVM\u5185\u5b58\u3001CPU\u3001\u78c1\u76d8IO\u3001\u7f51\u7edc\u6d41\u91cf<\/li>\n<li>\u4e1a\u52a1\u76d1\u63a7&#xff1a;Topic\u541e\u5410\u91cf\u3001\u6d88\u8d39\u8005\u5ef6\u8fdf\u3001ISR\u6570\u91cf<\/li>\n<li>\u544a\u8b66\u9608\u503c&#xff1a;ISR\u6570\u91cf\u51cf\u5c11\u3001\u78c1\u76d8\u4f7f\u7528\u7387&gt;80%\u3001Broker\u5b95\u673a<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e5d\u3001\u5e38\u89c1\u95ee\u9898FAQ<\/h3>\n<h4>Q1&#xff1a;Zookeeper\u4e3a\u4ec0\u4e48\u9700\u8981\u5947\u6570\u4e2a\u8282\u70b9&#xff1f;<\/h4>\n<p>A&#xff1a;Zookeeper\u91c7\u7528\u591a\u6570\u540c\u610f\u539f\u5219&#xff08;Quorum&#xff09;\u30023\u4e2a\u8282\u70b9\u5141\u8bb81\u4e2a\u6545\u969c&#xff0c;5\u4e2a\u8282\u70b9\u5141\u8bb82\u4e2a\u6545\u969c\u3002\u5947\u6570\u4e2a\u8282\u70b9\u53ef\u4ee5\u6700\u5927\u5316\u5bb9\u9519\u80fd\u529b\u3002<\/p>\n<h4>Q2&#xff1a;replication-factor\u8bbe\u7f6e\u4e3a\u591a\u5c11\u5408\u9002&#xff1f;<\/h4>\n<p>A&#xff1a;<\/p>\n<ul>\n<li>\u6d4b\u8bd5\u73af\u5883&#xff1a;1&#xff08;\u65e0\u5197\u4f59&#xff09;<\/li>\n<li>\u9884\u751f\u4ea7\u73af\u5883&#xff1a;2&#xff08;\u5141\u8bb81\u4e2aBroker\u6545\u969c&#xff09;<\/li>\n<li>\u751f\u4ea7\u73af\u5883&#xff1a;3&#xff08;\u5141\u8bb82\u4e2aBroker\u6545\u969c&#xff0c;\u66f4\u9ad8\u53ef\u7528\u6027&#xff09;<\/li>\n<\/ul>\n<h4>Q3&#xff1a;\u5206\u533a\u6570\u662f\u4e0d\u662f\u8d8a\u591a\u8d8a\u597d&#xff1f;<\/h4>\n<p>A&#xff1a;\u4e0d\u662f&#xff01;\u5206\u533a\u6570\u5f71\u54cd&#xff1a;<\/p>\n<ul>\n<li>\u5e76\u884c\u5ea6&#xff1a;\u5206\u533a\u6570\u8d8a\u591a&#xff0c;\u5e76\u884c\u6d88\u8d39\u80fd\u529b\u8d8a\u5f3a<\/li>\n<li>ZK\u538b\u529b&#xff1a;\u6bcf\u4e2a\u5206\u533a\u90fd\u5728ZK\u4e0a\u6709\u5143\u6570\u636e<\/li>\n<li>\u63a8\u8350&#xff1a;\u4ece(\u9884\u671f\u6d88\u8d39\u8005\u6570 * 2)\u5f00\u59cb&#xff0c;\u6839\u636e\u76d1\u63a7\u8c03\u6574<\/li>\n<\/ul>\n<h4>Q4&#xff1a;\u5982\u4f55\u5b89\u5168\u5730\u6269\u5bb9\u96c6\u7fa4&#xff1f;<\/h4>\n<p>A&#xff1a;\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u51c6\u5907\u65b0\u670d\u52a1\u5668&#xff0c;\u914d\u7f6e\u76f8\u540c\u7684\u73af\u5883<\/li>\n<li>\u542f\u52a8\u65b0Broker&#xff08;\u786e\u4fddbroker.id\u552f\u4e00&#xff09;<\/li>\n<li>\u4f7f\u7528kafka-reassign-partitions.sh\u5de5\u5177\u91cd\u65b0\u5206\u914d\u5206\u533a<\/li>\n<li>\u76d1\u63a7\u6570\u636e\u8fc1\u79fb\u8fdb\u5ea6&#xff0c;\u786e\u4fdd\u65e0\u6570\u636e\u4e22\u5931<\/li>\n<h4>Q5&#xff1a;Kafka\u96c6\u7fa4\u9700\u8981\u51e0\u53f0\u670d\u52a1\u5668&#xff1f;<\/h4>\n<p>A&#xff1a;\u6700\u5c0f3\u53f0&#xff08;ZK\u548cBroker\u6df7\u5e03&#xff09;\u3002\u751f\u4ea7\u73af\u5883\u5efa\u8bae&#xff1a;<\/p>\n<ul>\n<li>\u4e2d\u5c0f\u89c4\u6a21&#xff1a;3-5\u53f0<\/li>\n<li>\u5927\u89c4\u6a21&#xff1a;ZK\u96c6\u7fa43\u53f0 &#043; Broker\u96c6\u7fa45\u53f0\u4ee5\u4e0a<\/li>\n<\/ul>\n<h4>Q6&#xff1a;\u5982\u4f55\u5907\u4efd\u548c\u6062\u590dKafka\u6570\u636e&#xff1f;<\/h4>\n<p>A&#xff1a;<\/p>\n<ul>\n<li>\u5907\u4efd&#xff1a;\u76f4\u63a5\u590d\u5236log.dirs\u76ee\u5f55\u6570\u636e<\/li>\n<li>\u6062\u590d&#xff1a;\u505c\u6b62Broker \u2192 \u66ff\u6362\u6570\u636e\u76ee\u5f55 \u2192 \u91cd\u542f \u2192 \u7b49\u5f85\u526f\u672c\u540c\u6b65<\/li>\n<li>\u5de5\u5177&#xff1a;\u8003\u8651\u4f7f\u7528MirrorMaker\u8fdb\u884c\u8de8\u96c6\u7fa4\u590d\u5236<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5341\u3001\u603b\u7ed3&#xff1a;\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb\u7684\u6570\u636e\u9ad8\u901f\u516c\u8def<\/h3>\n<p>\u901a\u8fc7\u4eca\u5929\u7684\u5b9e\u6218&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86&#xff1a;<br \/>\n\u2705 Zookeeper\u96c6\u7fa4\u90e8\u7f72\u2014\u2014\u5efa\u7acb\u53ef\u9760\u7684\u9009\u4e3e\u4e2d\u5fc3<br \/>\n\u2705 Kafka Broker\u96c6\u7fa4\u914d\u7f6e\u2014\u2014\u6784\u5efa\u5f39\u6027\u7684\u6d88\u606f\u5f15\u64ce<br \/>\n\u2705 \u5206\u5e03\u5f0fTopic\u521b\u5efa\u2014\u2014\u4f53\u9a8c\u771f\u6b63\u7684\u5206\u533a\u4e0e\u526f\u672c\u673a\u5236<br \/>\n\u2705 \u6545\u969c\u6392\u67e5\u6280\u80fd\u2014\u2014\u638c\u63e1\u96c6\u7fa4\u8fd0\u7ef4\u7684\u5173\u952e\u547d\u4ee4<\/p>\n<p>\u6d88\u606f\u5982\u6d41\u6c34&#xff0c;Kafka\u662f\u6e20\u9053&#xff0c;\u800c\u96c6\u7fa4\u5c31\u662f\u7531\u591a\u6761\u6e20\u9053\u7ec4\u6210\u7684\u667a\u80fd\u6c34\u7f51\u3002\u5373\u4f7f\u67d0\u6761\u6e20\u9053\u4e34\u65f6\u5835\u585e&#xff0c;\u6c34\u6d41\u4f9d\u7136\u80fd\u901a\u8fc7\u5176\u4ed6\u8def\u5f84\u5230\u8fbe\u76ee\u7684\u5730\u3002<\/p>\n<p>\u73b0\u5728&#xff0c;\u4f60\u5df2\u7ecf\u62e5\u6709\u4e86\u4e00\u4e2a\u771f\u6b63\u9ad8\u53ef\u7528\u7684Kafka\u96c6\u7fa4\u3002\u5b83\u4e0d\u4ec5\u80fd\u5b58\u50a8\u6d77\u91cf\u6570\u636e&#xff0c;\u8fd8\u80fd\u5728\u90e8\u5206\u8282\u70b9\u6545\u969c\u65f6\u81ea\u52a8\u6062\u590d&#xff0c;\u4e3a\u4f60\u7684\u4e1a\u52a1\u63d0\u4f9b\u575a\u5b9e\u7684\u6570\u636e\u6d41\u8f6c\u4fdd\u969c\u3002<\/p>\n<p>\u4e0b\u4e00\u671f&#xff0c;\u6211\u4eec\u5c06\u6df1\u5165Kafka\u7684\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005\u9ad8\u7ea7\u914d\u7f6e&#xff0c;\u63a2\u7d22\u5982\u4f55\u4f18\u5316\u541e\u5410\u91cf\u3001\u4fdd\u8bc1\u6d88\u606f\u987a\u5e8f\u3001\u5b9e\u73b0\u7cbe\u786e\u4e00\u6b21\u8bed\u4e49\u7b49\u9ad8\u7ea7\u7279\u6027\u3002<\/p>\n<hr \/>\n<p>\u52a8\u624b\u6311\u6218&#xff1a;\u5c1d\u8bd5\u5728\u642d\u5efa\u597d\u7684\u96c6\u7fa4\u4e2d&#xff0c;\u6a21\u62dfBroker\u5b95\u673a&#xff0c;\u89c2\u5bdfLeader\u5982\u4f55\u81ea\u52a8\u5207\u6362&#xff0c;\u5e76\u8bb0\u5f55\u5207\u6362\u65f6\u95f4\u548c\u6570\u636e\u5b8c\u6574\u6027\u3002\u6b22\u8fce\u5728\u7559\u8a00\u533a\u5206\u4eab\u4f60\u7684\u5b9e\u9a8c\u7ed3\u679c&#xff01;<\/p>\n<hr \/>\n<p>&#x1f4f2; \u5173\u6ce8\u516c\u4f17\u53f7\u3010\u7801\u5ba2\u7814\u7a76\u6240\u3011<br \/>\n\u6bcf\u5929\u8fdb\u6b65\u4e00\u70b9\u70b9&#xff0c;\u8ba9\u4f60\u4e0a\u73ed\u5c11\u52a0\u73ed&#xff0c;\u4e0b\u73ed\u65e9\u56de\u5bb6&#xff01;<\/p>\n<hr \/>\n<p>\u4f5c\u8005&#xff1a;MarkYe<br \/>\n\u6240\u5c5e\u5408\u96c6&#xff1a;\u300a\u6d41\u5f0f\u5fc3\u4f20\u00b7MQ\u624b\u672d\u300b<br \/>\n\u5173\u952e\u8bcd&#xff1a; Kafka\u96c6\u7fa4\u642d\u5efa\u3001\u9ad8\u53ef\u7528\u67b6\u6784\u3001Zookeeper\u914d\u7f6e\u3001\u5206\u5e03\u5f0f\u6d88\u606f\u961f\u5217\u3001\u6545\u969c\u8f6c\u79fb\u3001\u5206\u533a\u526f\u672c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u624b\u628a\u624b\u6559\u4f60\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684Kafka\u96c6\u7fa4&#xff0c;\u6db5\u76d6Zookeeper\u9009\u4e3e\u3001Broker\u914d\u7f6e\u3001Topic\u5206\u533a\u7b56\u7565\u53ca\u6545\u969c\u6392\u67e5\u5168\u6d41\u7a0b\u3002\u4e00\u3001\u5f00\u7bc7&#xff1a;\u4ece\u5355\u673a\u5230\u96c6\u7fa4&#xff0c;\u8fc8\u51fa\u9ad8\u53ef\u7528\u7b2c\u4e00\u6b65<br \/>\n\u5728\u524d\u51e0\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u4f53\u9a8c\u4e86Kafka\u5355\u673a\u7248\u7684\u5a01\u529b\u3002\u4f46\u5728\u771f\u5b9e\u7684\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5355\u70b9\u6545\u969c\u548c\u5bb9\u91cf\u74f6\u9888\u662f\u5fc5\u987b\u89e3\u51b3\u7684\u95ee\u9898\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c06\u4e00\u8d77\u8fc8\u51fa\u5173\u952e\u4e00\u6b65\u2014\u2014\u4ece\u5355\u53f0\u670d\u52a1\u5668\u6269\u5c55\u5230\u4e09\u53f0\u670d\u52a1\u5668&#xff0c;\u642d\u5efa\u4e00\u4e2a\u5177\u5907\u9ad8\u53ef\u7528\u548c\u6a2a\u5411\u6269\u5c55\u80fd\u529b\u7684Ka<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1114,3231,43],"topic":[],"class_list":["post-85032","post","type-post","status-publish","format-standard","hentry","category-server","tag-kafka","tag-linq","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/85032.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u624b\u628a\u624b\u6559\u4f60\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684Kafka\u96c6\u7fa4&#xff0c;\u6db5\u76d6Zookeeper\u9009\u4e3e\u3001Broker\u914d\u7f6e\u3001Topic\u5206\u533a\u7b56\u7565\u53ca\u6545\u969c\u6392\u67e5\u5168\u6d41\u7a0b\u3002\u4e00\u3001\u5f00\u7bc7&#xff1a;\u4ece\u5355\u673a\u5230\u96c6\u7fa4&#xff0c;\u8fc8\u51fa\u9ad8\u53ef\u7528\u7b2c\u4e00\u6b65 \u5728\u524d\u51e0\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u4f53\u9a8c\u4e86Kafka\u5355\u673a\u7248\u7684\u5a01\u529b\u3002\u4f46\u5728\u771f\u5b9e\u7684\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5355\u70b9\u6545\u969c\u548c\u5bb9\u91cf\u74f6\u9888\u662f\u5fc5\u987b\u89e3\u51b3\u7684\u95ee\u9898\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c06\u4e00\u8d77\u8fc8\u51fa\u5173\u952e\u4e00\u6b65\u2014\u2014\u4ece\u5355\u53f0\u670d\u52a1\u5668\u6269\u5c55\u5230\u4e09\u53f0\u670d\u52a1\u5668&#xff0c;\u642d\u5efa\u4e00\u4e2a\u5177\u5907\u9ad8\u53ef\u7528\u548c\u6a2a\u5411\u6269\u5c55\u80fd\u529b\u7684Ka\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/85032.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T14:40:35+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85032.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/85032.html\",\"name\":\"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T14:40:35+00:00\",\"dateModified\":\"2026-07-26T14:40:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/85032.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/85032.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85032.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/85032.html","og_locale":"zh_CN","og_type":"article","og_title":"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u672c\u6587\u624b\u628a\u624b\u6559\u4f60\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684Kafka\u96c6\u7fa4&#xff0c;\u6db5\u76d6Zookeeper\u9009\u4e3e\u3001Broker\u914d\u7f6e\u3001Topic\u5206\u533a\u7b56\u7565\u53ca\u6545\u969c\u6392\u67e5\u5168\u6d41\u7a0b\u3002\u4e00\u3001\u5f00\u7bc7&#xff1a;\u4ece\u5355\u673a\u5230\u96c6\u7fa4&#xff0c;\u8fc8\u51fa\u9ad8\u53ef\u7528\u7b2c\u4e00\u6b65 \u5728\u524d\u51e0\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u4f53\u9a8c\u4e86Kafka\u5355\u673a\u7248\u7684\u5a01\u529b\u3002\u4f46\u5728\u771f\u5b9e\u7684\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5355\u70b9\u6545\u969c\u548c\u5bb9\u91cf\u74f6\u9888\u662f\u5fc5\u987b\u89e3\u51b3\u7684\u95ee\u9898\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c06\u4e00\u8d77\u8fc8\u51fa\u5173\u952e\u4e00\u6b65\u2014\u2014\u4ece\u5355\u53f0\u670d\u52a1\u5668\u6269\u5c55\u5230\u4e09\u53f0\u670d\u52a1\u5668&#xff0c;\u642d\u5efa\u4e00\u4e2a\u5177\u5907\u9ad8\u53ef\u7528\u548c\u6a2a\u5411\u6269\u5c55\u80fd\u529b\u7684Ka","og_url":"https:\/\/www.wsisp.com\/helps\/85032.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T14:40:35+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/85032.html","url":"https:\/\/www.wsisp.com\/helps\/85032.html","name":"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T14:40:35+00:00","dateModified":"2026-07-26T14:40:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/85032.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/85032.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/85032.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Kafka\uff0805\uff09\u642d\u5efa\u9ad8\u53ef\u7528Kafka\u96c6\u7fa4\uff1a\u4ece\u4e09\u53f0\u670d\u52a1\u5668\u5f00\u59cb"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=85032"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85032\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=85032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=85032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=85032"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=85032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}