Greenwich.M3版本,下面是针对spring cloud bus导入的maven依赖:
对应于配置中心相关的配置:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
对应的配置端代码:
spring.cloud.bus.enabled=true
spring.kafka.bootstrap-servers=xxx:9092
management.endpoints.web.exposure.include=*
spring.cloud.bus.refresh.enabled=true
16 22:38:48.949 INFO 13948 --- [ main] o.a.kafka.common.utils.AppInfoParser : Kafka version : 2.0.1
2019-03-16 22:38:48.949 INFO 13948 --- [ main] o.a.kafka.common.utils.AppInfoParser : Kafka commitId : fa14705e51bd2ce5
2019-03-16 22:38:50.440 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:51.551 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:52.660 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:53.972 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:55.376 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:57.400 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
2019-03-16 22:38:59.521 WARN 13948 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] Connection to node 1001 could not be established. Broker may not be available.
检查下kafka broker是否异常,进程是否还在。
可以在当前机器下 telnet brokerip 9092 看能否连接上。