我开始使用spring cloud。
我使用spring-cloud-gateway、spring-cloud-config、eureka
对于我的spring-cloud服务器,在application.properties中
server.port=8888
spring.security.user.name=admin
spring.security.user.password=123
#for file system
spring.profiles.active=native
spring.cloud.config.server.native.search-locations=file:///home/cloud/config对于我的spring- bootstrap.properties中的云服务器
spring.application.name=gateway-service
spring.profiles.active=local
spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.username=admin
spring.cloud.config.password=123
spring.profiles.active=local用于我在bootstrap.properties中的发现服务(尤里卡)
spring.application.name=discovery-service
server.port=8761
spring.profiles.active=local
spring.application.name=discovery-service
spring.cloud.config.uri=http://localhost:8888
spring.cloud.config.username=admin
spring.cloud.config.password=123在/home/cloud/config中
gateway-service-local.properties
server.port=8889
spring.r2dbc.url=r2dbc:pool:postgresql://localhost:5432/gateway
spring.r2dbc.schema=cloud
spring.r2dbc.username=test
spring.r2dbc.password=test
spring.r2dbc.pool.initial-size=100
spring.r2dbc.pool.max-size=500
spring.r2dbc.pool.max-idle-time=30m
spring.r2dbc.pool.validation-query=SELECT 1logging-service-local.properties
discovery-service-local.properties
eureka.instance.hostname=localhost
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/据我所知,加载bootstrap.properties是为了能够安装应用程序,它从服务器获取配置并在本地替换application.properties,因此没有理由在本地使用application.properties?
如果端口应该在配置服务器中,如果有许多实例,指定的端口会发生什么情况?
发布于 2019-06-27 23:13:43
这真的取决于你。如果您将端口放在配置服务器上,则可以从外部管理该端口,并将优先进行管理。
https://stackoverflow.com/questions/56793951
复制相似问题