{"id":786,"date":"2023-08-17T09:55:36","date_gmt":"2023-08-17T01:55:36","guid":{"rendered":"https:\/\/zhaocunwei.co.uk\/?p=786"},"modified":"2023-08-17T10:01:36","modified_gmt":"2023-08-17T02:01:36","slug":"kafka-2","status":"publish","type":"post","link":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/","title":{"rendered":"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0"},"content":{"rendered":"<h1>\u524d\u8a00<\/h1>\n<p>Apache Kafka\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u6d41\u5904\u7406\u5e73\u53f0\uff0c\u4e3b\u8981\u7528\u4e8e\u6784\u5efa\u5b9e\u65f6\u6570\u636e\u6d41\u5e94\u7528\u548c\u6570\u636e\u7ba1\u9053\u3002\u5b83\u7684\u5e95\u5c42\u5b9e\u73b0\u6d89\u53ca\u591a\u4e2a\u65b9\u9762\uff0c\u5305\u62ec\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u7ba1\u7406\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0\u7b49\u3002\u4e0b\u9762\u6211\u5c06\u4e3a\u4f60\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e2a\u65b9\u9762\uff0c\u5e76\u63d0\u4f9b\u76f8\u5173\u7684\u4ee3\u7801\u6848\u4f8b\u548c\u6545\u969c\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h1>\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\uff1a<\/h1>\n<p>Kafka\u4f7f\u7528\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u6765\u6301\u4e45\u5316\u6d88\u606f\u3002\u6bcf\u4e2a\u4e3b\u9898\u7684\u6d88\u606f\u90fd\u4f1a\u88ab\u8ffd\u52a0\u5230\u4e00\u4e2a\u6216\u591a\u4e2a\u5206\u533a\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u65e5\u5fd7\u6587\u4ef6\u7684\u547d\u540d\u65b9\u5f0f\u4e3a\u2018<topic>-<partition>.log\u2019\u3002\u6d88\u606f\u6309\u987a\u5e8f\u8ffd\u52a0\u5230\u6587\u4ef6\u4e2d\uff0c\u800c\u4e14\u6bcf\u4e2a\u6d88\u606f\u90fd\u6709\u4e00\u4e2a\u552f\u4e00\u7684\u504f\u79fb\u91cf\u3002<\/p>\n<p>\u6bcf\u4e2a\u5206\u533a\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u65e5\u5fd7\u6bb5\uff08log segment\uff09\uff0c\u5f53\u4e00\u4e2a\u65e5\u5fd7\u6bb5\u8fbe\u5230\u4e00\u5b9a\u5927\u5c0f\u9650\u5236\uff08\u901a\u8fc7\u914d\u7f6e\u9879log.segment.bytes\u6307\u5b9a\uff09\uff0c\u5c31\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6bb5\uff0c\u5e76\u4e14\u65e7\u7684\u65e5\u5fd7\u6bb5\u4f1a\u88ab\u5173\u95ed\uff0c\u4e0d\u518d\u63a5\u6536\u65b0\u6d88\u606f\u3002\u8fd9\u6837\u53ef\u4ee5\u63d0\u9ad8\u5199\u5165\u6027\u80fd\uff0c\u5e76\u5141\u8bb8\u540e\u53f0\u7684\u65e5\u5fd7\u6bb5\u538b\u7f29\u548c\u6e05\u7406\u64cd\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528Kafka Producer\u5c06\u6d88\u606f\u53d1\u9001\u5230\u4e3b\u9898\uff1a<\/p>\n<pre><code class=\"language-java\">import org.apache.kafka.clients.producer.*;\npublic class KafkaProducerExample {\n    public static void main(String[] args) {\n        Properties props = new Properties();\n        props.put(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;);\n        props.put(&quot;key.serializer&quot;, &quot;org.apache.kafka.common.serialization.StringSerializer&quot;);\n        props.put(&quot;value.serializer&quot;, &quot;org.apache.kafka.common.serialization.StringSerializer&quot;);\n        Producer&lt;String, String&gt; producer = new KafkaProducer&lt;&gt;(props);\n        String topic = &quot;my-topic&quot;;\n        String message = &quot;Hello, Kafka!&quot;;\n        ProducerRecord&lt;String, String&gt; record = new ProducerRecord&lt;&gt;(topic, message);\n        producer.send(record, new Callback() {\n            @Override\n            public void onCompletion(RecordMetadata metadata, Exception exception) {\n                if (exception == null) {\n                    System.out.println(&quot;Message sent successfully. Offset: &quot; + metadata.offset());\n                } else {\n                    System.err.println(&quot;Error sending message: &quot; + exception.getMessage());\n                }\n            }\n        });\n        producer.close();\n    }\n}<\/code><\/pre>\n<h1>\u504f\u79fb\u91cf\u7ba1\u7406\uff1a<\/h1>\n<p>Kafka\u4f7f\u7528\u504f\u79fb\u91cf\uff08offset\uff09\u6765\u6807\u8bc6\u6d88\u8d39\u8005\u5728\u5206\u533a\u4e2d\u7684\u4f4d\u7f6e\u3002\u6bcf\u4e2a\u6d88\u8d39\u8005\u7ec4\u7ef4\u62a4\u7740\u6bcf\u4e2a\u5206\u533a\u7684\u504f\u79fb\u91cf\uff0c\u4ee5\u4fbf\u5728\u91cd\u65b0\u542f\u52a8\u540e\u80fd\u591f\u4ece\u6b63\u786e\u7684\u4f4d\u7f6e\u7ee7\u7eed\u6d88\u8d39\u3002<\/p>\n<p>\u504f\u79fb\u91cf\u53ef\u4ee5\u7531\u6d88\u8d39\u8005\u81ea\u4e3b\u7ba1\u7406\uff0c\u4e5f\u53ef\u4ee5\u7531Kafka\u81ea\u52a8\u7ba1\u7406\uff08\u901a\u8fc7\u914d\u7f6e\u9879enable.auto.commit\u548cauto.commit.interval.ms\uff09\u3002\u81ea\u52a8\u63d0\u4ea4\u504f\u79fb\u91cf\u53ef\u80fd\u4f1a\u5728\u6d88\u8d39\u8005\u5931\u8d25\u65f6\u5bfc\u81f4\u6d88\u606f\u91cd\u590d\u5904\u7406\u6216\u4e22\u5931\uff0c\u56e0\u6b64\u901a\u5e38\u5efa\u8bae\u4f7f\u7528\u624b\u52a8\u7ba1\u7406\u504f\u79fb\u91cf\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6d88\u8d39\u8005\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u5982\u4f55\u6d88\u8d39\u4e3b\u9898\u4e2d\u7684\u6d88\u606f\u5e76\u624b\u52a8\u7ba1\u7406\u504f\u79fb\u91cf\uff1a<\/p>\n<pre><code class=\"language-java\">import org.apache.kafka.clients.consumer.*;\nimport java.time.Duration;\nimport java.util.Collections;\nimport java.util.Properties;\npublic class KafkaConsumerExample {\n    public static void main(String[] args) {\n        Properties props = new Properties();\n        props.put(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;);\n        props.put(&quot;group.id&quot;, &quot;my-consumer-group&quot;);\n        props.put(&quot;key.deserializer&quot;, &quot;org.apache.kafka.common.serialization.StringDeserializer&quot;);\n        props.put(&quot;value.deserializer&quot;, &quot;org.apache.kafka.common.serialization.StringDeserializer&quot;);\n        props.put(&quot;auto.offset.reset&quot;, &quot;earliest&quot;); \/\/ Start from the beginning of the partition\n        KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;&gt;(props);\n        String topic = &quot;my-topic&quot;;\n        consumer.subscribe(Collections.singletonList(topic));\n        while (true) {\n            ConsumerRecords&lt;String, String&gt; records = consumer.poll(Duration.ofMillis(100));\n            for (ConsumerRecord&lt;String, String&gt; record : records) {\n                System.out.printf(&quot;Received message: key = %s, value = %s%n&quot;, record.key(), record.value());\n                \/\/ Manually commit the offset after processing the message\n                consumer.commitSync(Collections.singletonMap(record.topicPartition(), new OffsetAndMetadata(record.offset() + 1)));\n            }\n        }\n    }\n}<\/code><\/pre>\n<h1>\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0\uff1a<\/h1>\n<p>Kafka\u4e2d\u7684\u4e3b\u9898\u53ef\u4ee5\u6709\u591a\u4e2a\u5206\u533a\uff0c\u6bcf\u4e2a\u5206\u533a\u53ef\u4ee5\u5206\u5e03\u5728\u4e0d\u540c\u7684Broker\u4e0a\u3002\u6d88\u8d39\u8005\u53ef\u4ee5\u8ba2\u9605\u4e00\u4e2a\u6216\u591a\u4e2a\u4e3b\u9898\uff0c\u901a\u8fc7\u8ba2\u9605\u7684\u65b9\u5f0f\u6765\u6d88\u8d39\u6d88\u606f\u3002\u5f53\u4e3b\u9898\u7684\u5206\u533a\u53d1\u751f\u53d8\u5316\u6216Broker\u6545\u969c\u65f6\uff0cKafka\u4f1a\u81ea\u52a8\u8fdb\u884c\u91cd\u65b0\u5206\u914d\u5206\u533a\u548c\u91cd\u65b0\u5e73\u8861\u6d88\u8d39\u8005\u3002<\/p>\n<p>\u6545\u969c\u53d1\u73b0\u548c\u81ea\u52a8\u5e73\u8861\u662fKafka\u7684\u4e00\u4e2a\u91cd\u8981\u7279\u6027\uff0c\u5b83\u786e\u4fdd\u4e86\u6d88\u8d39\u8005\u80fd\u591f\u5728Broker\u6545\u969c\u6216\u65b0\u589eBroker\u65f6\uff0c\u4ecd\u7136\u80fd\u591f\u5747\u5300\u5730\u5206\u914d\u8d1f\u8f7d\u5e76\u7ee7\u7eed\u6d88\u8d39\u3002<\/p>\n<h1>\u6545\u969c\u89e3\u51b3\u65b9\u6848\uff1a<\/h1>\n<p>Broker\u6545\u969c\uff1a\u5982\u679c\u4e00\u4e2aBroker\u53d1\u751f\u6545\u969c\uff0cKafka\u96c6\u7fa4\u4e2d\u7684\u5176\u4ed6Broker\u4f1a\u63a5\u7ba1\u5176\u5206\u533a\uff0c\u4ece\u800c\u4fdd\u8bc1\u6d88\u606f\u7684\u53ef\u7528\u6027\u3002\u5e94\u914d\u7f6e\u591a\u4e2aBroker\u4ee5\u5b9e\u73b0\u9ad8\u53ef\u7528\u6027\uff0c\u5e76\u4f7f\u7528\u526f\u672c\u673a\u5236\u4fdd\u969c\u6570\u636e\u4e0d\u4e22\u5931\u3002<\/p>\n<p>\u6d88\u8d39\u8005\u6545\u969c\uff1a\u5f53\u6d88\u8d39\u8005\u5931\u8d25\u6216\u8005\u4e3b\u52a8\u5173\u95ed\u65f6\uff0cKafka\u4f1a\u5728\u4e00\u6bb5\u65f6\u95f4\u5185\u7b49\u5f85\u5176\u6062\u590d\u3002\u5982\u679c\u6d88\u8d39\u8005\u957f\u65f6\u95f4\u4e0d\u6d3b\u52a8\uff0cKafka\u5c06\u5047\u8bbe\u5176\u5df2\u7ecf\u5931\u6548\uff0c\u5e76\u91cd\u65b0\u5206\u914d\u5206\u533a\u7ed9\u5176\u4ed6\u6d3b\u8dc3\u7684\u6d88\u8d39\u8005\u3002<\/p>\n<p>\u5206\u533a\u8d1f\u8f7d\u4e0d\u5747\u8861\uff1aKafka\u4f1a\u81ea\u52a8\u76d1\u6d4b\u6d88\u8d39\u8005\u7684\u72b6\u6001\uff0c\u5982\u679c\u67d0\u4e2a\u6d88\u8d39\u8005\u5904\u7406\u901f\u5ea6\u8f83\u6162\uff0c\u4f1a\u5c06\u5176\u5206\u914d\u5230\u66f4\u5c11\u7684\u5206\u533a\u3002\u800c\u5feb\u901f\u5904\u7406\u7684\u6d88\u8d39\u8005\u4f1a\u83b7\u5f97\u66f4\u591a\u7684\u5206\u533a\u3002\u8fd9\u79cd\u673a\u5236\u786e\u4fdd\u4e86\u5206\u533a\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<p>\u504f\u79fb\u91cf\u63d0\u4ea4\u5931\u8d25\uff1a\u5982\u679c\u6d88\u8d39\u8005\u5728\u5904\u7406\u6d88\u606f\u540e\u63d0\u4ea4\u504f\u79fb\u91cf\u65f6\u5931\u8d25\uff0c\u5e94\u4f7f\u7528\u5408\u9002\u7684\u91cd\u8bd5\u673a\u5236\u786e\u4fdd\u504f\u79fb\u91cf\u6700\u7ec8\u80fd\u591f\u63d0\u4ea4\u6210\u529f\u3002<\/p>\n<p>\u6d88\u606f\u91cd\u590d\u6216\u4e22\u5931\uff1a\u7531\u4e8e\u4e0d\u540c\u6d88\u8d39\u8005\u53ef\u80fd\u5904\u7406\u76f8\u540c\u6d88\u606f\uff0c\u51fa\u73b0\u6d88\u606f\u91cd\u590d\u7684\u60c5\u51b5\u3002\u800c\u5728\u6d88\u8d39\u8005\u5904\u7406\u6d88\u606f\u4f46\u672a\u63d0\u4ea4\u504f\u79fb\u91cf\u65f6\uff0c\u6d88\u8d39\u8005\u6545\u969c\u53ef\u80fd\u5bfc\u81f4\u6d88\u606f\u4e22\u5931\u3002\u4e3a\u907f\u514d\u8fd9\u4e9b\u60c5\u51b5\uff0c\u5e94\u6b63\u786e\u7ba1\u7406\u504f\u79fb\u91cf\u3001\u4f7f\u7528\u5e42\u7b49\u751f\u4ea7\u8005\u548c\u5904\u7406\u6d88\u606f\u65f6\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\u6027\u3002<\/p>\n<ol>\n<li>\u504f\u79fb\u91cf\u63d0\u4ea4\u5931\u8d25\u7684\u62a5\u9519\u4fe1\u606f\uff1a<br \/>\n\u62a5\u9519\u4fe1\u606f\uff1aCommitFailedException: Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member.<\/li>\n<\/ol>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u8fd9\u901a\u5e38\u610f\u5473\u7740\u6d88\u8d39\u8005\u7ec4\u5df2\u7ecf\u8fdb\u884c\u4e86\u91cd\u65b0\u5e73\u8861\uff0c\u800c\u5728\u91cd\u65b0\u5e73\u8861\u671f\u95f4\u65e0\u6cd5\u63d0\u4ea4\u504f\u79fb\u91cf\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u63d0\u4ea4\u504f\u79fb\u91cf\u4e4b\u524d\u68c0\u67e5\u662f\u5426\u6709\u6b63\u5728\u8fdb\u884c\u7684\u91cd\u65b0\u5e73\u8861\u6765\u907f\u514d\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<pre><code class=\"language-java\">try {\n    consumer.commitSync();\n} catch (CommitFailedException e) {\n    \/\/ Handle the exception and retry if necessary\n}<\/code><\/pre>\n<p>\u6d88\u606f\u91cd\u590d\u7684\u62a5\u9519\u4fe1\u606f\uff1a<br \/>\n\u62a5\u9519\u4fe1\u606f\uff1aProducerFencedException: Producer has been fenced due to a concurrent producer with a lower epoch.<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u8fd9\u901a\u5e38\u662f\u7531\u4e8e\u751f\u4ea7\u8005\u7684epoch\uff08\u6807\u8bc6\uff09\u4e0d\u5339\u914d\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u4e4b\u524d\u6709\u4e00\u4e2a\u65b0\u7684\u751f\u4ea7\u8005\u52a0\u5165\u4e86\u3002\u5982\u679c\u4f60\u7684\u751f\u4ea7\u8005\u542f\u52a8\u540e\u53d1\u73b0\u81ea\u5df1\u88ab\u7981\u7528\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u65b0\u7684\u751f\u4ea7\u8005ID\uff0c\u6216\u8005\u68c0\u67e5\u662f\u5426\u6709\u5176\u4ed6\u4e0d\u6b63\u786e\u7684\u914d\u7f6e\u3002<br \/>\n\u6d88\u606f\u4e22\u5931\u7684\u62a5\u9519\u4fe1\u606f\uff1a<br \/>\n\u62a5\u9519\u4fe1\u606f\uff1a\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u6d88\u606f\u4e22\u5931\u53ef\u80fd\u4e0d\u4f1a\u76f4\u63a5\u62a5\u9519\u3002\u4f60\u53ef\u80fd\u4f1a\u6ce8\u610f\u5230\u6d88\u8d39\u8005\u65e0\u6cd5\u8bfb\u53d6\u5230\u9884\u671f\u7684\u6d88\u606f\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u4e3a\u4e86\u907f\u514d\u6d88\u606f\u4e22\u5931\uff0c\u786e\u4fdd\u6d88\u8d39\u8005\u5728\u5904\u7406\u6d88\u606f\u540e\u9002\u65f6\u63d0\u4ea4\u504f\u79fb\u91cf\u3002\u540c\u65f6\uff0c\u4f7f\u7528\u5e42\u7b49\u751f\u4ea7\u8005\u786e\u4fdd\u6d88\u606f\u4e0d\u4f1a\u56e0\u4e3a\u91cd\u8bd5\u800c\u91cd\u590d\u53d1\u9001\uff0c\u8fd8\u53ef\u4ee5\u5728\u6d88\u606f\u5904\u7406\u903b\u8f91\u4e2d\u4f7f\u7528\u4e8b\u52a1\u4ee5\u4fdd\u8bc1\u6d88\u606f\u7684\u6700\u7ec8\u4e00\u81f4\u6027\u3002<\/p>\n<pre><code class=\"language-java\">\/\/ Enable idempotence for the producer\nprops.put(&quot;enable.idempotence&quot;, &quot;true&quot;);\n\/\/ Begin a transaction\nproducer.beginTransaction();\ntry {\n    \/\/ Produce messages within the transaction\n    producer.send(record1);\n    producer.send(record2);\n\n    \/\/ Commit the transaction\n    producer.commitTransaction();\n} catch (ProducerFencedException | OutOfOrderSequenceException | AuthorizationException e) {\n    \/\/ Handle exceptions\n    producer.close();\n} catch (KafkaException e) {\n    \/\/ Abort the transaction and handle the exception\n    producer.abortTransaction();\n}<\/code><\/pre>\n<p>\u5206\u533a\u8d1f\u8f7d\u4e0d\u5747\u8861\u7684\u62a5\u9519\u4fe1\u606f\uff1a<br \/>\n\u62a5\u9519\u4fe1\u606f\uff1aConsumerRebalanceListener.onPartitionsRevoked \u548c ConsumerRebalanceListener.onPartitionsAssigned<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a\u4f60\u53ef\u4ee5\u5b9e\u73b0ConsumerRebalanceListener\u63a5\u53e3\uff0c\u5728\u5176\u4e2d\u5904\u7406\u5206\u533a\u91cd\u65b0\u5206\u914d\u7684\u60c5\u51b5\uff0c\u786e\u4fdd\u6d88\u8d39\u8005\u5728\u5206\u533a\u91cd\u65b0\u5206\u914d\u65f6\u53ef\u4ee5\u6b63\u786e\u5730\u5904\u7406\u504f\u79fb\u91cf\u7b49\u4fe1\u606f\u3002<\/p>\n<pre><code class=\"language-java\">class MyConsumerRebalanceListener implements ConsumerRebalanceListener {\n    @Override\n    public void onPartitionsRevoked(Collection&lt;TopicPartition&gt; partitions) {\n        \/\/ Commit offsets for the revoked partitions before rebalance\n        consumer.commitSync(offsetsToCommit);\n    }\n    @Override\n    public void onPartitionsAssigned(Collection&lt;TopicPartition&gt; partitions) {\n        \/\/ Read and process messages from the assigned partitions\n    }\n}\n\/\/ Subscribe with the listener\nconsumer.subscribe(Collections.singletonList(topic), new MyConsumerRebalanceListener());<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 Apache Kafka\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u6d41\u5904\u7406\u5e73\u53f0\uff0c\u4e3b\u8981\u7528\u4e8e\u6784\u5efa\u5b9e\u65f6\u6570\u636e\u6d41\u5e94\u7528\u548c\u6570\u636e\u7ba1\u9053\u3002\u5b83\u7684\u5e95\u5c42\u5b9e\u73b0\u6d89\u53ca\u591a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false},"categories":[1],"tags":[],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug<\/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:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00 Apache Kafka\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u6d41\u5904\u7406\u5e73\u53f0\uff0c\u4e3b\u8981\u7528\u4e8e\u6784\u5efa\u5b9e\u65f6\u6570\u636e\u6d41\u5e94\u7528\u548c\u6570\u636e\u7ba1\u9053\u3002\u5b83\u7684\u5e95\u5c42\u5b9e\u73b0\u6d89\u53ca\u591a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/\" \/>\n<meta property=\"og:site_name\" content=\"\u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-17T01:55:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-17T02:01:36+00:00\" \/>\n<meta name=\"author\" content=\"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/\",\"url\":\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/\",\"name\":\"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug\",\"isPartOf\":{\"@id\":\"https:\/\/zhaocunwei.co.uk\/#website\"},\"datePublished\":\"2023-08-17T01:55:36+00:00\",\"dateModified\":\"2023-08-17T02:01:36+00:00\",\"author\":{\"@id\":\"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/dfb1dc0fc4a330c41908d477cd99c0b4\"},\"breadcrumb\":{\"@id\":\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/zhaocunwei.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zhaocunwei.co.uk\/#website\",\"url\":\"https:\/\/zhaocunwei.co.uk\/\",\"name\":\"\u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug\",\"description\":\"This site shares programming bugs\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zhaocunwei.co.uk\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/dfb1dc0fc4a330c41908d477cd99c0b4\",\"name\":\"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4226cc1ca6640507df1d2d4ba3da7a62?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4226cc1ca6640507df1d2d4ba3da7a62?s=96&d=mm&r=g\",\"caption\":\"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46\"},\"sameAs\":[\"http:\/\/zhaocunwei.co.uk\"],\"url\":\"https:\/\/zhaocunwei.co.uk\/index.php\/author\/18500103508163-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug","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:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/","og_locale":"zh_CN","og_type":"article","og_title":"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug","og_description":"\u524d\u8a00 Apache Kafka\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u6d41\u5904\u7406\u5e73\u53f0\uff0c\u4e3b\u8981\u7528\u4e8e\u6784\u5efa\u5b9e\u65f6\u6570\u636e\u6d41\u5e94\u7528\u548c\u6570\u636e\u7ba1\u9053\u3002\u5b83\u7684\u5e95\u5c42\u5b9e\u73b0\u6d89\u53ca\u591a [&hellip;]","og_url":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/","og_site_name":"\u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug","article_published_time":"2023-08-17T01:55:36+00:00","article_modified_time":"2023-08-17T02:01:36+00:00","author":"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/","url":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/","name":"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0 - \u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug","isPartOf":{"@id":"https:\/\/zhaocunwei.co.uk\/#website"},"datePublished":"2023-08-17T01:55:36+00:00","dateModified":"2023-08-17T02:01:36+00:00","author":{"@id":"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/dfb1dc0fc4a330c41908d477cd99c0b4"},"breadcrumb":{"@id":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/zhaocunwei.co.uk\/index.php\/2023\/08\/17\/kafka-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/zhaocunwei.co.uk\/"},{"@type":"ListItem","position":2,"name":"kafka\u5e95\u5c42\u5b9e\u73b0\uff0c\u65e5\u5fd7\u5b58\u50a8\u673a\u5236\u3001\u504f\u79fb\u91cf\u3001\u4e3b\u9898\u8ba2\u9605\u548c\u6545\u969c\u53d1\u73b0"}]},{"@type":"WebSite","@id":"https:\/\/zhaocunwei.co.uk\/#website","url":"https:\/\/zhaocunwei.co.uk\/","name":"\u672c\u7f51\u7ad9\u5206\u4eab\u7f16\u7a0b\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684bug","description":"This site shares programming bugs","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zhaocunwei.co.uk\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":"Person","@id":"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/dfb1dc0fc4a330c41908d477cd99c0b4","name":"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/zhaocunwei.co.uk\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4226cc1ca6640507df1d2d4ba3da7a62?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4226cc1ca6640507df1d2d4ba3da7a62?s=96&d=mm&r=g","caption":"\u603b\u662f\u5e78\u798f\u7684\u8001\u8c4c\u8c46"},"sameAs":["http:\/\/zhaocunwei.co.uk"],"url":"https:\/\/zhaocunwei.co.uk\/index.php\/author\/18500103508163-com\/"}]}},"_links":{"self":[{"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/786"}],"collection":[{"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":1,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":787,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/786\/revisions\/787"}],"wp:attachment":[{"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhaocunwei.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}