[英]Eureka is unable to find port when running spring boot on a random port
Following are the dependencies in my local:以下是我本地的依赖项:
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-server-spring-boot-starter</artifactId>
<version>2.13.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
application.properties应用程序属性
grpc.server.port=${PORT:0}
eureka.client.serviceUrl.defaultZone=http://localhost:8791/eureka/
eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}}
bootstrap.properties引导程序属性
spring.application.name=grpc-service
Eureka server is detecting port 8080 instead of the actual port used in the Eureka client. Eureka 服务器正在检测端口 8080,而不是 Eureka 客户端中使用的实际端口。 There are similar issues reported in the past, and it was fixed as per their developers.
过去曾报告过类似的问题,并且已根据其开发人员进行了修复。 Did I miss anything on the above mentioned config?
我错过了上述配置的任何内容吗?
Update更新
I modified my application.properties
file with the below:我用以下内容修改了我的
application.properties
文件:
grpc.server.port=${PORT:0}
server.port=${grpc.server.port}
eureka.client.serviceUrl.defaultZone=http://localhost:8791/eureka/
eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}}
eureka.instance.non-secure-port-enabled=true
eureka.instance.secure-port-enabled=false
eureka.instance.non-secure-port=${server.port}
But now Eureka is not detecting the service at all.但是现在 Eureka 根本没有检测到该服务。
I was able to solve this by making the below changes:我能够通过进行以下更改来解决这个问题:
application.xml应用程序.xml
eureka.instance.non-secure-port-enabled=true
eureka.instance.secure-port-enabled=false
server.port=${grpc.server.port}
eureka.client.serviceUrl.defaultZone=http://localhost:8791/eureka/
eureka.instance.instance-id=${spring.application.name}:${spring.application.instance_id:${random.value}}
eureka.instance.non-secure-port=${grpc.server.port}
grpc.server.port
is passed as runtime
argument. grpc.server.port
作为runtime
参数传递。 After making these changes, Eureka
is now detecting the exact port used in Eureka clients.进行这些更改后,
Eureka
现在正在检测 Eureka 客户端中使用的确切端口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.