zoukankan      html  css  js  c++  java
  • Zookeeper+Kafka集群测试

    创建topic:

    [root@zookeep-kafka-node1 bin]# ./kafka-topics.sh --create --zookeeper 10.23.209.70:2181,10.23.209.71:2181,10.23.209.72:2181 --replication-factor 3 --partitions 3 --topic test
    Created topic test.

    显示topic:

    [root@zookeep-kafka-node1 bin]# ./kafka-topics.sh --describe --zookeeper 10.23.209.70:2181,10.23.209.71:2181,10.23.209.72:2181 --topic test
    Topic:test      PartitionCount:3        ReplicationFactor:3     Configs:
            Topic: test     Partition: 0    Leader: 70      Replicas: 70,72,71      Isr: 70,72,71
            Topic: test     Partition: 1    Leader: 71      Replicas: 71,70,72      Isr: 71,70,72
            Topic: test     Partition: 2    Leader: 72      Replicas: 72,71,70      Isr: 72

    列出topic:

    [root@zookeep-kafka-node1 bin]# ./kafka-topics.sh --list --zookeeper 10.23.209.70:2181,10.23.209.71:2181,10.23.209.72:2181
    test

     创建生产者

    [root@zookeep-kafka-node1 bin]# ./kafka-console-producer.sh --broker-list 10.23.209.70:9092 -topic test
    >hello
    >1
    >2
    >3

    创建消费者

    [root@zookeep-kafka-node2 bin]# ./kafka-console-consumer.sh  --bootstrap-server 10.23.209.71:9092 -topic test
    hello
    1
    2
    3

     删除topic

    [root@zookeep-kafka-node1 bin]# ./kafka-topics.sh --delete --zookeeper  10.23.209.70:2181,10.23.209.71:2181,10.23.209.72:2181 --topic test

     查看消费组

    [root@zookeep-kafka-node1 kafka_2.12-2.3.0]# bin/kafka-consumer-groups.sh --all-groups --bootstrap-server 10.23.209.71:9092  --list
    console-consumer-96253
    console-consumer-86669

    查看组信息

    [root@zookeep-kafka-node1 kafka_2.12-2.3.0]# bin/kafka-consumer-groups.sh --bootstrap-server 10.23.209.71:9092 --group console-consumer-86669 --describe
    
    GROUP                  TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                     HOST            CLIENT-ID
    console-consumer-86669 test            0          51              51              0               consumer-1-636102e9-321f-4537-ac28-7a341a77c10f /10.23.209.72   consumer-1
    console-consumer-86669 test            1          51              51              0               consumer-1-636102e9-321f-4537-ac28-7a341a77c10f /10.23.209.72   consumer-1
    console-consumer-86669 test            2          51              51              0               consumer-1-636102e9-321f-4537-ac28-7a341a77c10f /10.23.209.72   consumer-1
  • 相关阅读:
    Java数据类型转换(自动转换和强制转换)
    Java数据类型以及变量的定义
    Java8新特性_日期时间新类 LocalDate、LocalTime、LocalDateTime
    Java8新特性_接口中的默认方法
    java8 新特性 Optional容器类
    Java8新特性 并行流与串行流 Fork Join
    Java8新特性_stream API 练习
    IDEA导入JUnit4
    Reduce:规约;Collector:收集、判断性终止函数、组函数、分组、分区
    【Linux】排序命令sort
  • 原文地址:https://www.cnblogs.com/caonw/p/11897960.html
Copyright © 2011-2022 走看看