{"id":25004,"date":"2025-04-19T11:22:20","date_gmt":"2025-04-19T03:22:20","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/25004.html"},"modified":"2025-04-19T11:22:20","modified_gmt":"2025-04-19T03:22:20","slug":"%e5%9c%a8windows%e4%b8%8b%e6%90%ad%e5%bb%bakafka%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%8c%e4%bd%bf%e7%94%a8python%e5%88%b6%e4%bd%9c%e7%94%9f%e4%ba%a7%e8%80%85%e4%b8%8e%e6%b6%88%e8%b4%b9%e8%80%85","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/25004.html","title":{"rendered":"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005"},"content":{"rendered":"<p>\u63d0\u793a&#xff1a;\u6587\u7ae0\u5199\u5b8c\u540e&#xff0c;\u76ee\u5f55\u53ef\u4ee5\u81ea\u52a8\u751f\u6210&#xff0c;\u5982\u4f55\u751f\u6210\u53ef\u53c2\u8003\u53f3\u8fb9\u7684\u5e2e\u52a9\u6587\u6863<\/p>\n<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\u524d\u8a00<\/li>\n<li>\n<ul>\n<li>JDK\u5b89\u88c5<\/li>\n<li>\n<ul>\n<li>1.\u4e0b\u8f7djdk<\/li>\n<li>2.\u5b89\u88c5jdk<\/li>\n<li>3.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/li>\n<li>4.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/li>\n<\/ul>\n<\/li>\n<li>Zookeeper\u5b89\u88c5<\/li>\n<li>\n<ul>\n<li>1.\u4e0b\u8f7dZookeeper<\/li>\n<li>2.\u5b89\u88c5Zookeeper<\/li>\n<li>3.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/li>\n<li>4.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/li>\n<\/ul>\n<\/li>\n<li>Scala\u5b89\u88c5<\/li>\n<li>\n<ul>\n<li>1.\u4e0b\u8f7dScala<\/li>\n<li>2.\u5b89\u88c5Scala<\/li>\n<li>3.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/li>\n<li>4.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/li>\n<\/ul>\n<\/li>\n<li>\u5b89\u88c5kafka<\/li>\n<li>\n<ul>\n<li>1.\u4e0b\u8f7dkafka<\/li>\n<li>2.\u5b89\u88c5kafka<\/li>\n<\/ul>\n<\/li>\n<li>Kafka\u8fd0\u884c<\/li>\n<li>\u4e0epython\u7ed3\u5408\u5b9e\u4f8b&#xff0c;\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005<\/li>\n<li>\u5f85\u5b8c\u5584\u7684\u95ee\u9898<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h2>\u524d\u8a00<\/h2>\n<p>\u5b89\u88c5Kafka\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5b89\u88c5JDK\u3001Zookeeper\u3001Scala\u3002 JDK&#xff08;Java Development Kit&#xff09;\u662f Java \u5f00\u53d1\u5de5\u5177\u5305,\u5b83\u5305\u62ec Java \u7f16\u8bd1\u5668&#xff08;javac&#xff09;\u7528\u4e8e\u5c06\u4ee3\u7801\u7f16\u8bd1\u6210\u5b57\u8282\u7801&#xff0c;Java \u865a\u62df\u673a&#xff08;JVM&#xff09;\u8d1f\u8d23\u8fd0\u884c\u5b57\u8282\u7801&#xff0c;\u8fd8\u6709\u5927\u91cf\u7684 Java \u6838\u5fc3\u7c7b\u5e93\u3002\u8fd9\u4e9b\u7c7b\u5e93\u4e3a Kafka \u63d0\u4f9b\u4e86\u8bf8\u5982\u7f51\u7edc\u901a\u4fe1\u3001\u6587\u4ef6\u64cd\u4f5c\u3001\u5185\u5b58\u7ba1\u7406\u7b49\u57fa\u7840\u529f\u80fd\u7684\u652f\u6301\u3002<\/p>\n<p>Zookeeper \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u3001\u5f00\u6e90\u7684\u5e94\u7528\u7a0b\u5e8f\u534f\u8c03\u670d\u52a1\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u7ef4\u62a4\u914d\u7f6e\u4fe1\u606f\u3001\u547d\u540d\u3001\u63d0\u4f9b\u5206\u5e03\u5f0f\u540c\u6b65\u548c\u7ec4\u670d\u52a1\u7b49\u3002\u5b83\u4ee5\u4e00\u79cd\u7b80\u5355\u7684\u5c42\u6b21\u7ed3\u6784\u6570\u636e\u6a21\u578b&#xff08;\u7c7b\u4f3c\u6587\u4ef6\u7cfb\u7edf\u7684\u76ee\u5f55\u6811\u7ed3\u6784&#xff09;\u6765\u5b58\u50a8\u6570\u636e\u3002<\/p>\n<p>Scala \u8fd0\u884c\u5728 Java \u865a\u62df\u673a\u4e0a&#xff0c;\u53ef\u4ee5\u4e0e Java \u4ee3\u7801\u65e0\u7f1d\u96c6\u6210\u3002\u5b83\u5177\u6709\u8bb8\u591a\u72ec\u7279\u7684\u7279\u6027&#xff0c;\u6bd4\u5982\u7c7b\u578b\u63a8\u65ad&#xff0c;\u8fd9\u4f7f\u5f97\u4ee3\u7801\u7f16\u5199\u66f4\u52a0\u7b80\u6d01\u3002<\/p>\n<p>\u5b89\u88c5\u539f\u56e0\u4e0e\u4f7f\u7528&#xff1a;Kafka \u662f\u7528 Scala \u7f16\u5199\u7684&#xff0c;\u800c Scala \u8fd0\u884c\u5728 Java \u865a\u62df\u673a&#xff08;JVM&#xff09;\u4e0a\u3002JDK \u63d0\u4f9b\u4e86 Java \u7f16\u8bd1\u5668\u548c Java \u865a\u62df\u673a\u7b49\u5173\u952e\u7ec4\u4ef6&#xff0c;\u662f Kafka \u8fd0\u884c\u7684\u57fa\u7840\u73af\u5883\u3002Kafka \u7684\u542f\u52a8\u811a\u672c\u3001\u6838\u5fc3\u4ee3\u7801\u7684\u6267\u884c\u90fd\u4f9d\u8d56\u4e8e JVM&#xff0c;\u6ca1\u6709 JDK&#xff0c;Kafka \u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\u3002Kafka \u4f7f\u7528 Zookeeper \u6765\u7ba1\u7406\u548c\u534f\u8c03\u96c6\u7fa4\u3002Zookeeper \u5b58\u50a8\u4e86 Kafka \u96c6\u7fa4\u7684\u5143\u6570\u636e\u4fe1\u606f&#xff0c;\u6bd4\u5982\u96c6\u7fa4\u4e2d\u6709\u54ea\u4e9b broker&#xff08;Kafka \u670d\u52a1\u5668&#xff09;\u3001\u6bcf\u4e2a topic&#xff08;\u4e3b\u9898&#xff09;\u7684\u5206\u533a\u5206\u5e03\u60c5\u51b5\u3001\u6d88\u8d39\u8005\u7684\u6d88\u8d39\u504f\u79fb\u91cf\u7b49\u4fe1\u606f\u3002\u5b83\u5728 Kafka \u96c6\u7fa4\u7684\u52a8\u6001\u6269\u5c55\u3001\u6545\u969c\u6062\u590d\u7b49\u8fc7\u7a0b\u4e2d\u8d77\u5230\u5173\u952e\u7684\u534f\u8c03\u4f5c\u7528\u3002<\/p>\n<h3>JDK\u5b89\u88c5<\/h3>\n<h4>1.\u4e0b\u8f7djdk<\/h4>\n<p>\u5b98\u7f51\u5730\u5740\u5b89\u88c5\u94fe\u63a5&#xff1a;https:\/\/www.oracle.com\/java\/technologies\/downloads \u8fdb\u5165\u5b98\u7f51\u540e <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e845aa2.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8fd9\u91cc\u4e0b\u8f7d\u7684\u662fWindows\u7248\u672c\u7684JDK 23&#xff0c;\u4ece\u4e0a\u5230\u4e0b x64 Compressed Archive&#xff08;228.70 MB&#xff09;\u662f\u4e00\u4e2a\u538b\u7f29\u6587\u4ef6&#xff08;.zip&#xff09;&#xff0c;\u8fd9\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\u4e0b\u8f7d\u540e\u9700\u8981\u624b\u52a8\u89e3\u538b&#xff0c;\u7136\u540e\u914d\u7f6e\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u624d\u80fd\u4f7f\u7528 JDK\u3002\u9002\u5408\u90a3\u4e9b\u559c\u6b22\u624b\u52a8\u7ba1\u7406\u8f6f\u4ef6\u5b89\u88c5\u548c\u914d\u7f6e\u7684\u7528\u6237\u3002<\/p>\n<p>x64 Installer&#xff08;205.21 MB&#xff09;\u662f\u4e00\u4e2a\u53ef\u6267\u884c\u7684\u5b89\u88c5\u7a0b\u5e8f&#xff08;.exe&#xff09;&#xff0c;\u8fd9\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\u4e0b\u8f7d\u540e&#xff0c;\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u53cc\u51fb\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u5c06 JDK \u5b89\u88c5\u5230\u7cfb\u7edf\u4e2d\u3002<\/p>\n<p>x64 MSI Installer&#xff08;203.96 MB&#xff09;\u662f\u4e00\u4e2a Windows Installer \u5305&#xff08;.msi&#xff09;\u8fd9\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\u901a\u5e38\u7528\u4e8e\u4f01\u4e1a\u73af\u5883\u6216\u901a\u8fc7\u7ec4\u7b56\u7565\u8fdb\u884c\u8f6f\u4ef6\u90e8\u7f72\u3002\u5b83\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u5b89\u88c5\u9009\u9879\u3002 \u8fd9\u91cc\u6211\u4eec\u76f4\u63a5\u4e0b\u8f7d\u7b2c\u4e8c\u79cd&#xff0c;\u5982\u679c\u6709\u522b\u7684\u9700\u6c42&#xff0c;\u4e5f\u53ef\u4ee5\u6309\u9700\u4e0b\u8f7d\u4e0d\u540c\u7cfb\u7edf\u7684JDK\u5b89\u88c5\u6587\u4ef6\u3002<\/p>\n<h4>2.\u5b89\u88c5jdk<\/h4>\n<p>\u4e0b\u8f7d\u540e\u5728\u6587\u4ef6\u5939\u627e\u5230\u6587\u4ef6\u5982\u56fe\u6240\u793a <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e86623d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u53cc\u51fb\u8fd0\u884c\u8fd9\u4e2a\u6587\u4ef6&#xff0c;\u8ddf\u968f\u7ed9\u51fa\u7684\u6b65\u9aa4\u64cd\u4f5c\u5c31\u53ef\u4ee5\u5b89\u88c5\u597dJDK&#xff0c;\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u4fee\u6539JDK\u7684\u5b89\u88c5\u76ee\u5f55&#xff0c;\u8fd9\u91cc\u6ce8\u610f&#xff1a;\u5b89\u88c5\u76ee\u5f55\u4e00\u5b9a\u4e0d\u8981\u7528\u4e2d\u6587&#xff0c;\u5e76\u4e14\u4e0d\u80fd\u6709\u7a7a\u683c\u3002\u5efa\u8bae\u76f4\u63a5\u7528\u9ed8\u8ba4\u7684\u5b89\u88c5\u8def\u5f84\u4e00\u822c\u4e3aC:\\\\Program Files\\\\Java\\\\jdk-23\u6216\u8005C:\\\\Program\\\\Java\\\\jdk-23&#xff0c;\u4e0d\u60f3\u4fee\u6539\u5c31\u8bb0\u4e00\u4e0b\u8fd9\u91cc\u7684\u8def\u5f84&#xff0c;\u540e\u9762\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u9700\u8981\u7528\u5230\u3002<\/p>\n<h4>3.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/h4>\n<p>\u6309\u4e0bwindow\u952e&#043;R&#xff0c;\u5728\u8fd0\u884c\u680f\u4e2d\u8f93\u5165cmd&#xff0c; \u8f93\u5165\u5982\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p><span class=\"token function\">java<\/span> <span class=\"token parameter variable\">-version<\/span>         &#8211;\u6267\u884c\u5de5\u5177<br \/>\njavac <span class=\"token parameter variable\">-version<\/span>        &#8211;\u7f16\u8bd1\u5de5\u5177<\/p>\n<p>\u5982\u56fe&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e882345.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u51fa\u73b0\u7248\u672c\u53f7&#xff0c;\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<h4>4.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h4>\n<p>\u4e0a\u9762\u6211\u4eec\u8fd8\u6ca1\u6709\u914d\u7f6e\u73af\u5883\u53d8\u91cf&#xff0c;\u5728cmd\u7ec8\u7aef\u5c31\u80fd\u4f7f\u7528\u5982\u4e0a\u7684\u201cjava -version \u201d \u3001\u201cjavac -version\u201d,&#xff0c;\u8fd9\u662f\u56e0\u4e3a\u73b0\u5728\u7684\u7248\u672c\u5b89\u88c5jdk\u540e&#xff0c;\u4f1a\u81ea\u52a8\u7ed9\u6211\u4eec\u521b\u5efa\u597d\u73af\u5883\u53d8\u91cf&#xff08;\u8def\u5f84\u5728xx\\\\xx\\\\xx\\\\Java\\\\javapath&#xff09;&#xff0c;\u4ee5\u524d\u7684\u7248\u672c\u662f\u5fc5\u987b\u624b\u5de5\u521b\u5efa\u7684&#xff0c;\u65b9\u6cd5\u5982\u4e0b&#xff1a; \u9996\u5148&#xff0c;\u6253\u5f00\u201c\u7f16\u8f91\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u201d <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e8a24fd.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8fdb\u5165\u7cfb\u7edf\u53d8\u91cf\u2013path <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e8cd81a.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u5220\u9664\u81ea\u52a8\u521b\u5efa\u7684\u8def\u5f84&#xff08;xx\\\\xx\\\\xx\\\\Java\\\\javapath&#xff09;<\/p>\n<p>\u7136\u540e\u518d\u53bb\u73af\u5883\u53d8\u91cf\u91cc\u6dfb\u52a0\u8def\u5f84&#xff0c;\u9996\u5148\u70b9\u51fb\u65b0\u5efa&#xff0c;\u540d\u79f0\u4e3aJAVA_HOME&#xff0c;\u503c\u4e3a\u4e0a\u9762\u5b58\u653eJDK\u7684\u6587\u4ef6\u8def\u5f84&#xff08;\u6211\u7684JDK\u6587\u4ef6\u4e0b\u8f7d\u5728C:\\\\Program Files\\\\Java\\\\jdk-23&#xff09;\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e8ef0d8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u7136\u540e\u518d\u5230\u73af\u5883\u53d8\u91cfpath\u4e2d\u6dfb\u52a0JAVA_HOME&#xff0c;\u9996\u5148\u53cc\u51fbpath\u6253\u5f00\u8be5\u53d8\u91cf\u76ee\u5f55\u70b9\u51fb\u65b0\u5efa&#xff0c;\u6dfb\u52a0\u53d8\u91cf%JAVA_HOME%\\\\bin,\u5b8c\u6210\u540e\u5982\u4e0b <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032217-680316e91e153.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> OK &#xff0c;\u4ee5\u540e\u5982\u679c\u6539\u4e86jdk\u7684\u5b89\u88c5\u8def\u5f84&#xff0c;\u53ea\u9700\u8981\u66f4\u6539JAVA_HOME\u7684\u503c\u5373\u53ef\u3002<\/p>\n<h3>Zookeeper\u5b89\u88c5<\/h3>\n<h4>1.\u4e0b\u8f7dZookeeper<\/h4>\n<p>\u5b89\u88c5\u94fe\u63a5&#xff1a;https:\/\/pan.baidu.com\/s\/1TbgZXmK5_O8W4iZiuFicgw?pwd&#061;yyds \u6211\u8fd9\u91cc\u662f\u901a\u8fc7\u4e00\u4e2a\u535a\u4e3b\u7684\u7f51\u76d8\u94fe\u63a5\u4e0b\u8f7d\u7684 \u53c2\u8003\u6587\u7ae0&#xff1a;\u3010Zookeeper\u3011Windows\u4e0b\u5b89\u88c5Zookeeper&#xff08;\u56fe\u6587\u8bb0\u5f55\u8be6\u7ec6\u6b65\u9aa4&#xff0c;\u624b\u628a\u624b\u5305\u5b89\u88c5\u6210\u529f&#xff09;<\/p>\n<h4>2.\u5b89\u88c5Zookeeper<\/h4>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u6211\u4e0b\u8f7d\u540e\u89e3\u538b\u5728E:bigdata&#xff0c;\u6587\u4ef6\u540d\u5c31\u662fzookeeper&#xff0c; \u8fdb\u5165\u76ee\u5f55\u540e\u8981\u65b0\u5efa\u4e00\u4e2adata\u6587\u4ef6&#xff0c; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032217-680316e948ef7.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u7136\u540e\u8fdb\u5165conf\u76ee\u5f55&#xff0c; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032217-680316e96dc4e.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u4fee\u6539zoo_sample.cfg\u6587\u4ef6&#xff0c;\u6539\u540d\u4e3azoo.cfg&#xff0c;\u6211\u8fd9\u91cc\u76f4\u63a5\u590d\u5236\u4e86\u4e00\u4efd\u6539\u4e86\u4e00\u4e0b\u540d\u5b57 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032217-680316e9930f5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>&#xff0c;\u518d\u8fdb\u5165zoo.cfg\u628adataDir&#061;\/tmp\/zookeeper \u4fee\u6539\u4e3adata\u6587\u4ef6\u8def\u5f84dataDir&#061;E:\\\\bigdata\\\\zookeeper\\\\data <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032217-680316e9b5df8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u5728\u8fd9\u91cc\u6709\u4e00\u4e2a\u5c0f\u95ee\u9898&#xff0c;\u56e0\u4e3a\u6211\u7684zookeeper\u6587\u4ef6\u6700\u5f00\u59cb\u76f4\u63a5\u5b89\u88c5\u5728E\u76d8&#xff0c;\u4e0d\u662fbigdata\u6587\u4ef6&#xff0c;\u6240\u4ee5\u8def\u5f84\u662fE:\\\\zookeeper\\\\data\u56e0\u6b64\u50a8\u5b58\u4fe1\u606f\u7684zookeeper\u6587\u4ef6\u51fa\u73b0\u5728E\u76d8&#xff0c;\u5982\u679c\u60f3\u4fee\u6539\u6216\u5220\u9664kafka\u8fd0\u884c\u7684\u76f8\u5173\u6587\u4ef6&#xff0c;\u4e0d\u4ec5\u8981\u4fee\u6539\u6216\u5220\u9664kafka\u6587\u4ef6\u91cc\u7684\u50a8\u5b58\u6587\u4ef6&#xff0c;\u8fd8\u8981\u4fee\u6539\u6216\u5220\u9664\u8fd9\u4e2a\u51fa\u73b0\u5728E\u76d8\u7684\u6587\u4ef6 \u4ee5\u4e0azookeeper\u6587\u4ef6\u5b89\u88c5\u548c\u914d\u7f6e\u5c31\u5b8c\u6210\u4e86<\/p>\n<h4>3.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h4>\n<p>\u518d\u5982\u540cJDK\u6587\u4ef6\u4e00\u6837\u53bb\u73af\u5883\u53d8\u91cf\u6dfb\u52a0zookeeper\u6587\u4ef6\u7684\u8def\u5f84&#xff0c;\u5148\u5728\u7cfb\u7edf\u53d8\u91cf\u91cc\u6dfb\u52a0ZOOKEEPER_HOME&#xff0c;\u503c\u4e3azookeeper\u6587\u4ef6\u8def\u5f84 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316ea0d5cb.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u518d\u53bbpath\u4e2d\u6dfb\u52a0ZOOKEEPER_HOME&#xff0c; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316ea358ff.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8fd9\u6837&#xff0c;\u4ee5\u540ezookeeper\u6587\u4ef6\u8def\u5f84\u6709\u53d8\u5316\u65f6\u76f4\u63a5\u4fee\u6539ZOOKEEPER_HOME\u5bf9\u5e94\u7684\u503c\u5c31\u884c\u4e86<\/p>\n<h4>4.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/h4>\n<p>\u4ee5\u7ba1\u7406\u5458\u6743\u9650\u6253\u5f00\u547d\u4ee4\u7a97\u53e3&#xff0c;\u8f93\u5165&#xff1a;<\/p>\n<p>zkServer<\/p>\n<p>\u51fa\u73b0\u4e0b\u56fe\u663e\u793a&#xff0c;\u8bf4\u660e\u5b89\u88c5\u6210\u529f <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316ea60ff5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>Scala\u5b89\u88c5<\/h3>\n<h4>1.\u4e0b\u8f7dScala<\/h4>\n<p>\u5b89\u88c5\u94fe\u63a5&#xff1a;https:\/\/pan.baidu.com\/s\/1Qiy1aEndKn_Xs-zSSLaWIA?pwd&#061;yyds \u540c\u4e0a&#xff0c;\u8fd9\u4e2a\u6587\u4ef6\u4e5f\u662f\u5728\u7f51\u76d8\u4e0b\u8f7d\u7684 \u53c2\u8003\u6587\u4ef6&#xff1a;\u3010Scala\u3011Windows\u4e0b\u5b89\u88c5Scala&#xff08;\u4ee5Scala 2.11.12\u4e3a\u4f8b&#xff09;<\/p>\n<h4>2.\u5b89\u88c5Scala<\/h4>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u4e0d\u9700\u8981\u8fdb\u884c\u4fee\u6539&#xff0c;\u76f4\u63a5\u5b89\u88c5\u597d\u5c31\u884c&#xff0c;\u6211\u628a\u8fd9\u4e2a\u6587\u4ef6\u4e5f\u662f\u653e\u5728\u4e86E:bigdata&#xff0c;\u540d\u79f0\u4e3aScala&#xff08;\u6240\u4ee5\u4ed6\u7684\u8def\u5f84\u4e3aE:bigdata\\\\Scala&#xff09;<\/p>\n<h4>3.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h4>\n<p>\u540c\u4e0a&#xff0c;\u53bb\u73af\u5883\u53d8\u91cf\u4e2d\u65b0\u589e\u73af\u5883\u53d8\u91cf SCALA_HOME&#xff0c;\u503c\u4e3aScala\u5bf9\u5e94\u8def\u5f84&#xff0c;\u5982\u4e0b\u56fe&#xff1a;<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316ea89330.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u5e76\u4e14\u5728\u73af\u5883\u53d8\u91cfPath\u6dfb\u52a0\u6761\u76ee&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316eab3eef.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>4.\u9a8c\u8bc1\u662f\u5426\u5b89\u88c5\u6210\u529f<\/h4>\n<p>\u5f00\u542f\u4e00\u4e2a\u65b0\u7684cmd\u7a97\u53e3\u3002\u8f93\u5165&#xff1a;Scala <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032218-680316eadf434.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u51fa\u73b0\u4e0a\u8ff0\u754c\u9762&#xff0c;\u8bf4\u660e\u5b89\u88c5\u6210\u529f<\/p>\n<h3>\u5b89\u88c5kafka<\/h3>\n<h4>1.\u4e0b\u8f7dkafka<\/h4>\n<p>\u5b89\u88c5\u94fe\u63a5&#xff1a;https:\/\/pan.baidu.com\/s\/1Av4ZwQPUaAntwVxz79Ne9w?pwd&#061;yyds \u540c\u4e0a&#xff0c;\u7f51\u76d8\u4e0b\u8f7d \u53c2\u8003\u6587\u4ef6&#xff1a;\u3010Kafka\u3011Windows\u4e0b\u5b89\u88c5Kafka&#xff08;\u56fe\u6587\u8bb0\u5f55\u8be6\u7ec6\u6b65\u9aa4&#xff09;<\/p>\n<h4>2.\u5b89\u88c5kafka<\/h4>\n<p>\u6587\u4ef6\u6211\u4e0b\u8f7d\u5728\u4e86E:bigdata&#xff0c;\u540d\u79f0\u4e3akafka \u63a5\u4e0b\u6765\u9700\u8981\u5728Kafka\u5b89\u88c5\u76ee\u5f55\u4e0b\u65b0\u5efa\u76ee\u5f55logs&#xff0c; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032219-680316eb08cf5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u7136\u540e\u4fee\u6539\u914d\u7f6e\u6587\u4ef6 server.properties \u6587\u4ef6\u8def\u5f84&#xff1a;\u2026bigdata\\\\kafka\\\\config\\\\server.properties \u4fee\u6539 log.dirs \u53c2\u6570\u503c&#xff0c;\u4fee\u6539\u6210\u4e0a\u4e00\u6b65\u65b0\u5efa\u7684logs\u6587\u4ef6\u5939\u3002\u6ce8\u610f\u6587\u4ef6\u5939\u8def\u5f84\u4e2d\u662f\u53cc\u5de6\u659c\u6760&#xff0c; \u4f8b\u5982\u6211\u7684\u662flog.dirs&#061;E:\\\\bigdata\\\\kafka\\\\logs\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032219-680316eb2c6c5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u518d\u7136\u540e\u4fee\u6539 listeners \u53c2\u6570\u503c&#xff0c;\u8fd8\u662f server.properties\u6587\u4ef6&#xff0c; \u572835\u884c\u5de6\u53f3\u6dfb\u52a0listeners&#061;PLAINTEXT:\/\/localhost:9092 \u8fd9\u4e2a\u4ee3\u8868\u4e86\u4f60\u521b\u5efa\u7684kafka\u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7&#xff0c;\u5728\u540e\u7eed\u8fde\u63a5\u8fdb\u884c\u64cd\u4f5c\u65f6\u4f1a\u7528\u5230 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032219-680316eb57224.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u4ee5\u4e0a\u524d\u7f6e\u9700\u8981\u4f7f\u7528\u7684\u6587\u4ef6\u5b89\u88c5\u5b8c\u6210<\/p>\n<h3>Kafka\u8fd0\u884c<\/h3>\n<p>Kafka\u4f9d\u8d56\u4e8eZookeeper&#xff0c; \u6240\u4ee5\u5728\u7ec8\u7aef\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00\u547d\u4ee4\u884c\u9996\u5148\u8f93\u5165\u547d\u4ee4zkServer\u542f\u52a8Zookeeper\u670d\u52a1&#xff0c;\u8fd9\u4e2a\u5728\u9a8c\u8bc1zookeeper\u662f\u5426\u5b89\u88c5\u6210\u529f\u6709\u63d0\u5230&#xff0c;\u5c31\u4e0d\u653e\u56fe\u4e86&#xff0c; \u518d\u53e6\u5f00\u4e00\u4e2a\u547d\u4ee4\u884c&#xff0c;\u8fd8\u662f\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00&#xff0c;\u9996\u5148\u8fdb\u5165kafka\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55&#xff0c;\u4f8b\u5982\u6211\u8fd9\u91cc\u662f\u5728E\u76d8\u7684bigdata\u6587\u4ef6\u4e2d\u6240\u4ee5\u6211\u7684\u8fc7\u7a0b\u5982\u4e0b <img decoding=\"async\" src=\"2025-04-19iu4xreut14y.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8f93\u5165\u5982\u4e0b\u547d\u4ee4\u542f\u52a8Kafka\u670d\u52a1&#xff1a;<\/p>\n<p>.<span class=\"token punctuation\">\\\\<\/span>bin<span class=\"token punctuation\">\\\\<\/span>windows<span class=\"token punctuation\">\\\\<\/span>kafka-server-start.bat .<span class=\"token punctuation\">\\\\<\/span>config<span class=\"token punctuation\">\\\\<\/span>server.properties<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b <img decoding=\"async\" src=\"2025-04-1920nocziwzhj.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u4ee5\u7ba1\u7406\u5458\u6743\u9650\u518d\u65b0\u5f00\u4e00\u4e2a\u547d\u4ee4\u63d0\u793a\u7a97\u53e3&#xff0c;\u8fdb\u5165E:\\\\bigdata\\\\kafka\\\\bin\\\\windows\u76ee\u5f55&#xff0c;<\/p>\n<p><span class=\"token number\">1<\/span><span class=\"token operator\">|<\/span>E:<br \/>\n<span class=\"token number\">2<\/span><span class=\"token operator\">|<\/span><span class=\"token builtin class-name\">cd<\/span> bigdata<span class=\"token punctuation\">\\\\<\/span>kafka<span class=\"token punctuation\">\\\\<\/span>bin<span class=\"token punctuation\">\\\\<\/span>windows<\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff0c;\u521b\u5efatopics&#xff1a;<\/p>\n<p>kafka-topics.bat <span class=\"token parameter variable\">&#8211;create<\/span> &#8211;bootstrap-server localhost:9092 &#8211;replication-factor <span class=\"token number\">1<\/span> <span class=\"token parameter variable\">&#8211;partitions<\/span> <span class=\"token number\">1<\/span> <span class=\"token parameter variable\">&#8211;topic<\/span> <span class=\"token builtin class-name\">test<\/span><\/p>\n<p>kafka &#8211; topics.bat&#xff1a;\u8fd9\u662f Kafka \u7528\u4e8e\u64cd\u4f5c\u4e3b\u9898&#xff08;topic&#xff09;\u7684\u811a\u672c\u6587\u4ef6&#xff08;\u5728 Windows \u73af\u5883\u4e0b&#xff09;\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u4e0e\u4e3b\u9898\u76f8\u5173\u7684\u64cd\u4f5c\u529f\u80fd&#xff0c;\u5982\u521b\u5efa\u3001\u5220\u9664\u3001\u67e5\u770b\u4e3b\u9898\u4fe1\u606f\u7b49\u3002 \u2013create&#xff1a;\u8fd9\u662f\u4e00\u4e2a\u64cd\u4f5c\u6307\u4ee4&#xff0c;\u8868\u793a\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u4e3b\u9898\u3002 \u2013bootstrap &#8211; server localhost:9092&#xff1a;\u6307\u5b9a Kafka \u96c6\u7fa4\u7684\u5f15\u5bfc\u670d\u52a1\u5668\u5730\u5740\u548c\u7aef\u53e3\u3002localhost\u8868\u793a\u672c\u5730\u4e3b\u673a&#xff0c;\u5982\u679c Kafka \u90e8\u7f72\u5728\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a&#xff0c;\u5219\u9700\u8981\u66ff\u6362\u4e3a\u76f8\u5e94\u7684\u670d\u52a1\u5668\u57df\u540d\u6216 IP \u5730\u5740\u30029092\u662f Kafka \u670d\u52a1\u5668\u9ed8\u8ba4\u7684\u76d1\u542c\u7aef\u53e3\u3002\u5ba2\u6237\u7aef&#xff08;\u5982\u8fd9\u4e2a\u521b\u5efa\u4e3b\u9898\u7684\u64cd\u4f5c&#xff09;\u901a\u8fc7\u8fde\u63a5\u5230\u8fd9\u4e2a\u5f15\u5bfc\u670d\u52a1\u5668\u6765\u83b7\u53d6\u6574\u4e2a Kafka \u96c6\u7fa4\u7684\u76f8\u5173\u4fe1\u606f&#xff0c;\u5305\u62ec\u5176\u4ed6\u7684\u670d\u52a1\u5668\u8282\u70b9\u4fe1\u606f\u7b49\u3002 \u2013replication &#8211; factor 1&#xff1a;\u590d\u5236\u56e0\u5b50\u7528\u4e8e\u6307\u5b9a\u4e3b\u9898\u7684\u6bcf\u4e2a\u5206\u533a\u5728 Kafka \u96c6\u7fa4\u4e2d\u7684\u526f\u672c\u6570\u91cf\u3002\u8fd9\u91cc\u8bbe\u7f6e\u4e3a1&#xff0c;\u610f\u5473\u7740\u6bcf\u4e2a\u5206\u533a\u53ea\u6709\u4e00\u4e2a\u526f\u672c\u3002\u5728\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u4e3a\u4e86\u4fdd\u8bc1\u6570\u636e\u7684\u9ad8\u53ef\u7528\u6027\u548c\u5bb9\u9519\u6027&#xff0c;\u901a\u5e38\u4f1a\u8bbe\u7f6e\u5927\u4e8e1\u7684\u503c&#xff0c;\u8fd9\u6837\u5373\u4f7f\u67d0\u4e2a\u8282\u70b9\u51fa\u73b0\u6545\u969c&#xff0c;\u6570\u636e\u4ecd\u7136\u53ef\u4ee5\u4ece\u5176\u4ed6\u526f\u672c\u4e2d\u83b7\u53d6\u3002 \u2013partitions 1&#xff1a;\u6307\u5b9a\u4e3b\u9898\u7684\u5206\u533a\u6570\u91cf\u3002\u5206\u533a\u662f Kafka \u5bf9\u6570\u636e\u8fdb\u884c\u5206\u5e03\u5f0f\u5b58\u50a8\u548c\u5904\u7406\u7684\u57fa\u672c\u5355\u4f4d\u3002\u901a\u8fc7\u5c06\u4e3b\u9898\u5212\u5206\u4e3a\u591a\u4e2a\u5206\u533a&#xff0c;\u53ef\u4ee5\u5b9e\u73b0\u5e76\u884c\u5904\u7406\u6570\u636e&#xff0c;\u63d0\u9ad8\u7cfb\u7edf\u7684\u541e\u5410\u91cf\u3002\u8fd9\u91cc\u521b\u5efa\u7684\u4e3b\u9898\u53ea\u67091\u4e2a\u5206\u533a\u3002 \u2013topic test&#xff1a;\u6307\u5b9a\u8981\u521b\u5efa\u7684\u4e3b\u9898\u540d\u79f0\u4e3atest\u3002\u4e3b\u9898\u662f Kafka \u4e2d\u6d88\u606f\u7684\u5206\u7c7b\u6807\u8bc6&#xff0c;\u751f\u4ea7\u8005\u5c06\u6d88\u606f\u53d1\u9001\u5230\u7279\u5b9a\u7684\u4e3b\u9898&#xff0c;\u6d88\u8d39\u8005\u4ece\u7279\u5b9a\u7684\u4e3b\u9898\u4e2d\u63a5\u6536\u6d88\u606f\u3002 \u7531\u4e0a\u53ef\u77e5&#xff0c;\u2013bootstrap &#8211; server localhost:9092\u8bbe\u7f6e\u7aef\u53e3&#xff0c;\u2013topic test\u8bbe\u7f6e\u4e3b\u9898&#xff0c;\u4e3b\u8981\u901a\u8fc7\u4fee\u6539\u8fd9\u4e24\u4e2a\u503c\u6765\u8fbe\u5230\u533a\u5206\u4e0d\u540c\u4e3b\u673a\u4e0d\u540c\u7aef\u53e3\u7684\u4e0d\u540c\u4e3b\u9898\u7684\u76ee\u7684 <img decoding=\"async\" src=\"2025-04-19ztwgbmgzgad.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u5982\u4e0a\u56fe&#xff0c;\u6211\u8fd9\u91cc\u5df2\u7ecf\u521b\u5efa\u4e86test\u8fd9\u4e2a\u4e3b\u9898&#xff0c;\u6240\u4ee5\u62a5\u9519\u4e86&#xff0c;\u66f4\u6362\u6210test2&#xff0c;\u5f53\u51fa\u73b0Created topic test2.\u8bf4\u660e\u521b\u5efa\u6210\u529f\u3002 \u67e5\u770btopics\u5217\u8868&#xff1a;<\/p>\n<p>kafka-topics.bat &#8211;bootstrap-server localhost:9092 <span class=\"token parameter variable\">&#8211;list<\/span><\/p>\n<p><img decoding=\"async\" src=\"2025-04-19mqlwftyhtvh.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6253\u5f00producer&#xff08;\u751f\u4ea7\u8005&#xff09; \u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u65b0\u5f00\u4e00\u4e2a\u547d\u4ee4\u884c&#xff0c;\u8f93\u5165\u5982\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>kafka-console-producer.bat &#8211;broker-list localhost:9092 <span class=\"token parameter variable\">&#8211;topic<\/span> <span class=\"token builtin class-name\">test<\/span><\/p>\n<p><img decoding=\"async\" src=\"2025-04-19zcefatvltlb.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6253\u5f00consumer&#xff08;\u6d88\u8d39\u8005&#xff09; \u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u65b0\u5f00\u4e00\u4e2a\u547d\u4ee4\u884c&#xff0c;\u8f93\u5165\u5982\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>kafka-console-consumer.bat &#8211;bootstrap-server localhost:9092 <span class=\"token parameter variable\">&#8211;topic<\/span> <span class=\"token builtin class-name\">test<\/span> &#8211;from-beginning<\/p>\n<p><img decoding=\"async\" src=\"2025-04-19z1i1jgjqepl.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8fd9\u6837kafka\u7684\u670d\u52a1\u5668\u5c31\u642d\u5efa\u5b8c\u6210&#xff0c;\u5728producer&#xff08;\u751f\u4ea7\u8005&#xff09;\u8f93\u5165\u4fe1\u606f&#xff0c;\u5728consumer&#xff08;\u6d88\u8d39\u8005&#xff09;\u5c31\u53ef\u4ee5\u5b9e\u65f6\u63a5\u6536\u3002<\/p>\n<h3>\u4e0epython\u7ed3\u5408\u5b9e\u4f8b&#xff0c;\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005<\/h3>\n<p>\u4f7f\u7528pycharm\u8fd0\u884cpython\u6587\u4ef6\u5f80kafka\u670d\u52a1\u5668&#xff0c;\u9996\u5148\u8981\u4e0b\u8f7dkafka\u5e93&#xff0c;\u5728\u81ea\u5df1\u7684\u865a\u62df\u73af\u5883\u8fd0\u884c\u547d\u4ee4pip install kafka&#xff0c;\u5c06\u8fd9\u4e2a\u5e93\u4e0b\u8f7d\u5230\u73af\u5883\u4e2d\u3002 1.\u53d1\u9001\u4fe1\u606f&#xff1a; \u5230pycharm\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token keyword\">from<\/span> kafka <span class=\"token keyword\">import<\/span> KafkaProducer<br \/>\n<span class=\"token keyword\">import<\/span> json<br \/>\n<span class=\"token keyword\">import<\/span> time<\/p>\n<p><span class=\"token comment\"># \u521b\u5efaKafkaProducer\u5b9e\u4f8b<\/span><br \/>\nproducer <span class=\"token operator\">&#061;<\/span> KafkaProducer<span class=\"token punctuation\">(<\/span>bootstrap_servers<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;127.0.0.1:9092&#039;<\/span><span class=\"token punctuation\">,<\/span> value_serializer<span class=\"token operator\">&#061;<\/span><span class=\"token keyword\">lambda<\/span> v<span class=\"token punctuation\">:<\/span> json<span class=\"token punctuation\">.<\/span>dumps<span class=\"token punctuation\">(<\/span>v<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>encode<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;utf-8&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u53d1\u9001\u6d88\u606f\u5230\u6307\u5b9aTopic<\/span><br \/>\ntopic <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;my_topic&#039;<\/span><br \/>\nmessage_dict <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#039;name&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#039;luowei&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;message&#039;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#039;this is a test message&#039;<\/span><span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># \u53d1\u9001\u6d88\u606f<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token boolean\">True<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    producer<span class=\"token punctuation\">.<\/span>send<span class=\"token punctuation\">(<\/span>topic<span class=\"token punctuation\">,<\/span> message_dict<span class=\"token punctuation\">)<\/span><br \/>\n    time<span class=\"token punctuation\">.<\/span>sleep<span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u4f5c\u7528\u662f\u5411\u6307\u5b9a\u7684kafka\u670d\u52a1\u5668\u7aef\u53e3\u91cc\u7684\u4e00\u4e2a\u6307\u5b9a\u4e3b\u9898&#xff0c;\u4ee5utf-8\u7684\u5f62\u5f0f\u6bcf\u96945\u79d2\u53d1\u9001\u4e00\u4e2a\u5b57\u5178&#xff0c;\u662f\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u751f\u4ea7\u8005 \u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801\u540e&#xff0c;\u5728\u7ec8\u7aef\u6253\u5f00\u8fd9\u4e2amy_topic\u7684\u751f\u4ea7\u8005\u53ef\u4ee5\u770b\u5230\u63a5\u6536\u5230\u4e86\u4fe1\u606f <img decoding=\"async\" src=\"2025-04-19cvwoiuvgdtf.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> 2.\u4f7f\u7528\u4ee3\u7801\u8bfb\u53d6kafka\u670d\u52a1\u5668\u4e3b\u9898\u4e2d\u7684\u4fe1\u606f<\/p>\n<p><span class=\"token keyword\">from<\/span> kafka <span class=\"token keyword\">import<\/span> KafkaConsumer<br \/>\n<span class=\"token keyword\">import<\/span> json<\/p>\n<p><span class=\"token comment\"># Kafka\u670d\u52a1\u5668\u5730\u5740\u548c\u8981\u8bfb\u53d6\u7684\u4e3b\u9898\u540d\u79f0<\/span><br \/>\nbootstrap_servers <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;127.0.0.1:9092&#039;<\/span><br \/>\ntopic_name <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#039;my_topic&#039;<\/span><\/p>\n<p><span class=\"token comment\"># \u521b\u5efaKafkaConsumer\u5b9e\u4f8b<\/span><br \/>\nconsumer <span class=\"token operator\">&#061;<\/span> KafkaConsumer<span class=\"token punctuation\">(<\/span><br \/>\n    topic_name<span class=\"token punctuation\">,<\/span><br \/>\n    bootstrap_servers<span class=\"token operator\">&#061;<\/span>bootstrap_servers<span class=\"token punctuation\">,<\/span><br \/>\n    auto_offset_reset<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;earliest&#039;<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\"># \u4ece\u6700\u65e9\u7684\u6d88\u606f\u5f00\u59cb\u8bfb\u53d6&#xff0c;\u5982\u679c\u4e0d\u9700\u8981\u53ef\u4ee5\u4fee\u6539<\/span><br \/>\n    group_id<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;test_group&#039;<\/span>  <span class=\"token comment\"># \u6d88\u8d39\u8005\u7ec4ID&#xff0c;\u53ef\u4ee5\u6839\u636e\u9700\u8981\u4fee\u6539<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">for<\/span> message <span class=\"token keyword\">in<\/span> consumer<span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u8fd9\u91cc\u5047\u8bbe\u6d88\u606f\u7684\u503c\u662f\u5b57\u7b26\u4e32\u7c7b\u578b&#xff0c;\u5982\u679c\u662f\u5176\u4ed6\u7c7b\u578b\u9700\u8981\u76f8\u5e94\u5904\u7406<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u6536\u5230\u6d88\u606f: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>message<span class=\"token punctuation\">.<\/span>value<span class=\"token punctuation\">.<\/span>decode<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;utf-8&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token comment\"># \u5982\u679c\u6d88\u606f\u662fJSON\u683c\u5f0f&#xff0c;\u53ef\u4ee5\u8fd9\u6837\u89e3\u6790<\/span><br \/>\n        <span class=\"token comment\"># message_value &#061; json.loads(message.value.decode(&#039;utf-8&#039;))<\/span><br \/>\n        <span class=\"token comment\"># print(f&#034;\u89e3\u6790\u540e\u7684\u6d88\u606f: {message_value}&#034;)<\/span><br \/>\n    <span class=\"token keyword\">except<\/span> Exception <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u5904\u7406\u6d88\u606f\u65f6\u51fa\u9519: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>e<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u7ed3\u679c\u5982\u4e0b&#xff1a; <img decoding=\"async\" src=\"2025-04-19ui3blzhxfcm.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>\u5f85\u5b8c\u5584\u7684\u95ee\u9898<\/h3>\n<p>1&#xff0c;\u5728\u201ckafka\u8fd0\u884c\u201d\u8fd9\u4e00\u6bb5\u4e2d\u8fd8\u6709\u4e00\u4e2a\u5220\u9664\u65b9\u6cd5&#xff0c;\u6700\u5f00\u59cb\u76f4\u63a5\u8fd0\u884c\u5220\u9664\u547d\u4ee4\u4f1a\u62a5\u9519&#xff0c;\u5728\u7f51\u4e0a\u67e5\u627e\u8d44\u6599\u540e\u53d1\u73b0\u8981\u4fee\u6539\u914d\u7f6e\u6587\u4ef6&#xff0c;\u5728server.properties\u6587\u4ef6\u4e2d\u52a0\u5165delete.topic.enable &#061; true&#xff0c;\u53ef\u662f\u52a0\u5165\u540e\u53d1\u73b0\u4f9d\u65e7\u62a5\u9519&#xff0c;\u5e76\u4e14\u6574\u4e2akafka\u7cfb\u7edf\u8fd8\u4f1a\u62a5\u9519\u9000\u51fa&#xff0c;\u9519\u8bef\u4e0e\u89e3\u91ca\u5982\u4e0b [2024 &#8211; 11 &#8211; 07 17:10:52,557] ERROR [Broker id &#061; 0] Ignoring StopReplica request (delete &#061; true) from controller 0 with correlation id 5 epoch 1 for partition test &#8211; 0 as the local replica for the partition is in an offline log directory (state.change.logger) \u8fd9\u6761\u65e5\u5fd7\u8868\u660e broker 0 \u6536\u5230\u4e86\u6765\u81ea\u63a7\u5236\u5668 0 \u7684\u9488\u5bf9\u5206\u533a test &#8211; 0 \u7684\u505c\u6b62\u526f\u672c&#xff08;StopReplica&#xff09;\u8bf7\u6c42&#xff0c;\u4e14\u8bf7\u6c42\u4e2d\u5305\u542b\u4e86\u5220\u9664&#xff08;delete &#061; true&#xff09;\u64cd\u4f5c\u3002\u7136\u800c&#xff0c;broker 0 \u5ffd\u7565\u4e86\u8fd9\u4e2a\u8bf7\u6c42&#xff0c;\u539f\u56e0\u662f\u5206\u533a test &#8211; 0 \u7684\u672c\u5730\u526f\u672c\u6240\u5728\u7684\u65e5\u5fd7\u76ee\u5f55\u5904\u4e8e\u79bb\u7ebf\u72b6\u6001\u3002\u8fd9\u610f\u5473\u7740 broker \u65e0\u6cd5\u6b63\u5e38\u8bbf\u95ee\u8be5\u5206\u533a\u7684\u65e5\u5fd7\u6570\u636e&#xff0c;\u53ef\u80fd\u662f\u7531\u4e8e\u4e4b\u524d\u63d0\u5230\u7684\u65e5\u5fd7\u76ee\u5f55\u6743\u9650\u95ee\u9898\u6216\u8005\u5176\u4ed6\u5bfc\u81f4\u76ee\u5f55\u4e0d\u53ef\u7528\u7684\u539f\u56e0\u3002 \u7ecf\u8fc7\u67e5\u8be2\u8d44\u6599\u540e\u5f97\u51fa\u53ef\u80fd\u7684\u4e24\u4e2a\u539f\u56e0&#xff1a;\u4e00\u662fkafka\u7248\u672c\u4e0ezookeeper\u4e0d\u662f\u5f88\u9002\u914d&#xff0c;\u4e8c\u662f\u7248\u672c\u4e0e\u8f93\u5165\u547d\u4ee4\u4e0d\u642d&#xff0c;\u5728\u4e00\u4e9b\u8f83\u65e9\u7684\u7248\u672c\u5220\u9664\u547d\u4ee4\u6709\u4e9b\u8bb8\u53d8\u5316 2&#xff0c;\u5728\u4f7f\u7528\u4ee3\u7801\u5199\u5165\u4e0e\u8bfb\u53d6\u65f6\u901f\u5ea6\u8f83\u6162&#xff0c;\u5c24\u5176\u662f\u8bfb\u53d6\u65f6 3&#xff0c;\u5728\u4f7f\u7528\u4ee3\u7801\u53d1\u9001\u65f6&#xff0c;\u65e0\u6cd5\u5411\u5df2\u53d1\u9001\u8fc7\u7684topic\u518d\u6b21\u53d1\u9001\u4fe1\u606f&#xff0c;\u8fd9\u91cc\u53ef\u80fd\u4e0e\u751f\u4ea7\u8005\u7684\u914d\u7f6e\u6587\u4ef6\u6709\u5173&#xff0c;\u56e0\u65f6\u95f4\u539f\u56e0\u5e76\u6ca1\u6709\u6df1\u5165\u7814\u7a76 4.\u5f53\u751f\u4ea7\u8005\u53d1\u9001\u7684\u4fe1\u606f\u662f\u7528UTF-8\u7f16\u7801\u5904\u7406\u65f6&#xff0c;\u6709\u4e9b\u6ca1\u6709\u5c06\u914d\u7f6e\u5b8c\u5584\u7684kafka\u670d\u52a1\u5668\u7ec8\u7aef\u5728\u63a5\u6536\u4fe1\u606f\u65f6\u4f1a\u51fa\u73b0\u4e71\u7801\u60c5\u51b5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u5b89\u88c5Kafka\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5JDK\u3001Zookeeper\u3001Scala\u3002JDK\uff08Java Development Kit\uff09\u662f Java \u5f00\u53d1\u5de5\u5177\u5305,\u5b83\u5305\u62ec Java \u7f16\u8bd1\u5668\uff08javac\uff09\u7528\u4e8e\u5c06\u4ee3\u7801\u7f16\u8bd1\u6210\u5b57\u8282\u7801\uff0cJava \u865a\u62df\u673a\uff08JVM\uff09\u8d1f\u8d23\u8fd0\u884c\u5b57\u8282\u7801\uff0c\u8fd8\u6709\u5927\u91cf\u7684 Java \u6838\u5fc3\u7c7b\u5e93\u3002\u8fd9\u4e9b\u7c7b\u5e93\u4e3a Kafka \u63d0\u4f9b\u4e86\u8bf8\u5982\u7f51\u7edc\u901a\u4fe1\u3001\u6587\u4ef6\u64cd\u4f5c\u3001\u5185\u5b58\u7ba1\u7406\u7b49\u57fa\u7840\u529f\u80fd\u7684\u652f\u6301\u3002Zookeeper \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u3001\u5f00\u6e90\u7684\u5e94\u7528\u7a0b\u5e8f\u534f\u8c03\u670d\u52a1\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u7ef4\u62a4\u914d\u7f6e\u4fe1\u606f\u3001\u547d\u540d\u3001\u63d0\u4f9b\u5206\u5e03\u5f0f\u540c\u6b65\u548c\u7ec4\u670d\u52a1\u7b49\u3002_python kafka\u751f\u4ea7\u8005<\/p>\n","protected":false},"author":2,"featured_media":24984,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1114,81,149,43],"topic":[],"class_list":["post-25004","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-kafka","tag-python","tag-windows","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \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\/25004.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u5b89\u88c5Kafka\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5JDK\u3001Zookeeper\u3001Scala\u3002JDK\uff08Java Development Kit\uff09\u662f Java \u5f00\u53d1\u5de5\u5177\u5305,\u5b83\u5305\u62ec Java \u7f16\u8bd1\u5668\uff08javac\uff09\u7528\u4e8e\u5c06\u4ee3\u7801\u7f16\u8bd1\u6210\u5b57\u8282\u7801\uff0cJava \u865a\u62df\u673a\uff08JVM\uff09\u8d1f\u8d23\u8fd0\u884c\u5b57\u8282\u7801\uff0c\u8fd8\u6709\u5927\u91cf\u7684 Java \u6838\u5fc3\u7c7b\u5e93\u3002\u8fd9\u4e9b\u7c7b\u5e93\u4e3a Kafka \u63d0\u4f9b\u4e86\u8bf8\u5982\u7f51\u7edc\u901a\u4fe1\u3001\u6587\u4ef6\u64cd\u4f5c\u3001\u5185\u5b58\u7ba1\u7406\u7b49\u57fa\u7840\u529f\u80fd\u7684\u652f\u6301\u3002Zookeeper \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u3001\u5f00\u6e90\u7684\u5e94\u7528\u7a0b\u5e8f\u534f\u8c03\u670d\u52a1\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u7ef4\u62a4\u914d\u7f6e\u4fe1\u606f\u3001\u547d\u540d\u3001\u63d0\u4f9b\u5206\u5e03\u5f0f\u540c\u6b65\u548c\u7ec4\u670d\u52a1\u7b49\u3002_python kafka\u751f\u4ea7\u8005\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/25004.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T03:22:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e845aa2.png\" \/>\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\/25004.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/25004.html\",\"name\":\"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T03:22:20+00:00\",\"dateModified\":\"2025-04-19T03:22:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/25004.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/25004.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/25004.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005\"}]},{\"@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":"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \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\/25004.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.9k\u6b21\uff0c\u70b9\u8d5e33\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u5b89\u88c5Kafka\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5JDK\u3001Zookeeper\u3001Scala\u3002JDK\uff08Java Development Kit\uff09\u662f Java \u5f00\u53d1\u5de5\u5177\u5305,\u5b83\u5305\u62ec Java \u7f16\u8bd1\u5668\uff08javac\uff09\u7528\u4e8e\u5c06\u4ee3\u7801\u7f16\u8bd1\u6210\u5b57\u8282\u7801\uff0cJava \u865a\u62df\u673a\uff08JVM\uff09\u8d1f\u8d23\u8fd0\u884c\u5b57\u8282\u7801\uff0c\u8fd8\u6709\u5927\u91cf\u7684 Java \u6838\u5fc3\u7c7b\u5e93\u3002\u8fd9\u4e9b\u7c7b\u5e93\u4e3a Kafka \u63d0\u4f9b\u4e86\u8bf8\u5982\u7f51\u7edc\u901a\u4fe1\u3001\u6587\u4ef6\u64cd\u4f5c\u3001\u5185\u5b58\u7ba1\u7406\u7b49\u57fa\u7840\u529f\u80fd\u7684\u652f\u6301\u3002Zookeeper \u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u3001\u5f00\u6e90\u7684\u5e94\u7528\u7a0b\u5e8f\u534f\u8c03\u670d\u52a1\u3002\u5b83\u4e3b\u8981\u7528\u4e8e\u7ef4\u62a4\u914d\u7f6e\u4fe1\u606f\u3001\u547d\u540d\u3001\u63d0\u4f9b\u5206\u5e03\u5f0f\u540c\u6b65\u548c\u7ec4\u670d\u52a1\u7b49\u3002_python kafka\u751f\u4ea7\u8005","og_url":"https:\/\/www.wsisp.com\/helps\/25004.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T03:22:20+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419032216-680316e845aa2.png"}],"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\/25004.html","url":"https:\/\/www.wsisp.com\/helps\/25004.html","name":"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T03:22:20+00:00","dateModified":"2025-04-19T03:22:20+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/25004.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/25004.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/25004.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5728Windows\u4e0b\u642d\u5efakafka\u670d\u52a1\u5668\uff0c\u4f7f\u7528python\u5236\u4f5c\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005"}]},{"@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\/25004","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=25004"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/25004\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/24984"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=25004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=25004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=25004"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=25004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}