标签: netflix-eureka

DiscoveryClient_xxx:111-222:8080 - 无法刷新其缓存!状态 = 无法在任何已知服务器上执行请求

DiscoveryClient_xxx:111-222:8080 - 无法刷新其缓存!状态 = 无法在任何已知服务器上执行请求:

我在我的本地主机上运行一个 spring 云应用程序。我用本地主机 eureka 注册。但是我得到了以下输出:

Request execution error
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
at 

017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:937)  - Disable delta property : false
2017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:938)  - Single vip registry refresh property : null
2017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:939)  - Force full registry fetch : false
2017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:940)  - Application is null : false
2017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:941)  - Registered Applications size is zero : true
2017-07-01 13:13:41 [DiscoveryClient-CacheRefreshExecutor-0] (DiscoveryClient.java:943)  - Application version …
Run Code Online (Sandbox Code Playgroud)

netflix-eureka

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

404使用Spring云FeignClients时

这是我的设置:

第一个服务(FlightIntegrationApplication),它使用FeignClients API和Eureka调用第二个服务(BaggageServiceApplication).

github项目:https://github.com/IdanFridman/BootNetflixExample

第一次服务:

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

    public static void main(String[] args) {
        new SpringApplicationBuilder(FlightIntegrationApplication.class).run(args);
    }

}
Run Code Online (Sandbox Code Playgroud)

在其中一个控制器中:

    @RequestMapping("/flights/baggage/list/{id}")
    public String getBaggageListByFlightId(@PathVariable("id") String id) {
        return flightIntegrationService.getBaggageListById(id);
    }
Run Code Online (Sandbox Code Playgroud)

FlightIntegrationService:

    public String getBaggageListById(String id) {
        URI uri = registryService.getServiceUrl("baggage-service", "http://localhost:8081/baggage-service");
        String url = uri.toString() + "/baggage/list/" + id;
        LOG.info("GetBaggageList from URL: {}", url);

        ResponseEntity<String> resultStr = restTemplate.getForEntity(url, String.class);
        LOG.info("GetProduct http-status: {}", resultStr.getStatusCode());
        LOG.info("GetProduct body: {}", resultStr.getBody());
        return resultStr.getBody();

    }
Run Code Online (Sandbox Code Playgroud)

RegistryService:

@Named
public …
Run Code Online (Sandbox Code Playgroud)

spring spring-boot spring-cloud netflix-feign netflix-eureka

9
推荐指数
1
解决办法
7919
查看次数

没有Spring-boot的Eureka服务发现

我写了一个spring boot微服务和一个REST客户端.客户端是另一个模块的一部分,并对微服务进行RESTful调用.微服务向Eureka注册表注册,我希望我的客户端(这不是一个Spring引导项目)使用Eureka来查询和获取服务端点.

我的问题是因为客户端不是Spring-Boot应用程序我不能使用类似的注释@SpringBootApplication,@EnableDiscoveryClient并且DiscoveryClient不会自动连接到应用程序.反正有DiscoveryClient没有使用注释手动将bean 自动连接到客户端?

java spring spring-boot microservices netflix-eureka

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

将 application.yml 文件转换为 application.properties

我的 application.yml 文件如下。如何将其转换为 application.properties 我正在尝试,但如何在同一个文件中写入多个属性。它给了我重复的克里错误。

 ---
  spring:
    profiles: peer1
  eureka:
     instance:
        hostname: peer1
     client:
        serviceUrl:
           defaultZone: http://peer2/eureka/

 ---
 spring:
    profiles: peer2
 eureka:
    instance:
      hostname: peer2
    client:
      serviceUrl:
         defaultZone: http://peer1/eureka/
Run Code Online (Sandbox Code Playgroud)

java spring-boot netflix-eureka application.properties

9
推荐指数
2
解决办法
3万
查看次数

Netflix Zuul/Ribbon/Eureka 对比 AWS ELB/ALB 和 ECS

我从使用 Netflix Zuul 和 Eureka(也可能是 Ribbon)的文档中了解到,您可以构建一个主动负载均衡器。我一直使用 AWS ELB、ALB(用于容器管理的 ECS)和 R53。

除了供应商可移植性之外,使用 Netflix 方法比使用 AWS 提供的 ALB/ELB 有什么优势吗?是否有任何用例必须使用 Netflix OSS 而不是开箱即用的 AWS ELB?

amazon-web-services microservices netflix-eureka netflix-zuul netflix-ribbon

9
推荐指数
1
解决办法
2078
查看次数

引起原因:java.lang.ClassNotFoundException:org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

如何修复这个错误?

就这个:

引起原因:java.lang.ClassNotFoundException:org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata

这是我的 pom.xml 文件

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.5.4</version>
   <relativePath/>
</parent>
<groupId>io.x</groupId>
<artifactId>eureka-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>eureka-server</name>
<description>Eureka server</description>
<properties>
   <java.version>16</java.version></docker.artifact.version>
   <spring-cloud-starter-eureka-server.version>1.4.7.RELEASE</spring-cloud-starter-eureka-server.version>
