zoukankan      html  css  js  c++  java
  • kfaka windows安装

    1 官网下载 解压到D:developToolskfakakafka_2.10-0.9.0.0

    2 windows cmd启动

    新开cmd命令:cd /d D:developToolskfakakafka_2.10-0.9.0.0inwindows

          cd /d  D:developToolskfakakafka_2.10-0.8.2.1inwindows

          zookeeper-server-start.bat ....configzookeeper.properties
    新开cmd命令:cd /d D:developToolskfakakafka_2.10-0.9.0.0inwindows

        cd /d  D:developToolskfakakafka_2.10-0.8.2.1inwindows

        kafka-server-start.bat ....configserver.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 ....configserver-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

  • 相关阅读:
    完美世界经典版本881外挂
    ShowModal 动态创建窗体和释放窗体
    HTML 颜色代码大全
    padding margin border 的四值顺序
    三 C# Socket通信 窗体控件与多线程
    Java解压缩Zip 文件
    八 C# Socket通信 通信协议设计
    CSS+DIV实现鼠标经过背景变色
    七 C# Socket通信 阻塞性线程的快速终止
    二 C# Socket通信模式
  • 原文地址:https://www.cnblogs.com/clds/p/5021974.html
Copyright © 2011-2022 走看看