当前位置:首页 > 开发 > 开源软件 > 正文

kafka集群配置-windows版

发表于: 2014-12-15   作者:byx5185   来源:转载   浏览:
摘要: 下载kafka二进制包kafka_2.10-0.8.1.1.tgz,解压 1.拷贝conf/server.properties为 第一个节点server-9093.properties,修改如下内容: broker.id=9093 port=9093 host.name=127.0.0.1 log.dirs=/tmp/kafka-logs-9093 zookeeper.con
下载kafka二进制包kafka_2.10-0.8.1.1.tgz,解压


1.拷贝conf/server.properties为
第一个节点server-9093.properties,修改如下内容:
broker.id=9093
port=9093
host.name=127.0.0.1
log.dirs=/tmp/kafka-logs-9093
zookeeper.connect=localhost:2181

第二个节点server-9094.properties,修改如下内容:
broker.id=9094
port=9094
host.name=127.0.0.1
log.dirs=/tmp/kafka-logs-9094
zookeeper.connect=localhost:2181

2.拷贝bin/windows/*.bat 到bin

3.修改kafka-run-class.bat

set ivyPath=%USERPROFILE%\.ivy2\cache

set snappy=%ivyPath%/org.xerial.snappy/snappy-java/bundles/snappy-java-1.0.5.jar
     call :concat %snappy%

set library=%ivyPath%/org.scala-lang/scala-library/jars/scala-library-2.8.0.jar
     call :concat %library%

set compiler=%ivyPath%/org.scala-lang/scala-compiler/jars/scala-compiler-2.8.0.jar
     call :concat %compiler%

set log4j=%ivyPath%/log4j/log4j/jars/log4j-1.2.15.jar
     call :concat %log4j%

set slf=%ivyPath%/org.slf4j/slf4j-api/jars/slf4j-api-1.6.4.jar
     call :concat %slf%

set zookeeper=%ivyPath%/org.apache.zookeeper/zookeeper/jars/zookeeper-3.3.4.jar
     call :concat %zookeeper%

set jopt=%ivyPath%/net.sf.jopt-simple/jopt-simple/jars/jopt-simple-3.2.jar
     call :concat %jopt%

for %%i in (%BASE_DIR%\core\target\scala-2.8.0\*.jar) do (
     call :concat %%i
)

for %%i in (%BASE_DIR%\core\lib\*.jar) do (
     call :concat %%i
)

for %%i in (%BASE_DIR%\perf\target\scala-2.8.0/kafka*.jar) do (
     call :concat %%i
)

替换为:


for %%i in (%BASE_DIR%\libs\*.jar) do (
     call :concat %%i
)


4.修改kafka_2.10-0.8.1.1\config\log4j.properties
kafka.logs.dir=/logs

5.启动脚本
第一个节点:
set JMX_PORT=19093
cd kafka_2.10-0.8.1.1\bin
kafka-server-start.bat  ..\config\server-9093.properties

第二个节点:
set JMX_PORT=19094
cd kafka_2.10-0.8.1.1\bin
kafka-server-start.bat  ..\config\server-9094.properties

6.创建topic批处理脚本bin\kafka-topics.bat
kafka-run-class.bat  kafka.admin.TopicCommand  %*

7.创建topic
cd kafka_2.10-0.8.1.1\bin
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 2 --partitions 3 --topic my-replicated-topic

8.查看topic描述信息
cd kafka_2.10-0.8.1.1\bin
kafka-topics.bat --describe --zookeeper localhost:2181 --topic my-replicated-topic

9.生产topic消息
cd kafka_2.10-0.8.1.1\bin
kafka-console-producer.bat --broker-list localhost:9093 --topic my-replicated-topic

10.消费topic消息
cd kafka_2.10-0.8.1.1\bin
kafka-console-consumer.bat --zookeeper localhost:2181 --from-beginning --topic my-replicated-topic

kafka集群配置-windows版

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号