小编sli*_*ery的帖子

Eureka服务器的问题

我有一个本地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)Eu​​reka服务器抛出日志:

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链接到我的客户端.

你能解释它的含义以及如何摆脱它吗?

java spring spring-cloud netflix-eureka

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

执行应用程序时未使用application.yml中的spring.cloud.config设置

我对Spring Cloud有问题:执行应用程序时未使用我在spring.cloud.config的application.yml中的设置。让我在这里详细说明。我希望我的服务可以从远程ConfigServer获取设置。我已将ConfigServer创建为带有@EnableConfigServer批注的春季启动应用程序。之后,我用下一个配置文件创建了客户端应用程序:

    application:
      name: mw
    cloud:
      config:
        enabled: true
        uri: http://172.17.42.1:8888
        fail-fast: true
Run Code Online (Sandbox Code Playgroud)

主类:

    @EnableEurekaClient
    @SpringBootApplication
    public class MwApplication
Run Code Online (Sandbox Code Playgroud)

并在应用程序中进行额外配置:

    @Configuration
    @EnableJpaRepositories(basePackages = {"com.sample.repository"})
    @EnableTransactionManagement
    @EnableScheduling
    public class AppConfiguration
Run Code Online (Sandbox Code Playgroud)

我还有下一个依赖项:

    spring-cloud-starter-eureka
    spring-cloud-config-client
    spring-boot-configuration-processor
    spring-boot-starter-data-jpa
Run Code Online (Sandbox Code Playgroud)

当我执行我的客户端应用程序时,我收到以下消息:ConfigServicePropertySourceLocator:无法找到PropertySource:GET请求“ http:// localhost:8888 / mw / default ” 上的I / O错误

该应用程序尝试从默认uri(localhost)获取数据,而不是从我的设置中使用uri。我已经在调试模式下查看了应用程序,看到org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration正在使用默认属性创建ConfigClientProperties,并且未使用来自application.yml的设置。

我究竟做错了什么?谢谢。

java spring spring-boot microservices spring-cloud

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