Netflix Eureka和本地环境上的2个应用程序实例 [英] Netflix Eureka and 2 instances of application on local environment
问题描述
我开始使用Netflix Eureka并使用其1.1.145( https://github.com/Netflix/eureka/tree/1.1.145 )版本.
I'm getting started with Netflix Eureka and using its 1.1.145 (https://github.com/Netflix/eureka/tree/1.1.145) version.
我想在不同的端口上本地启动同一应用程序的2个实例,并将它们都注册到Eureka. 我正在使用示例服务(
I want to start locally 2 instances of the same application on different ports and have them both registered with Eureka. I'm using sample service (https://github.com/Netflix/eureka/blob/1.1.145/eureka-server/conf/sampleservice/sample-eureka-service.properties)
因此,我使用上述配置启动Eureka本身和2个实例-8001端口上的一个应用程序,以及8002端口上的另一个应用程序.
So I start Eureka itself and 2 instances using above config - one app on 8001 port and another on 8002.
由于某种原因,我在任何给定时间都只向Eureka注册一个实例.他们俩都毫无例外地开始了,可以和尤里卡(Eureka)交谈. 当我启动第二个实例时,似乎只是用自己的信息覆盖了有关第一个实例的信息.
For some reason I'm getting only one instance registered with Eureka at any given time. Both of them start without exceptions and can talk to Eureka OK. When I start a second instance, it seems to simply overwrite info about 1st instance with its own info.
我想要的是在 http://localhost的同一逻辑eureka.name下具有2个"instance"元素/eureka/v2/apps
我想念什么?
推荐答案
默认实例ID是主机名,因此要在同一主机上运行两个实例,您需要手动设置eureka.instance.metadataMap.instanceId
(在还是要使用Spring Cloud应用程序.)
The default instance ID is the host name, so to run two of anything on the same host you need to manually set the eureka.instance.metadataMap.instanceId
(that works in a Spring Cloud app anyway).
这篇关于Netflix Eureka和本地环境上的2个应用程序实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!