kfaka windows安装

1 官网下载 解压到D:\developTools\kfaka\kafka_2.10-0.9.0.0

2 windows cmd启动

新开cmd命令:cd /d D:\developTools\kfaka\kafka_2.10-0.9.0.0\bin\windows

      cd /d  D:\developTools\kfaka\kafka_2.10-0.8.2.1\bin\windows

      zookeeper-server-start.bat ..\..\config\zookeeper.properties
新开cmd命令:cd /d D:\developTools\kfaka\kafka_2.10-0.9.0.0\bin\windows

    cd /d  D:\developTools\kfaka\kafka_2.10-0.8.2.1\bin\windows

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

3 下载源代码 建maven工程 引入 对应pom文件

把examples下demo运行即可

 

public Producer(String topic, Boolean isAsync)
  {
    Properties props = new Properties();
    props.put("bootstrap.servers", "localhost:9092;localhost:9093");
//    props.put("metadata.broker.list", "localhost:9092;localhost:9093");
    props.put("client.id", "DemoProducer");
    props.put("key.serializer", "org.apache.kafka.common.serialization.IntegerSerializer");
    props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
    producer = new KafkaProducer<Integer, String>(props);
    this.topic = topic;
    this.isAsync = isAsync;
  }

 

4 伪分布式:拷贝server.properties,新建副本 server-1.properties,然后cmd启动 kafka-server-start.bat ..\..\config\server-1.properties

broker.id=1  不能超过reserved.broker.max.id:1000

broker.id=1

############################# Socket Server Settings #############################

listeners=PLAINTEXT://:9093

# The port the socket server listens on
port=1
# A comma seperated list of directories under which to store log files
log.dirs=/tmp/kafka-logs-1

 5 常用命令 http://blog.csdn.net/laputa73/article/details/48826167

新建topic kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 2 --topic zhumltopic

查看所有topic kafka-topics.bat  --list --zookeeper localhost:2181

查看指定topic   kafka-topics.bat --describe --zookeeper localhost:2181 --topic zhumltopic

删除指定topic kafka-topics.bat --delete --zookeeper localhost:2181 --topic zhumltopic 只是标记删除,不是真正删除

解决方法:server.properties 中添加 delete.topic.enable=true

问题见:http://stackoverflow.com/questions/23976670/when-how-does-a-topic-marked-for-deletion-get-finally-removed

 

转载于:https://my.oschina.net/sbcagf/blog/782862

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值