kafka 集群搭建

kafka集群

  1. >sa1,sa2,sa3

配置文件信息

  1. broker.id=0
  2. listeners=PLAINTEXT://192.168.0.130:9092
  3. log.dirs=/home/centos01/kafka/logs
  4. zookeeper.connect=sa0:2181,sa1:2181,sa2:2181

启动过程:

  1. kafka-server-start.sh -daemon server.properties

查看主题

  1. kafka-topics.sh --zookeeper sa0:2181 --list

创建主题

  1. kafka-topics.sh --create --zookeeper sa0:2181 --replication-factor 2 --partitions 3 --topic test

生产者

  1. kafka-console-producer.sh --broker-list sa0:9092 --topic test

消费者

  1. kafka-console-consumer.sh --zookeeper sa0:2181 --from-beginning --topic test

查看topic描述信息

  1. kafka-topics.sh --zookeeper node1:2181 --topic topic1 --describe

遇到的问题

  1. Service has only 0 Kafka Broker roles running instead of minimum required 1.