• 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

  • 相关阅读:
    接口测试总结
    在 github 上获取源码
    推荐一个css帮助手册的版本 同时提供chm和在线
    由csdn开源项目评选中闹出刷票问题想到投票程序的设计
    由一个园友因为上传漏洞导致网站被攻破而得到的教训
    让 SVN (TortoiseSVN)提交时忽略bin和obj目录
    未能进入中断模式,原因如下:源文件“XXXXXX”不属于正在调试的项目。
    未能加载文件或程序集“XXXXX”或它的某一个依赖项。试图加载格式不正确的程序。
    .Net AppDomain.CurrentDomain.AppendPrivatePath(@"Libs");
    C# Remoting的一个简单例子
  • 原文地址:https://www.cnblogs.com/clds/p/5021974.html
Copyright © 2020-2023  润新知