标签: netflix-eureka

可以在没有Eureka/Ribbon或其他Netflix OSS模块的情况下使用Hystrix

我们拥有一个拥有自己的API网关,服务发现和负载平衡的基础架构.但是出于弹性目的,我需要使用Hystrix.

  1. 使用spring cloud netflix,可以在没有 Eureka/Ribbon或其他Netflix OSS模块的情况下使用Hystrix(即断路器注释)吗?
  2. 对于断路器仪表板(即涡轮机和流聚合器),是否依赖于Eureka/Ribbon/Zuul?
  3. 可以在非弹簧启动应用中使用断路器注释吗?

netflix turbine hystrix spring-cloud netflix-eureka

6
推荐指数
1
解决办法
1887
查看次数

Feign/Eureka客户端没有通过X-Forwarded-For标头

我使用Spring boot + Eureka + Feign客户端将请求从一个发现的服务器转发到另一个服务器,它工作正常.

在我的服务器中,我需要获取原始用户的IP.

我似乎无法找到如何配置Feign客户端自动编辑'X-Forwarded-For'标头,以便我能够提取原始用户的IP地址.

当我使用getRemoteAddr()时,我得到代理IP地址(正如预期的那样).当试图提取request.getHeader("X-Forwarded-For")时,我总是得到null.

我应该在哪里添加/配置此功能?

http-headers spring-boot netflix-feign netflix-eureka

6
推荐指数
1
解决办法
547
查看次数

Eureka缓慢删除实例

我正和尤里卡做一个POC.当我关闭服务实例时,它目前需要大约3分钟才能在Eureka控制台中显示.我假设(但不自信)这也意味着这个被击落的实例仍然可以被客户发现?

通过调试,我可以看到服务器多次运行evict任务,然后确定我关闭的实例上的租约已过期.

我的设置是客户端:

eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
eureka.instance.statusPageUrlPath=${management.context-path}/info
eureka.instance.healthCheckUrlPath=${management.context-path}/health

eureka.instance.leaseRenewalIntervalInSeconds=5

eureka.client.healthcheck.enabled=true
eureka.client.lease.duration=2
eureka.client.leaseExpirationDurationInSeconds=5

logging.level.com.netflix.eureka=DEBUG
logging.level.com.netflix.discovery=DEBUG
Run Code Online (Sandbox Code Playgroud)

服务器:

server.port=8761

eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

logging.level.com.netflix.eureka=DEBUG
logging.level.com.netflix.discovery=DEBUG

eureka.server.enableSelfPreservation=false
Run Code Online (Sandbox Code Playgroud)

我也在服务器上尝试过这些设置:

eureka.server.response-cache-update-interval-ms: 500
eureka.server.eviction-interval-timer-in-ms: 500
Run Code Online (Sandbox Code Playgroud)

这些似乎增加了检查但不减少服务器识别实例的时间减少.

我错过了一个设置吗?是否有最佳实践来关闭生产中的实例以立即获得此实例?

谢谢!

spring-boot netflix-eureka

6
推荐指数
0
解决办法
2210
查看次数

使用Eureka Server的Spring Boot 1.4.2.RELEASE - 异常:org.springframework.beans.factory.NoSuchBeanDefinitionException

尝试使用Eureka服务器运行Spring Boot 1.4.2.RELEASE时出现以下错误:

2016-11-20 16:25:59.306  INFO 14263 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2177849e: startup date [Sun Nov 20 16:25:59 CET 2016]; root of context hierarchy
2016-11-20 16:25:59.581  INFO 14263 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-11-20 16:25:59.606  INFO 14263 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$fc4b31a3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-cloud netflix-eureka

6
推荐指数
1
解决办法
4322
查看次数

在不使用领事的情况下在码头工具中发现服务

我是docker和微服务的新手.我已经开始将我的网络应用程序分解为微服务,目前,我正在进行手动配置.

经过一番研究,我遇到了docker swarm模式,它允许发现服务.此外,我遇到了其他服务发现工具,如Eureka和Consul.

我的主要目标是将curl调用中的IP地址替换为服务名称和同一服务的多个实例之间的负载平衡.

即对于前者 curl http://192.168.0.11:8080/卷曲http:// my-service

我必须保持我的服务语言独立.

请建议,我是否需要使用Consul与docker swarm进行服务发现,或者我可以在没有Consul的情况下进行此操作?有什么好处?

service-discovery docker consul netflix-eureka docker-swarm

6
推荐指数
1
解决办法
1143
查看次数

在spring boot中找不到DiscoveryClient bean错误

2017-03-16 16:09:08.821  INFO 9104 --- [           main] com.hello.EurekaClientApplication        : No active profile set, falling back to default profiles: default
2017-03-16 16:09:08.848  INFO 9104 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dcd8c7a: startup date [Thu Mar 16 16:09:08 CDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@441772e
2017-03-16 16:09:09.873  INFO 9104 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'hystrixFeature' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixWebConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource …

spring-boot netflix-eureka

6
推荐指数
2
解决办法
8499
查看次数

spring boot 2 + feign + eureka 客户端不会将服务名称解析为 URL

我正在尝试使用 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

6
推荐指数
1
解决办法
7490
查看次数

实践中的客户端负载平衡似乎与服务器端负载平衡几乎相同。是这样吗?

server-side负载平衡中,客户端调用中间服务器,然后决定调用实际服务器(或微服务)的哪个实例。

client-side负载均衡中,客户端也会调用一个中间服务器(例如,API 网关——Zuul例如,配置了一个负载均衡器——Ribbon例如和一个命名服务器—— Eureka),然后它决定调用微服务的哪个实例。

除非我们将 API 网关作为客户端的一部分,否则客户端仍然不知道它应该将请求发送到的确切服务器的 IP 地址。在我看来,很像服务器端负载平衡。有什么我想念的吗?

(包括 API 网关作为客户端的一部分似乎很奇怪,因为它通常部署在与客户端不同的服务器上)

spring spring-boot microservices netflix-eureka spring-cloud-netflix

6
推荐指数
1
解决办法
962
查看次数

com.netflix.zuul.exception.ZuulException:Hystrix 读取超时

我正在尝试使用 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

6
推荐指数
3
解决办法
1万
查看次数

无法解析 org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:unknown

当我尝试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)

我该如何解决这个问题,为什么会发生?

java spring-boot netflix-eureka

6
推荐指数
2
解决办法
1万
查看次数