Kafka Best Practices under Window

Source: Internet
Author: User
Tags zookeeper

Kafka introduction and Getting started see here Kafka Getting Started: Introduction, usage scenarios, design principles, major configurations and cluster construction (RPM)

The current article from the practice point of view for everyone to circumvent the hole used under window.

1. Requirements:

Java 8

2. Download Kafka "Note, only download Kafka"

Http://mirrors.cnnic.cn/apache/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz

3. Unzip, enter the Kafka_2.11-0.9.0.1\bin\windows directory via cmd

4. Start ZK

Zookeeper-server-start. \.. \config\zookeeper.properties

Test the connection, please.

Zookeeper-shell.bat 0.0.0.0:2181

5. Start Kafka

Kafka-server-start.bat. \.. \config\server.properties

6) Create topic

Kafka-topics.bat--create--zookeeper localhost:2181--replication-factor 1--partitions 3--topic mytopicthe meaning of the parameters can be self-examination, current disregard Created topic "mytopic".7) View Topickafka-topics.bat--describe--zookeeper localhost:2181--topic mytopic ---------------------------------------------------------- Topic:mytopic PartitionCount:3 ReplicationFactor:1 Configs: topic:partition: 0 Span class= "Typ" >leader: 0replicas: 0isr: 0 topic:partition: 1 Span class= "Typ" >leader: 0replicas: 0isr: 0 Topic: mytopic Partition: 2 Leader: 0 Replicas: 0 Isr: 08) Release/Production message window Kafka-console-producer.bat--broker-list localhost:9092--topic mytopic 9) Consumer message window Kafka-console-consumer.bat--zookeeper localhost:2181--from-beginning--topic mytopic 10) in producer producer window input, You can see the output in the consumer window < Span class= "pun" >< Span class= "lit" >b< Span class= "KWD" >in\windows>kafka-< Span class= "PLN" >console -producer.bat --broker-list localhost:9092 --topic mytopic--------------------------------------------------------------------

You're so adamant.
Niaho
Heelo
I'm Chinese.

< Span class= "pun" >< Span class= "lit" >b< Span class= "KWD" >in\windows>kafka-< Span class= "PLN" >console -consumer.bat --zookeeper localhost:2181 --from-beginning --topic mytopic

--------------------------------------------------------------------

You're so adamant.
Niaho
Heelo
I'm Chinese.

--------------------------------------------------------------------

The above information is here: Http://kafka.apache.org/documentation.html#quickstart

OK, it's perfect.

Error: Unrecognized VM option USEG1GC These optimization parameters are actually new, so either use jdk1.7+ or get rid of them.

Workaround: Open Conf\kafka-run-class.bat, find 102 rows, modify the following

IF ["%kafka_jvm_performance_opts%"] EQU [""] (    rem Set kafka_jvm_ Performance_opts=-server-xx:+useg1gc-xx:maxgcpausemillis= -xx:initiatingheapoccupancypercent=  -xx:+disableexplicitgc-djava.awt.headless=true    set kafka_jvm_performance_opts =-server-xx:+disableexplicitgc-djava.awt.headless=true)

Use Java to call Kafka, refer to http://blog.csdn.net/hxpjava1/article/details/19160665.

Kafka integration with spring, reference http://colobu.com/2014/11/19/kafka-spring-integration-in-practice/

Kafka Best Practices under Window

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.