小编Ber*_*art的帖子

为什么ZUUL强制执行SEMAPHORE隔离以执行其Hystrix命令?

我注意到Spring-Cloud ZUUL强制执行隔离到SEMAPHORE而不是THREAD默认值(根据Netflix的推荐).

评论org.springframework.cloud.netflix.zuul.filters.route.RibbonCommand说:

我们希望默认为信号量隔离,因为这包含了另外两个已经线程隔离的命令

但我仍然没有得到它:-(那两个其他命令是什么?

以这种方式配置,Zuul只能调整加载但不允许超时并让客户端离开.简而言之,即使Hystrix超时设置为1000毫秒,只有在转发到链中的服务的调用返回时(或者由于例如ReadTimeout而超时),才会释放客户端.

我试图通过覆盖配置强制THREAD隔离(不幸的是,每个服务,因为在代码中强制默认),一切似乎按预期工作.但是,如果没有正确理解其含义,我并不热衷于这样做 - 当然关于代码中的注释以及Spring的Zuul版本采用的默认值.

有人可以提供更多信息吗?谢谢

spring-cloud netflix-zuul

11
推荐指数
1
解决办法
5916
查看次数

如何添加到Turbine其他Hystrix指标聚合中

我的设置是使用netflix库的spring boot cloud我设法让Turbine从一个服务聚合Hystrix指标.但是,当我添加更多服务时,我无法看到它们.

这是我的设置(也将其上传到github: Project On Github

服务1:

FlightIntegrationService:

@SpringBootApplication
@EnableCircuitBreaker
@EnableDiscoveryClient
@ComponentScan("com.bootnetflix")
public class FlightIntegrationApplication {
..
}

application.yaml

server:
  port: 0

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
  client:
    registryFetchIntervalSeconds: 5

bootstrap.yaml

spring:
  application:
    name: flight-integration-service
Run Code Online (Sandbox Code Playgroud)

服务2:

优惠券服务:

@SpringBootApplication
@EnableCircuitBreaker
@EnableDiscoveryClient
@ComponentScan("com.bootnetflix")
public class CouponServiceApp {
..
}

application yaml:

server:
  port: 0

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${vcap.application.instance_id:${spring.application.name}:${spring.application.instance_id:${random.value}}}
  client:
    registryFetchIntervalSeconds: 5
Run Code Online (Sandbox Code Playgroud)

Eureka应用服务:

@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication  {



Hystrix dashboard service:

    @SpringBootApplication
    @EnableHystrixDashboard
    @Controller
    public class …
Run Code Online (Sandbox Code Playgroud)

netflix turbine spring-boot hystrix spring-cloud

8
推荐指数
1
解决办法
3625
查看次数

在Spring Boot应用程序中使用API​​网关时,HATEOAS路径无效

我有两个Spring启动应用程序,其中一个作为API网关(如本文所讨论的Spring示例).连接到第一个的另一个是使用spring-data-rest(spring-data-neo4j-rest)公开配置文件服务.

第一个应用程序从端口8080开始,并使用zuul将请求路由到第二个,如下所示:

zuul:
  routes:
    profiles:
      path: /profiles/**
      url: http://localhost:8083/profiles/  
Run Code Online (Sandbox Code Playgroud)

这一切都运行良好,并从第二个应用程序提供http:// localhost:8080/profiles的请求.但问题是响应中的HATEOAS链接不正确.调用第二个服务的响应是正确的:

{
    "_links": {
        "self": {
            "href": "http://localhost:8083/profiles{?page,size,sort}",
            "templated": true
        },
        "search": {
            "href": "http://localhost:8083/profiles/search"
        }
    },
    "_embedded": {
        "profiles": [
            {
                "name": "Andrew Rutter",
                "_links": {
                    "self": {
                        "href": "http://localhost:8083/profiles/0"
                    }
                }
            },
            {
                "name": "Andrew Rutter",
                "_links": {
                    "self": {
                        "href": "http://localhost:8083/profiles/1"
                    }
                }
            }
        ]
    },
    "page": {
        "size": 20,
        "totalElements": 2,
        "totalPages": 1,
        "number": 0
    }
}
Run Code Online (Sandbox Code Playgroud)

但当这回到我的API网关时,链接正在被重写

{
  "name": "Andrew Rutter", …
Run Code Online (Sandbox Code Playgroud)

spring spring-data-rest spring-hateoas spring-boot spring-cloud

8
推荐指数
1
解决办法
4396
查看次数

尤里卡-状态和信息网址不遵守$ {management.context-path}

向Eureka Server注册实例时,默认的Eureka实例配置不考虑$ {management.context-path} Spring Boot属性。

请参阅org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean,相应的属性可能应该@Value在其上带有注释。

解决方法是显式设置路径,如下所示:

eureka:
  instance:
    statusPageUrlPath:  ${management.context-path}/info
    healthCheckUrlPath: ${management.context-path}/health
Run Code Online (Sandbox Code Playgroud)

spring-cloud

5
推荐指数
0
解决办法
2482
查看次数

Netflix Eureka和2个本地环境应用实例

我开始使用Netflix Eureka并使用其1.1.145(https://github.com/Netflix/eureka/tree/1.1.145)版本.

我想在不同的端口上本地启动同一应用程序的2个实例,并让它们都注册到Eureka.我正在使用示例服务(https://github.com/Netflix/eureka/blob/1.1.145/eureka-server/conf/sampleservice/sample-eureka-service.properties)

所以我使用上面的配置启动了Eureka本身和2个实例 - 一个应用程序在8001端口上,另一个在8002上.

出于某种原因,我在任何时候都只有一个在Eureka注册的实例.他们两个都没有例外地开始,可以和Eureka OK谈谈.当我启动第二个实例时,它似乎只是用自己的信息覆盖有关第一个实例的信息.

我想要的是在http:// localhost/eureka/v2/apps下的同一个逻辑eureka.name下有2个'instance'元素

我错过了什么?

netflix spring-cloud netflix-eureka

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