老师您好,我用kafka测试代码dropPassTemplate,我分别安装了windows版本的kafka和centos7版本的kafka,用的同样的安装包。 在window版本测试都正常,可以消费到json格式的数据,跟您课程里面效果一样。但是在centos环境下,报了下面这样的错。我把相应的地址设置也都改了。查了百度一圈,试了不同的kafka版本jar包,也还是不行。谢谢老师。
2019-03-10 19:09:56.461 WARN 183484 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Connection to node -1 could not be established. Broker may not be available.
2019-03-10 19:09:57.346 ERROR 183484 --- [ main] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='merchants-template' and payload='{"background":2,"desc":"详情: 慕课","end":1553080136400,"hasToken":false,"id":19,"limit":10000,"start":1...' to topic merchants-template:
org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
2019-03-10 19:09:57.348 INFO 183484 --- [ main] c.i.p.service.impl.MerchantsServImpl : DropPassTemplates: {"background":2,"desc":"详情: 慕课","end":1553080136400,"hasToken":false,"id":19,"limit":10000,"start":1551352136398,"summary":"简介: 慕课","title":"慕课-1"}
{"errorCode":0,"errorMsg":""}
2019-03-10 19:09:57.358 INFO 183484 --- [ Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@71a8adcf: startup date [Sun Mar 10 19:08:47 CST 2019]; root of context hierarchy
2019-03-10 19:09:57.360 INFO 183484 --- [ Thread-3] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 2147483547
2019-03-10 19:09:57.360 INFO 183484 --- [ Thread-3] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2019-03-10 19:09:57.362 INFO 183484 --- [ Thread-3] o.a.k.clients.producer.KafkaProducer : [Producer clientId=producer-1] Closing the Kafka producer with timeoutMillis = 30000 ms.
2019-03-10 19:09:57.372 INFO 183484 --- [ Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
Process finished with exit code 0