Apache Kafka Source project Environment building (IDEA)

Source: Internet
Author: User

1.Gradle InstallationGradle Installation
2. Download Apache Kafka source codeApache Kafka Download
3. Build Ideaproject files with Gradle first install the idea of the Scala plugin, or build will be the active download, because there is no domestic mirror. The speed will be very slow. [email protected]:~/downloads/kafka_2.10-0.8.1$ gradle idea
assumption is Eclipseproject, run: Gradle Eclipsegenerate Ideaproject files such as the following:
4. Project Import into IdeaprojectFile-->open
View source code in 5.IDEA project
when 6.Kafka starts, the number of parameters is setConfigure Server.properties

7.log4j.properties file path settingsstarting Kafka Server is very strange, thelog4j.properties file cannot be found, such as the following error. Log4j:warn No Appenders could is found for logger (kafka.utils.VerifiableProperties).
Log4j:warn Initialize the log4j system properly.
just place the log4j.properties under the Src/main/scala path. Ability to find the file, and then execute the program, correctly output the log information. The output, such as the one seen below,
[2014-05-24 23:45:31,965] Info Verifying properties (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,009] Info Property broker.id is Overridden to 9 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,009] INFO property log.cleaner.enable is Overridden to False (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,009] INFO property log.dirs are overridden to/ Users/lizhitao/kafka-logs (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,009] INFO property Log.retention.check.interval.ms is overridden to 60000 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] Info Property log.retention.hours are overridden to 168 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] Info Property log.segment.bytes are overridden to 536870912 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] INFO Property num.io.threads are overridden to 8 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] INFO property Num.network.threads is overridden to 2 (Kafka.utils.Verifiableproperties) [2014-05-24 23:45:32,010] INFO property Num.partitions was overridden to 2 ( kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] INFO property port was overridden to 9092 ( kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,010] INFO property Socket.receive.buffer.bytes was overridden to 1048576 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,011] INFO property Socket.request.max.bytes is Overridden to 104857600 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,011] INFO property Socket.send.buffer.bytes is overridden to 1048576 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,011] INFO Property zookeeper.connect are overridden to 192.168.2.225:2181,192.168.2.225:2182,192.168.2.225:2183 ( kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,011] INFO property zookeeper.connection.timeout.ms is Overridden to 1000000 (kafka.utils.VerifiableProperties) [2014-05-24 23:45:32,032] INFO [Kafka Server 9], starting (Kafka . server. Kafkaserver) [2014-05-24 23:45: 32,036] INFO [Kafka Server 9], connecting to zookeeper on 192.168.2.225:2181,192.168.2.225:2182,192.168.2.225:2183 ( Kafka.server.KafkaServer) [2014-05-24 23:45:32,045] INFO starting zkclient event thread. (org. I0Itec.zkclient.ZkEventThread) [2014-05-24 23:45:32,370] INFO Client environment:zookeeper.version=3.3.3-1203054, Built on 11/17/2011 05:47 GMT (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client Environment: host.name=192.168.2.104 (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client Environment: Java.version=1.7.0_55 (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client Environment:java.vendor =oracle Corporation (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client environment:java.home=/ LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.7.0_55.JDK/CONTENTS/HOME/JRE (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client environment:java.class.path=/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/ Home/lib/ant-javafx.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/lib/dt.jar:/library/java/ javavirtualmachines/jdk1.7.0_55.jdk/contents/home/lib/javafx-doclet.jar:/library/java/javavirtualmachines/ jdk1.7.0_55.jdk/contents/home/lib/javafx-mx.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/ home/lib/jconsole.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/lib/sa-jdi.jar:/library/ java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/lib/tools.jar:/library/java/javavirtualmachines/ jdk1.7.0_55.jdk/contents/home/jre/lib/charsets.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/ home/jre/lib/deploy.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/ htmlconverter.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/javaws.jar:/library/ java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/jce.jar:/library/java/javavirtualmachines/ jdk1.7.0_55.jdk/contents/home/jre/lib/jfr.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/jfxrt.jar:/library/java/ javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/jsse.jar:/library/java/javavirtualmachines/jdk1.7.0_ 55.jdk/contents/home/jre/lib/management-agent.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/ Home/jre/lib/plugin.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/resources.jar :/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/rt.jar:/library/java/ javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/ext/dnsns.jar:/library/java/javavirtualmachines/ jdk1.7.0_55.jdk/contents/home/jre/lib/ext/localedata.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/ contents/home/jre/lib/ext/sunec.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/ ext/sunjce_provider.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/ext/ Sunpkcs11.jar:/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home/jre/lib/ext/zipfs.jar:/users/lizhitao/mt_wp/open_source/kafka-platform/kafka-0.8.1-src/out/ production/core:/users/lizhitao/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.8.0/ 95bf967bf2e0a26727736228bba3451f4dd3e5b9/scala-library-2.8.0.jar:/users/lizhitao/.gradle/caches/modules-2/ files-2.1/org.apache.zookeeper/zookeeper/3.3.4/6471e17c92181da9e143559c4c4779925a5e6eb0/zookeeper-3.3.4.jar:/ users/lizhitao/.gradle/caches/modules-2/files-2.1/com.101tec/zkclient/0.3/ Dedcf2b53fb742adba7080ac3aed781694ba616e/zkclient-0.3.jar:/users/lizhitao/.gradle/caches/modules-2/files-2.1/ com.yammer.metrics/metrics-core/2.2.0/f82c035cfa786d3cbec362c38c22a5f5b1bc8724/metrics-core-2.2.0.jar:/users/ lizhitao/.gradle/caches/modules-2/files-2.1/com.yammer.metrics/metrics-annotation/2.2.0/ 62962b54c490a95c0bb255fa93b0ddd6cc36dd4b/metrics-annotation-2.2.0.jar:/users/lizhitao/.gradle/caches/modules-2 /files-2.1/net.sf.jopt-simple/jopt-simple/3.2/d625f12ba08083c8c16dcedd5396ec730e9e77ab/jopt-simple-3.2.jar:/users/lizhitao/.gradle/caches/modules-2/files-2.1/org.xerial.snappy/snappy-java/1.0.5/ 10cb4550360a0ec6b80f09a5209d00b6058e82bf/snappy-java-1.0.5.jar:/users/lizhitao/.gradle/caches/modules-2/ Files-2.1/log4j/log4j/1.2.15/f0a0d2e29ed910808c33135a3a5a51bba6358f7b/log4j-1.2.15.jar:/users/lizhitao/.gradle /caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.2/81d61b7f33ebeab314e07de0cc596f8e858d97/ Slf4j-api-1.7.2.jar:/applications/intellij idea 12.app/lib/idea_rt.jar (org.apache.zookeeper.ZooKeeper) [ 2014-05-24 23:45:32,370] INFO Client environment:java.library.path=/users/lizhitao/library/java/extensions:/ Library/java/extensions:/network/library/java/extensions:/system/library/java/extensions:/usr/lib/java:. (Org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client environment:java.io.tmpdir=/var/folders/pn/qjf0v4k52mq965jxjd72hlx00000gp/t/( Org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,370] INFO Client environment:java.compiler=<na> ( Org.apache.zoOkeeper. ZooKeeper) [2014-05-24 23:45:32,370] INFO Client environment:os.name=mac os X (org.apache.zookeeper.ZooKeeper) [ 2014-05-24 23:45:32,370] INFO Client environment:os.arch=x86_64 (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,371] INFO Client environment:os.version=10.9.2 (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,371] Info Client Environment:user.name=lizhitao (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,371] Info Client Environment:user.home=/users/lizhitao (org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,371] INFO Client ENVIRONMENT:USER.DIR=/USERS/LIZHITAO/MT_WP/OPEN_SOURCE/KAFKA-PLATFORM/KAFKA-0.8.1-SRC ( Org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,372] INFO initiating client connection, connectstring= 192.168.2.225:2181,192.168.2.225:2182,192.168.2.225:2183 sessiontimeout=6000 [email protected] ( Org.apache.zookeeper.ZooKeeper) [2014-05-24 23:45:32,387] INFO Opening socket connection to server/192.168.2.225:2181 ( Org.apache.zookeeper.ClienTCNXN) [2014-05-24 23:45:32,393] ERROR Unable to open socket to 192.168.2.225/192.168.2.225:2181 ( ORG.APACHE.ZOOKEEPER.CLIENTCNXN)

The Kafka program can be started correctly after 7 steps, and the relevant debug is carried out. and study its source.
Please specify reproduced from: http://blog.csdn.net/lizhitao/article/details/26874961

Apache Kafka Source project Environment building (IDEA)

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.