In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
What are the main points used in Kafka and how to solve important errors? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
1, create a topic
Bin/kafka-topics.sh-create-zookeeper localhost:2181-replication-factor 1-partitions 1-topic test
Remember that the number of copies should be less than the total number of Broker.
2 configuration at topic level
Use more topic-level configurations
Bin/kafka-topics.sh-zookeeper localhost:2181-create-topic my-topic-partitions 1
-replication-factor 1-- config max.message.bytes=64000-- config flush.messages=1
Bin/kafka-topics.sh-zookeeper localhost:2181-alter-topic my-topic
-- config max.message.bytes=128000
Bin/kafka-topics.sh-zookeeper localhost:2181-alter-topic my-topic
-- deleteConfig max.message.bytes
3 client of Kafka
Location of non-java client
Https://cwiki.apache.org/confluence/display/KAFKA/Clients
Location of the Java client
Although posting these two original pictures looks stupid, there are indeed beginners who haven't found the location of JAVA API's demo for a week, so Langjian snapped two pictures here in order to save everyone time and improve efficiency.
4, common error handling
Kafka is installed in the virtual machine, and the code written on the windows host cannot produce or consume messages, while the command line client in the virtual machine can. You need to configure broadcast parameters. For the principle, please see the previous articles in the Langjian kafka series.
0.8.2.2 version parameters
# Hostname the broker will advertise to producers and consumers. If not set, it uses the
# value for "host.name" if configured. Otherwise, it will use the value returned from
# java.net.InetAddress.getCanonicalHostName ().
# advertised.host.name=
# The port to publish to ZooKeeper for clients to use. If this is not set
# it will publish the same port that the broker binds to.
# advertised.port=
0.9 + version parameters
# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName () if not configured.
# FORMAT:
# listeners = security_protocol://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
# listeners=PLAINTEXT://:9092
# Hostname and port the broker will advertise to producers and consumers. If not set
# it uses the value for "listeners" if configured. Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName ().
# advertised.listeners=PLAINTEXT://your.host.name:9092
The two instructions to learn to use are telnet (Network Connectivity Test and Port Survivability probe) and ping (Network Connectivity Test).
This is the answer to the question about the main points of use and important error resolution in Kafka. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.