Getting started with Kafka-0.10.0.0, kafka0.10
Build an environment (pseudo cluster is acceptable), but note that the configuration of Kafka must be configured, and the same can be used with less configuration, but can only be used on a single machine, external machines cannot be connected, it is also said on the Internet.
Host. name = 192.168.1.30
Advertised. host. name = 192.168.1.30
Interfaceshost. name = 192.168.1.30
0.10.0.0 and 0.9 should lack the log4j dependency and cannot directly use log4j TO kafka. You can rely on the kafka-log4j-appender to use this package, or flume collaboration
<Dependency>
<GroupId> org. apache. kafka </groupId>
<ArtifactId> kafka-log4j-appender </artifactId>
<Version> 0.10.0.0 </version>
</Dependency>
Client command:
Message recipient (all)
Kafka-console-consumer.sh -- zookeeper localhost: 2181 -- topic my-topic -- from-beginning
Producer
Bin/kafka-console-producer.sh -- broker-list localhost: 9092 -- topic my-topic
JAVA production and consumption (in the official example)
Production capital
Consumer
Summary: the service-oriented things can only be said: 1. Learning configuration; 2. Learning how to use and adding the required logic. It is usually black box. To change the underlying layer, you must first encounter a scenario. Easy to use