我正在尝试使用基于DNS的EIP配置在aws上设置eureka集群,如https://github.com/Netflix/eureka/wiki/Configuring-Eureka-in-AWS-Cloud所述
一切似乎都有效,但尤里卡仪表板坚持认为尤里卡实例不可用.我现在想知道这是否只是一个问题(我想是这样)或者我是否遗漏了什么.
据我了解仪表板中的"不可复制副本"逻辑,这是因为eureka正在比较注册主机名和副本主机名.实例在发现客户端注册其内部VPC ip,但在查找副本对等时使用他们的EIP(奇怪的是,在eureka日志中我可以看到内部他们也在使用内部VPC ip).
问题是:这只是一些我不应该担心的化妆品问题,还是因为一些配置错误而等待介入的更大问题?如果它只是一个ui的东西:我能以某种方式"修复"吗?
编辑:
也许相关https://github.com/spring-cloud/spring-cloud-netflix/issues/102#issuecomment-74446709
我有一个本地eureka服务器和一个客户端
尤里卡:
server:
port: 1111
eureka:
instance:
prefer-ip-address: true
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://127.0.0.1:1111/eureka/
server:
waitTimeInMsWhenSyncEmpty: 0
Run Code Online (Sandbox Code Playgroud)
客户:
eureka:
instance:
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://127.0.0.1:1111/eureka/
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
1)Eureka服务器抛出日志:
NullPointerException:at com.netflix.eureka.resources.StatusResource.isReplicaAvailable
2)客户端与Eureka连接,但过了一段时间我在他的日志中看到了下一个:
RedirectingEurekaHttpClient:请求执行错误javax.ws.rs.WebApplicationException:null at com.netflix.discovery.provider.DiscoveryJerseyProvider.readFrom(DiscoveryJerseyProvider.java:110)
RetryableEurekaHttpClient:请求执行失败DiscoveryClient:DiscoveryClient_MW/192.168.0.100:client:8080 - 无法发送心跳!
com.netflix.discovery.shared.transport.TransportException:无法在任何已知服务器上执行请求
在日志Eureka我看到:
InstanceRegistry:DS:注册表:租约不存在,注册资源:CLIENT - 192.168.0.100:client:8080 InstanceResource:Not Found(续订):CLIENT - 192.168.0.100:client:8080
在Eureka Web控制台中,客户端具有UP状态,但也有一个很大的铭文:
续约比阈值更重要.自保护模式已关闭.在网络/其他问题的情况下,可能无法保护实例过期
虽然连接正常,但我可以通过Eureka链接到我的客户端.
你能解释它的含义以及如何摆脱它吗?
我有一台在本地机器上运行的Eureka服务器.Eureka客户已在此服务器上注册.我可以查看eureka仪表板以查看已注册的实例.
我可以在服务器端有一个事件监听器,它会在注册或取消实例时被触发吗?
我查看了源代码并发现eureka从spring发出以下3个事件 ApplicationContext
EurekaInstanceRenewedEventEurekaInstanceRegisteredEventEurekaInstanceCancelledEvent其中只有EurekaInstanceRenewedEvent当服务器收到心跳时才会触发工作和监听器.当从eureka注册或取消新实例时,我无法收听其他事件.
任何帮助将不胜感激.
events spring spring-cloud netflix-eureka spring-cloud-netflix
我是微服务(使用 Spring Boot)的新手。复制生产代码并尝试在我的本地运行。为了成功运行代码我应该做什么?有config服务器、eureka服务器、tomcat服务器、zuul路由工具、ribbon负载均衡器、feign客户端等等。运行应用程序需要哪些必要步骤?配置服务器运行正常,但尤里卡服务器显示问题:
2017-05-02 16:30:01.193 WARN 4860 --- [freshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failure
2017-05-02 16:30:01.195 ERROR 4860 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_EUREKA-SERVER/LT-BSSYFY1.XXXXXXX.in:eureka-server:8002 - was unable to refresh its cache! status = Cannot execute request on any known server
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:111) ~[eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) ~[eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) ~[eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1013) [eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:927) [eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.DiscoveryClient.refreshRegistry(DiscoveryClient.java:1451) [eureka-client-1.4.4.jar:1.4.4]
at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1418) [eureka-client-1.4.4.jar:1.4.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121] …Run Code Online (Sandbox Code Playgroud) 我有2个使用Netflix eureka构建的微服务.他们使用假装客户进行沟通.在我的本地环境中假装客户端工作没有任何问题.但是在Predix(云代工厂)环境中,他们无法沟通.假设客户端总是给出连接超时错误.由于发现feign客户端尝试使用实例ip地址连接(我认为feign客户端使用内部ip地址).有没有办法解决这个问题,可能是启用容器通信或使用公共uri
编辑:我设法通过更改主机名如下所示获取公共网址.
eureka:
instance:
hostname: ${vcap.application.uris[0]}
Run Code Online (Sandbox Code Playgroud)
但在eureka服务器中它注册为$ {vcap.application.uris [0]}:[随机端口](如xxxxxx.run.aws-usw02-pr.ice.predix.io:61142/yyy)有没有办法删除该随机端口.
service-discovery cloud-foundry netflix-feign netflix-eureka predix
我正在编写spring boot应用程序,它使用spring 配置,部署在关键的云代工厂上,并由Netflix Eureka作为发现服务/负载均衡器公开。
我创建了一个 bean,如下所示:
@Component
@ConfigurationProperties("config")
@RefreshScope
@Data
public class GeneralProperties {
private boolean ignoreEvent;
}
Run Code Online (Sandbox Code Playgroud)
/refresh在更改配置存储库中的实际属性后调用 Eureka 公开的应用程序路由时,@refreshScope注释的值已更改(以响应状态结束该字段),这意味着它正常工作。
当在云上运行同一应用程序的多个实例并调用/refresh.
beeing 使用的路由是 Eureka 公开的路由,它使用它的负载均衡器将调用路由到可用实例之一。
这会导致意想不到的结果,即并非所有实例都使用属性的最新更改进行更新。
任何建议如何将更改应用于所有实例?
我正在尝试使用 spring-cloud (Finchley.SR1) 的 spring-boot (2.0.5) 并尝试使用 Eureka 作为发现服务器和 Feign/Ribbon 作为客户端来设置两个服务之间的通信。设置非常简单(尽管我尝试过的各种事情和其他答案有点混乱):
Eureka 的应用程序.yml
spring:
application:
name: eureka-service
server:
port: 8761
eureka:
instance:
hostname: localhost
preferIpAddress: true
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka
Run Code Online (Sandbox Code Playgroud)
第二个服务的 bootstrap.yml
spring:
application:
name: secondservice
eureka:
instance:
hostname: ${spring.application.name}
preferIpAddress: true
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
statusPageUrlPath: ${server.servlet.context-path}/actuator/info
healthCheckUrlPath: ${server.servlet.context-path}/actuator/health
leaseRenewalIntervalInSeconds: 15
leaseExpirationDurationInSeconds: 45
metadata-map:
server.servlet.context-path: ${server.servlet.context-path}
client:
enabled: true
serviceUrl:
defaultZone: http://localhost:8761/eureka
Run Code Online (Sandbox Code Playgroud)
我的测试/模板服务的 bootstrap.yml
spring:
application:
name: templateservice
eureka:
instance:
hostname: ${spring.application.name}
preferIpAddress: true
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}} …Run Code Online (Sandbox Code Playgroud) spring spring-boot netflix-eureka spring-cloud-feign netflix-ribbon
在server-side负载平衡中,客户端调用中间服务器,然后决定调用实际服务器(或微服务)的哪个实例。
在client-side负载均衡中,客户端也会调用一个中间服务器(例如,API 网关——Zuul例如,配置了一个负载均衡器——Ribbon例如和一个命名服务器—— Eureka),然后它决定调用微服务的哪个实例。
除非我们将 API 网关作为客户端的一部分,否则客户端仍然不知道它应该将请求发送到的确切服务器的 IP 地址。在我看来,很像服务器端负载平衡。有什么我想念的吗?
(包括 API 网关作为客户端的一部分似乎很奇怪,因为它通常部署在与客户端不同的服务器上)
spring spring-boot microservices netflix-eureka spring-cloud-netflix
我正在尝试使用 eureka 和 zuul 进行微服务。并且所有请求都存在问题,耗时超过 1 秒。据我了解,1 秒是默认的 hystrix 超时,为了在 Zuul 中配置超时,我必须配置这些属性:
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
ribbon.ConnectTimeout
ribbon.ReadTimeout
但是当我设置它们时,Intelije Idea 中的每一个都有“无法解析配置属性......”警告。而且,它们似乎没有被应用,也不起作用。
spring-boot hystrix netflix-eureka netflix-zuul netflix-ribbon
当我尝试pom.xml在标题中安装 maven 依赖项时,我正在按照教程学习带有 Spring Boot 的 eureka 服务器/客户端
这是我的 pom.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.nlimits</groupId>
<artifactId>movie_info_service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>movie_info_service</name>
<description>Movie Info Service</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题,为什么会发生?
netflix-eureka ×10
spring ×5
spring-boot ×5
java ×3
spring-cloud ×3
events ×1
hystrix ×1
netflix-zuul ×1
predix ×1