{"id":158615,"date":"2019-09-29T09:00:27","date_gmt":"2019-09-29T01:00:27","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=158615"},"modified":"2019-10-09T09:35:53","modified_gmt":"2019-10-09T01:35:53","slug":"kafka-rocketmq","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/kafka-rocketmq.html","title":{"rendered":"\u7ec6\u8ff0Kafka\u5206\u533a\u526f\u672c\u4e0eRocketMQ\u961f\u5217\u7684\u533a\u522b"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u6700\u8fd1\u5728\u5b66\u4e60 Kafka\uff0c\u53d1\u73b0\u5176\u6838\u5fc3\u6982\u5ff5\u4e0e RocketMQ \u8fd8\u662f\u5b58\u5728\u4e00\u5b9a\u7684\u5dee\u522b\uff0c\u4e0b\u9762\u6211\u6765\u8bf4\u4e0b Kafka \u5206\u533a \u4e0e RocketMQ\u961f\u5217\u4e4b\u95f4\u7684\u533a\u522b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n RocketMQ \u961f\u5217<\/strong><\/span><\/div>\n RocketMQ \u6bcf\u4e2a\u4e3b\u9898\u90fd\u4f1a\u6709\u82e5\u5e72\u4e2a\u961f\u5217\uff0c\u5206\u5e03\u4e8e\u96c6\u7fa4\u4e2d\u5404\u4e2a broker \u4e0a\uff0c\u5206\u5e03\u89c4\u5f8b\u5982\u4e0b\uff1a \u961f\u5217\u4f1a\u5728 broker \u4e2d\u62bd\u8c61\u6210\u4e00\u4e2a consumer queue\uff0c\u5728\u96c6\u7fa4\u6a21\u5f0f\u4e0b\uff0c\u6bcf\u4e2a\u961f\u5217\u6bcf\u4e2a\u6d88\u8d39\u7ec4\u53ea\u80fd\u5b58\u5728\u4e00\u4e2a\u6d88\u8d39\u8005\u8fdb\u884c\u8ba2\u9605\u6d88\u8d39\uff0c\u4f46\u662f\u4e00\u4e2a\u6d88\u8d39\u8005\u53ef\u4ee5\u6d88\u8d39\u591a\u4e2a\u961f\u5217\uff0c\u8fd9\u4e5f\u4fdd\u8bc1\u4e86\u5728\u96c6\u7fa4\u6a21\u5f0f\u4e0b\u6d88\u606f\u4e0d\u4f1a\u88ab\u91cd\u590d\u6d88\u8d39\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a \u5728RocketMQ\u5f00\u6e90\u7248\u672c\u4e2d\uff0c\u5728\u521b\u5efa\u4e3b\u9898\u65f6\uff0c\u901a\u8fc7\u96c6\u7fa4\u521b\u5efa\u6a21\u5f0f\uff0c\u6307\u5b9a\u4e3b\u9898\u5728\u96c6\u7fa4\u4e2d\u7684\u961f\u5217\u6570\u91cf\uff0c\u6bd4\u5982\u96c6\u7fa4\u4e2d\u6709 2 \u4e2a broker\uff0c\u6211\u4eec\u521b\u5efa\u4e3b\u9898\u65f6\u9009\u62e9\u961f\u5217\u6570\u91cf\u4e3a 4\uff0c\u5c31\u4f1a\u5728\u6bcf\u4e2a broker \u4e2d\u4e3a\u8be5\u4e3b\u9898\u521b\u5efa 4 \u4e2a \u961f\u5217\uff0c\u90a3\u4e48\u8be5\u4e3b\u9898\u5728\u96c6\u7fa4\u4e2d\u5c31\u4f1a\u6709 4 * 2 \u4e2a\u961f\u5217\u6570\u91cf\uff0c\u8fd9\u91cc\u6709\u4e2a\u4e0d\u597d\u7684\u5730\u65b9\u5c31\u662f\u65e0\u6cd5\u7cbe\u786e\u63a7\u5236\u961f\u5217\u6570\u91cf\uff0c\u4f46\u8fd9\u4e2a\u95ee\u9898\u4e0d\u5927\u3002<\/p>\n RocketMQ \u662f\u901a\u8fc7\u4e3b\u4ece\u6a21\u5f0f\u5b9e\u73b0\u6d88\u606f\u7684\u5197\u4f59\uff0c\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u4e5f\u4f1a\u91c7\u53d6\u591a Master \u591a Slave \u6a21\u5f0f\u642d\u5efa\u96c6\u7fa4\uff0c\u4e3b\u4ece\u4e4b\u95f4\u7684\u961f\u5217\u6570\u636e\u540c\u6b65\u6709\u540c\u6b65\u590d\u5236\u548c\u5f02\u6b65\u590d\u5236\u4e24\u79cd\u3002<\/p>\n \u56e0\u6b64\uff0cRocketMQ \u662f\u4f9d\u9760\u961f\u5217\u8fdb\u884c\u6d88\u8d39\u7684\uff0c\u800c\u961f\u5217\u6570\u636e\u901a\u8fc7\u4e3b\u4ece\u540c\u6b65\u5b9e\u73b0\u6d88\u606f\u7684\u5197\u4f59\u3002<\/p>\n Kafka\u5206\u533a\u4e0e\u526f\u672c<\/strong><\/span><\/div>\n Kafka \u7684\u5206\u533a\u6982\u5ff5\u662f\u5176\u6838\u5fc3\u6982\u5ff5\u4e4b\u4e00\uff0c\u5206\u533a\u673a\u5236\u4f7f\u5f97 Kafka \u5177\u5907\u4e86\u6c34\u5e73\u6269\u5c55\u7684\u80fd\u529b\uff0c\u5728\u5176\u5206\u533a\u4e4b\u4e0a\uff0cKafka \u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u5206\u533a\u7684\u526f\u672c\uff0c\u5927\u5927\u63d0\u9ad8\u4e86 Kafka \u6d88\u606f\u7684\u53ef\u9760\u6027\u3002<\/p>\n \u5728 Kafka \u4e2d\uff0c\u4e00\u4e2a\u4e3b\u9898\u5728\u96c6\u7fa4\u4e2d\u4f1a\u62e5\u6709\u4e00\u4e2a\u4ee5\u4e0a\u5206\u533a\uff0c\u6bcf\u4e2a\u5206\u533a\u5728\u6bcf\u4e2a\u6d88\u8d39\u96c6\u7fa4\u4e2d\u53ea\u80fd\u6709\u4e00\u4e2a\u6d88\u8d39\u8005\u8fdb\u884c\u8ba2\u9605\u6d88\u8d39\uff0c\uff0c\u4f46\u662f\u4e00\u4e2a\u6d88\u8d39\u8005\u53ef\u4ee5\u6d88\u8d39\u591a\u4e2a\u961f\u5217\uff0c\u4e0e RocketMQ \u961f\u5217\u4e00\u6837\uff1a \u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u4e3b\u9898\u7684\u5206\u533a\u6570\u91cf\u63d0\u9ad8\u6d88\u606f\u7684\u541e\u5410\u91cf\uff0c\u8fd8\u53ef\u4ee5\u4e3a\u5206\u533a\u8bbe\u7f6e\u526f\u672c\u56e0\u5b50\uff0c\u5373\u8be5\u5206\u533a\u5728\u96c6\u7fa4\u4e2d\u62e5\u6709\u591a\u5c11\u4e2a\u526f\u672c\uff08replica\uff09\uff0c\u526f\u672c\u5206\u4e3a leader replica \u4e0e follower replica\uff0c\u5b83\u4eec\u4e4b\u95f4\u901a\u8fc7 ISR\uff08in-sync replica\uff09\u4e0e leader replica \u4fdd\u6301\u6570\u636e\u540c\u6b65\u3002<\/p>\n \u5728\u521b\u5efa\u4e3b\u9898topic-demo\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u4e3b\u9898\u5728\u96c6\u7fa4\u4e2d\u7684\u5206\u533a\u6570\u91cf\uff0c\u4ee5\u53ca\u526f\u672c\u56e0\u5b50\u5927\u5c0f\uff1a<\/p>\n \r\n--partitions 4 --replication-factor 2\r\n<\/pre>\n |