kafka踩坑纪实

kafka踩坑纪实

1.Caused by: org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.

先telnet kafka的broker的ip kafka的broker的port 排除是不是网络问题
排除网络问题后:检查一下pom依赖的kafka版本

示例:

telnet 192.168.153.168 9092

pom示例:

		<dependency> 
		  <groupId>org.springframework.kafkagroupId>  
		  <artifactId>spring-kafkaartifactId>  
		  <exclusions> 
		    <exclusion> 
		      <groupId>org.apache.kafkagroupId>  
		      <artifactId>kafka-clientsartifactId> 
		    exclusion> 
		  exclusions> 
		dependency>
		<dependency> 
		  <groupId>org.apache.kafkagroupId>  
		    
		  <artifactId>kafka_2.11artifactId>  
		  <version>${kafka_2.11.version}version>  
		   
		dependency>
2.Caused by: org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for topicName-0: 30027 ms has passed since batch creation plus linger time

检查 kafka配置文件 server.properties的配置,一般都是没配advertised.listeners
配一下advertised.listeners=PLAINTEXT://kafka的ip:kafka的端口

示例:

advertised.listeners=PLAINTEXT://192.168.153.168:9092

附kafka学习相关网站:

kafka监控 https://www.kafka-eagle.org/
kafka教程 https://www.orchome.com/kafka/index

你可能感兴趣的:(kafka,java)