$ cd/opt/cloudera/parcels/kafka-2.1.1-1.2.1.1.p0.18 $ bin/kafka-topics--create--zookeeper localhost:2181- Replication-factor 1--partitions 1--topic test
Analysis: Although Kafka's Open API does not establish a topic approach, experiments have shown that a corresponding topic is automatically created when producer sends a new topic message to broker. However, the automatically established topic uses the default configuration and manually modifies the configuration if necessary.
Send data to Kafka
$ bin/kafka-console-producer--broker-list xxx.xxx.xxx.xxx:9092--topic test
(Messages in the red box need to be entered manually) Analysis: Kafka data interaction with producer and consumer by default via port 9092. When used formally, this step is replaced by a producer-side script.
Analysis: Successfully read the data in test. When used formally, this step is replaced by a consumer-side script.
Problem Summary:
Don't use localhost!!!.
Problem reappearance: Start with the official document guidelines, use the command to build a test producer
$ bin/kafka-console-producer.sh--broker-list localhost:9092--topic test
The
result appears as an issue in the previous illustration: Org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 Ms. for this question to make a guess: that the problem is zookeeper for a certain IP restrictions on the above, in other words, the official documents in the demo should be in a stand-alone environment, at this time zookeeper and Kafka on the same machine, Zookeeper has permission to update metadata on the machine localhost, and in the use of multi-node clusters, zookeeper disables the corresponding permissions of localhost in order to prevent deviations from transmission. to verify the above conjecture, you need to test in a stand-alone environment, there is no time to do. Let's talk about it. (╯_╰) ╭ Workaround: Switch to a specific IP, it is so simple, but the problem has been looking for a long time, a little way all wood. Summary: Don't use localhost!! It is necessary to familiarize yourself with the principles of zookeeper.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.