gpt4 book ai didi

jhipster - 微服务始终连接到 localhost 以获取 consul

转载 作者:行者123 更新时间:2023-12-04 02:03:44 25 4
gpt4 key购买 nike

我已经使用 jhipster 4.6.2 生成了一个为 consul 配置的微服务。我正在使用 Docker(使用 Virtualbox)运行 Consul。

因此,它不在本地主机上运行(但例如使用 192.168.99.100)。

因此我修改了我的微服务的 application-dev.yml 以像这样设置主机:

云:领事:发现:首选 IP 地址:true主机:192.168.99.100端口:8500

...但是当我启动微服务时,它仍在尝试连接到本地主机(即不考虑下面的属性)。然后我得到了这个异常:

com.ecwid.consul.transport.TransportException:org.apache.http.conn.HttpHostConnectException:连接到 localhost:8500 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1]失败的:连接被拒绝

有什么想法吗?

谢谢!

我的配置jhipster:

{
"generator-jhipster": {
"promptValues": {
"packageName": "org.fge.msconsul"
},
"jhipsterVersion": "4.6.2",
"baseName": "msconsul",
"packageName": "org.fge.msconsul",
"packageFolder": "org/fge/msconsul",
"serverPort": "8082",
"authenticationType": "jwt",
"hibernateCache": "hazelcast",
"clusteredHttpSession": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "consul",
"buildTool": "maven",
"enableSocialSignIn": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"enableTranslation": false,
"applicationType": "microservice",
"testFrameworks": [],
"jhiPrefix": "jhi",
"skipClient": true,
"skipUserManagement": true,
"clientPackageManager": "yarn"
}
}
</details>

##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

##### **Environment and Tools**

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

git version 2.11.0 (Apple Git-81)

node: v7.4.0

npm: 5.0.3

bower: 1.8.0

gulp:
[22:45:50] CLI version 3.9.1

yeoman: 2.0.0

yarn: 0.27.5

Docker version 17.05.0-ce, build 89658be

docker-compose version 1.13.0, build 1719ceb

Execution complete

最佳答案

Spring Cloud 有一个 bootstrap phase它可以从中加载来自外部源的配置属性。

src/main/resources/bootstrap*.yml 是您必须配置如何连接到 Consul 的文件。

关于jhipster - 微服务始终连接到 localhost 以获取 consul,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45361047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com