所以我正在尝试使用提供的docker compose app.yaml来加速我的JHipster堆栈:
version: '2'
services:
y-app:
image: y
environment:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=prod,swagger
- MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true
- SPRING_DATASOURCE_URL=jdbc:mysql://y-mysql:3306/y?useUnicode=true&characterEncoding=utf8&useSSL=false
- JHIPSTER_SLEEP=30 # gives time for other services to boot before the application
- SPRING_DATA_JEST_URI=http://y-elasticsearch:9200
- SPRING_ELASTICSEARCH_REST_URIS=http://y-elasticsearch:9200
- SPRING_KAFKA_CONSUMER_BOOTSTRAP_SERVERS=kafka:9092
- SPRING_KAFKA_PRODUCER_BOOTSTRAP_SERVERS=kafka:9092
ports:
- 8080:8080
y-mysql:
extends:
file: mysql.yml
service: y-mysql
y-elasticsearch:
extends:
file: elasticsearch.yml
service: y-elasticsearch
kafka:
extends:
file: kafka.yml
service: kafka
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
zookeeper:
extends:
file: kafka.yml
service: zookeeper
所以首先我用
构建我的应用 ./gradlew -Pprod bootJar jibDockerBuild
然后运行
docker-compose -f src/main/docker/app.yml up
但是我看到以下kafka错误:
[31mkafka_1 | [0m [2019-07-05 18:46:06,978]]错误[KafkaServer id = 2] KafkaServer启动期间发生致命错误。准备关闭(kafka.server.KafkaServer) [31mkafka_1 | [0m java.lang.IllegalArgumentException:要求失败:代理0已经在通告的侦听器中配置了端点localhost:9092 [31mkafka_1 | [0m at scala.Predef $ .require(Predef.scala:224) [31mkafka_1 | [0m at kafka.server.KafkaServer $$ anonfun $ createBrokerInfo $ 2.apply(KafkaServer.scala:397) [31mkafka_1 | [0m at kafka.server.KafkaServer $$ anonfun $ createBrokerInfo $ 2.apply(KafkaServer.scala:395) [31mkafka_1 | [0m at scala.collection.mutable.ResizableArray $ class.foreach(ResizableArray.scala:59) [31mkafka_1 | [0m at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) [31mkafka_1 | [0m at kafka.server.KafkaServer.createBrokerInfo(KafkaServer.scala:395) [31mkafka_1 | [0m at kafka.server.KafkaServer.startup(KafkaServer.scala:259) [31mkafka_1 | [0m,位于io.confluent.support.metrics.SupportedServerStartable.startup(SupportedServerStartable.java:114) [31mkafka_1 | [0m,位于io.confluent.support.metrics.SupportedKafka.main(SupportedKafka.java:66) [31mkafka_1 | [0m [2019-07-05 18:46:06,992] INFO [KafkaServer id = 2]正在关闭(kafka.server.KafkaServer)。
最后,整个应用程序崩溃:
org.springframework.context.ApplicationContextException:无法启动bean'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry';嵌套的异常是org.apache.kafka.common.errors.TimeoutException:提取主题元数据时,超时已过期。
想知道我做错了什么,还是因为我在MacOS上而需要调整某些东西?