Blog.csdn.net/csdn_wangqi…

The use of Kafka message queues has been mixed.

Count the holes you’ve stepped in.

1, it is best not to use Windows server to do, of course, like I was forced to use, on the scalp.

Windows server setup Kafka has few precedents. Second, stability, which I personally feel is far worse than Linux or Mac. On Windows, after Kafka is stopped, the log needs to be deleted at startup. Otherwise, an error is reported that the log is being accessed by another process. Mac running did not find the same error.

2, Kafka topic names, do not use “.” or underscore “_”. Personally tested, the underline will have a pit. Not perusing the underlying code, but actually running the discovery

For example, the channel names test_a and test. If test_A is used to detect the test channel, the consumer cannot receive the message. If test_A is used to detect the test channel, the consumer can receive the message. Although I did not go into the root cause, I suggest you directly use the English topic name, save trouble. Do not create topics with the same letters but different case.

3. Topics about removing Kafka, especially under Windows, are likely to be cumbersome. Simply executing delete Topic does not work. You also need to delete it from ZooKeeper.

/bin/kafka-topics –delete –zookeeper [zookeeper server] –topic [topic name] \

Perform zookeeper/bin/zkCli. CMD

Enter the command ls /brokers/topics\

You’ll see the topic list \

Then type: RMR /brokers/topics/ [topic name] (replace topic to be deleted) \

4. You can consider using a database to record messages. This way, even if the message queue fails, there is a record. Kafka messages can add keys, adding unique keys. Easy to query records. Of course, as needed, this article is for discussion only.

\