</properties>
<dependencies>
   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter</artifactId>
   </dependency>

   <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter</artifactId>
   </dependency>

   <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-eureka-server</artifactId>
       <version>${spring-cloud-starter-eureka-server.version}</version>
   </dependency>
</dependencies>
<dependencyManagement>
   <dependencies>
       <dependency>
           <groupId>org.springframework.cloud</groupId>
           <artifactId>spring-cloud-dependencies</artifactId>
           <version>Hoxton.SR12</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
   </dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-cloud netflix-eureka

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

如何解决紧凑映射中不允许嵌套映射的错误

它说紧凑映射中不允许嵌套映射

eureka:
    client:
        register-with-eureka: false
        fetch-registry: false
        
        
server.port: 8796
  
  
spring.application.name: eurekaservice
Run Code Online (Sandbox Code Playgroud)

重写了很多次之后,它不知何故不再显示错误!请有人说一下这是什么原因?

yaml spring-boot microservices netflix-eureka

9
推荐指数
1
解决办法
4万
查看次数

如何在Spring中进行集成测试时模拟Eureka?

我在Spring Boot中运行一个简单的Junit测试控制器.测试代码如下所示:

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {FrontControllerApplication.class})
@WebAppConfiguration
@ComponentScan
@IntegrationTest({"server.port:0", "eureka.client.registerWithEureka:false", "eureka.client.fetchRegistry:false"})
@ActiveProfiles("integrationTest")
public class MyControllerIT {
Run Code Online (Sandbox Code Playgroud)

在application-integrationTest.properties中,我有以下Eureka设置:

####### Eureka
eureka.serviceUrl.default=http://localhost:8767/eureka/
eureka.printDeltaFullDiff=false
eureka.client.refresh.interval=1
eureka.appinfo.replicate.interval=1
eureka.serviceUrlPollIntervalMs=1000
eureka.name=${spring.application.name}

####### Netflix Eureka #######
eureka.client.serviceUrl.defaultZone=http://localhost:8767/eureka/
eureka.client.instanceInfoReplicationIntervalSeconds=1
eureka.client.initialInstanceInfoReplicationIntervalSeconds=0
eureka.instance.virtualHostName=${spring.application.name}
eureka.instance.preferIpAddress=true
eureka.instance.initialStatus=DOWN
eureka.instance.leaseRenewalIntervalInSeconds=3
eureka.instance.leaseExpirationDurationInSeconds=10
eureka.instance.metadataMap.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}}
eureka.eurekaserver.connectionIdleTimeoutInSeconds=5
eureka.responseCacheAutoExpirationInSeconds=5
Run Code Online (Sandbox Code Playgroud)

当junit测试开始时,我看到以下内容:

2015-09-16 16:46:03,905 ERROR localhost-startStop-1 com.netflix.discovery.DiscoveryClient Can't get a response from http://localhost:8767/eureka/apps/ Can't contact any eureka nodes - possibly a security group issue? com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:184) ~[jersey-apache-client4-1.11.jar:1.11]

测试通过,这不是问题,但我看到很多与Eureka有关的异常堆栈跟踪.问题是,是否有办法模拟尤里卡或其他方式在进行测试时跳过它?

如果测试失败并且tst运行得更快,则更容易看到相关的堆栈跟踪

spring spring-test spring-test-mvc netflix-eureka

8
推荐指数
2
解决办法
9385
查看次数

如何使用Spring Cloud和Netflix的Eureka注册节点应用程序

我正在努力注册我的节点应用程序,使用Netflix的Eureka,在谷歌搜索后,我仍在寻找解决方案.我能想到的最大值是我们有Prana但是我遇到的问题仍然在Prana问题列表中(我猜这意味着我的REST模板无法发现这个应用程序).

Sidecar,是另一个建议的解决方案,我没有得到任何回应.除了这两个,我找到了一个节点模块Eureka-Node-client,但它们都没有达到我的目的.

node.js spring-cloud netflix-eureka aws-api-gateway

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

重启客户端之前,docker-compose无法访问Spring Config服务器

我使用Eureka,Config Server和我的客户端进行了“发现优先”设置。

问题在于这3个服务是按顺序启动的,但是客户端服务器似乎注册得太早,并且永远找不到配置服务器。我尝试了一个第三方库,该库允许等到config-server:8888可用时,但这似乎也不总是起作用。这类似于比赛条件。

The workaround is that if I docker restart the client-server after everything is up, it registers and finds config-server just fine.

First run of docker-compose:

Fetching config from server at : http://localhost:8888
Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
Run Code Online (Sandbox Code Playgroud)

When I docker restart the client:

Fetching config from server at : http://a80b001d04a7:8888/
Located environment: name=client-server, profiles=[default], label=null, version=053c8e1b14dc0281d5af0349c9b2cf012c1a346f, state=null
Run Code Online (Sandbox Code Playgroud)

Not sure if my JAVA_OPTS properties aren't being set …

spring docker spring-boot netflix-eureka docker-compose

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