我正在尝试向Eureka注册我的Java服务 - 没有运气。我有一个使用Spark-Java框架的现有代码库,因此'只添加两行Spring注释,瞧!不幸的是,这些例子对我没有帮助。如何配置Eureka客户端和服务属性?
我读了Eureka Configuration文档,创建灵光一现,conf目录下,并把下面两个文件尤里卡-conf的:
- eureka-client.properties
- eureka-service.properties
我添加了eureka_conf路径到我的$ CLASSPATH变量与export CLASSPATH=.:${CLASSPATH}:${EUREKA_CONF}/eureka-client.properties:${EUREKA_CONF}/eureka-service.properties
我复制粘贴的内容属性文件从here。所以,他们是这样的:
#eureka-client.properties
eureka.registration.enabled=false
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:8080/eureka/v2/
eureka.decoderName=JacksonJson
#eureka-service.properties
eureka.region=us-west-1
eureka.name=qb-acm
eureka.vipAddress=mysampleservice.mydomain.net
eureka.port=8001
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:8080/eureka/v2/
你可以看到,我改变了eureka.name和eureka.region在日志中查看是否被发现或没有的属性。他们没有被发现。
当我开始我的服务,我看到com.netflix.discovery.internal.util.Archaius1Utils
抛出以下警告:
Cannot find the properties specified : eureka-client. This may be okay if there are other environment specific properties or the configuration is installed with a different mechanism.
其次是这样的:INFO com.netflix.discovery.DiscoveryClient - Initializing Eureka in region us-east-1
。
我创建了一个示例尤里卡服务器和客户端(与Spring)只是为了做一个例子,并注册了Spring客户端。现在,我试图让我的非Spring Java服务注册到本地的Eureka服务器。我的最终目标是将此服务设置为注册并将心跳发送到位于Pivotal上的远程Eureka服务器。
我在做什么错误设置属性:
其他错误可能是有用的读者:
[main] ERROR com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver - Cannot resolve to any endpoints from provided configuration: {defaultZone=[]} [main] ERROR com.netflix.discovery.shared.transport.EurekaHttpClients - Initial resolution of Eureka server endpoints failed. Check ConfigClusterResolver logs for more info
所以,我的问题是?
我在很多例子中看到他们有一个
application.yml
或manifest.yml
文件。在Eureka配置中,.yaml文件 是什么?它是 文件的替代品吗?
编辑:我发现this answer解释了yaml文件。 Application.yml被Spring引导使用,Manifest.yml被云代工CLI使用。
- 什么应该是我的本地环境和Pivotal上的eureka.vipAddress?
**编辑:我发现,与试验和错误,在本地这设置为http://localhost:yourport和PCF它应该是应用程序名称。 localhost
和service-name
都不对应于物理网络接口。哦,我终于知道虚拟ip是什么**
让我知道是否需要更多信息。预先感谢您的帮助。