我是 Eureka 的新手,我从 Eureka 服务器的主页(localhost:8761 /)看到此信息。我没有从官方文档中找到有关“续订”和“续订阈值”的任何解释。谁能解释一下这几个字吗?谢谢!
我在配置尤里卡副本时遇到问题:
尤里卡服务:
@EnableEurekaServer
@SpringBootApplication
public class DiscoveryService {
public static void main(String[] args) {
SpringApplication.run(DiscoveryService.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
bootstrap.properties
spring.application.name=discovery
spring.cloud.config.uri=http://localhost:8888
Run Code Online (Sandbox Code Playgroud)
我还有两个 yml 文件
对于在 8761 上运行的服务器 1
eureka.client.serviceUrl.defaultZone:http://localhost:8762/eureka/
eureka.client.registerWithEureka:false
eureka.client.fetchRegistry:false
Run Code Online (Sandbox Code Playgroud)
对于在 8762 上运行的服务器 2
eureka.client.serviceUrl.defaultZone:http://localhost:8761/eureka/
eureka.client.registerWithEureka:false
eureka.client.fetchRegistry:false
Run Code Online (Sandbox Code Playgroud)
我可以输入两个仪表板,但我看到两个实例都有:
registered-replicas http://localhost:8761/eureka/
unavailable-replicas http://localhost:8761/eureka/,
available-replicas
Run Code Online (Sandbox Code Playgroud)
这是为什么 ?
我读过这样的文章:API 网关和边缘服务有什么区别?,但仍然不清楚服务发现(比如 Eureka)和服务网关(Zuul)之间的确切区别是什么?任何指针?
我想使用 IP 地址而不是主机名在 Eureka 中注册我的微服务。
我尝试了prefer-ip-address和eureka.instance.preferIpAddress=true属性。这些都不适合我。
这是我的尤里卡服务应用程序 .yml 文件。
这是我的授权服务器微服务 application.yml
但 eureka 控制台仍然显示我使用主机名(localhost)而不是 IP 地址注册的服务
我正在使用 Spring boot 2.2.2 版本和 Spring cloud Hoxton.RELEASE。我猜测这些属性无法正常工作。
有人遇到同样的问题吗?
我正在使用带有 Spring Boot 的 Eureka 服务器。错误:
org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'logging.level.com.netflix.eureka' to org.springframework.boot.logging.LogLevel
Run Code Online (Sandbox Code Playgroud)
pom.xml
应用程序属性
spring.application.name=eureka-server
server.port=8761
# avoid registering itself as a client
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
logging.level.com.netflix.eureka=ON
logging.level.com.netflix.discovery=ON
Run Code Online (Sandbox Code Playgroud) 我想将 Eureka 客户端与spring-cloud-starter-loadbalancer. 但是当我添加配置时出现错误。当我删除@LoadBalancerClient(name = "mail-service", configuration = LoadBalancerConfiguration.class)和LoadBalancerConfiguration类配置时,它工作正常。我尝试了这段代码:
@FeignClient(name = "mail-service")
@LoadBalancerClient(name = "mail-service", configuration = LoadBalancerConfiguration.class)
public interface EmailClient {
@RequestMapping(method = RequestMethod.POST, value = "/engine/emails/register")
void setUserRegistration(CreateUserDTO createUserDTO);
}
@Configuration
public class LoadBalancerConfiguration {
@Bean
public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier(ConfigurableApplicationContext context) {
return ServiceInstanceListSupplier.builder()
.withBlockingDiscoveryClient()
.withSameInstancePreference()
.withHealthChecks()
.build(context);
}
}
Run Code Online (Sandbox Code Playgroud)
应用程序.yml:
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: basic
eureka:
client:
serviceUrl:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
fetchRegistry: true
healthcheck:
enabled: true
instance:
preferIpAddress: …Run Code Online (Sandbox Code Playgroud) spring spring-cloud netflix-eureka spring-cloud-loadbalancer
我有一个Spring Boot应用程序(最近为它启用了HTTPS +自签名证书),该应用程序已在Eureka中注册,并在Eureka仪表板中可见。
我们有一个Zuul Filter层,它可以获取用户请求,然后将其传递给Spring Boot应用程序。在通过HTTP访问该应用程序之前,此方法一直工作良好。但是,一旦启用HTTPS,zuul路由就会失败。
这是我的yaml文件中的Zuul路由配置。我的Zuul Route配置是否应该对启用HTTPS的URL / App进行任何特殊配置?
zuul:
routes:
ms:
path: /app/**
stripPrefix: true
ms:
ribbon:
ServerListRefreshInterval: 1000
ConnectTimeout: 20000
ReadTimeout: 20000
Run Code Online (Sandbox Code Playgroud)
这是异常堆栈跟踪(显示Zuul正在尝试路由到HTTP URL而不是HTTPS url)
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: msRibbonCommand failed and no fallback available.
at com.netflix.hystrix.AbstractCommand$20.call(AbstractCommand.java:816) ~[hystrix-core-1.4.0-RC6.jar:na]
at com.netflix.hystrix.AbstractCommand$20.call(AbstractCommand.java:798) ~[hystrix-core-1.4.0-RC6.jar:na]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:76) ~[rxjava-core-0.20.7.jar:na]
at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-core-0.20.7.jar:na]
at rx.internal.operators.OperatorDoOnEach$1.onError(OperatorDoOnEach.java:70) ~[rxjava-core-0.20.7.jar:na]
at rx.Observable$ThrowObservable$1.call(Observable.java:10493) ~[rxjava-core-0.20.7.jar:na]
at rx.Observable$ThrowObservable$1.call(Observable.java:10483) ~[rxjava-core-0.20.7.jar:na]
at rx.Observable.unsafeSubscribe(Observable.java:8591) ~[rxjava-core-0.20.7.jar:na]
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:77) ~[rxjava-core-0.20.7.jar:na]
at rx.internal.operators.OperatorMap$1.onError(OperatorMap.java:48) ~[rxjava-core-0.20.7.jar:na]
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:318) ~[hystrix-core-1.4.0-RC6.jar:na]
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:310) ~[hystrix-core-1.4.0-RC6.jar:na]
at rx.Observable$2.call(Observable.java:173) ~[rxjava-core-0.20.7.jar:na]
at rx.Observable$2.call(Observable.java:166) ~[rxjava-core-0.20.7.jar:na] …Run Code Online (Sandbox Code Playgroud) 我一直在玩一个Spring Cloud应用程序,它包含一个配置服务器,一个发现服务器(Eureka)和一个带有Ribbon的Feign客户端(由Feign内部使用).我有2个服务,a movie-service和a daily-update-service.目的是在一个地方提供热门电影,新闻和天气的每日更新.我遇到的问题是movie-serviceFeign客户端无法找到它daily-update-service.它出错了以下内容:
Caused by: java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
daily_update_service_1 | at org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:59) ~[spring-cloud-netflix-core-1.1.0.M4.jar:1.1.0.M4]
daily_update_service_1 | at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:95) ~[feign-core-8.12.1.jar:8.12.1]
daily_update_service_1 | at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:74) ~[feign-core-8.12.1.jar:8.12.1]
daily_update_service_1 | at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:54) ~[feign-hystrix-8.12.1.jar:8.12.1]
daily_update_service_1 | at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294) ~[hystrix-core-1.4.21.jar:1.4.21]
daily_update_service_1 | ... 21 common frames omitted
daily_update_service_1 | Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: movie-service
daily_update_service_1 | at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:468) ~[ribbon-loadbalancer-2.1.0.jar:2.1.0]
daily_update_service_1 | at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) …Run Code Online (Sandbox Code Playgroud) 我有一个Eureka服务器,我想在其中注册一个非常基本的SpringBoot服务.不幸的是,虽然我试图遵循我能找到的所有文章,但服务并没有注册.
此外,当我检查DiscoveryClient的描述(获得自动装配)时,我看到"Spring Cloud No-op DiscoveryClient",它建议(根据NoopDiscoveryClient.java源)找不到Eureka客户端库.
我在pom
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-client</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
如果我是对的,应该确保适当的netflix库到位.@EnableEurekaClient注释存在.启动客户端时控制台上没有错误,Eureka Server控制台日志中没有任何有趣内容.
这是application.yml的配置:
eureka:
client:
serviceUrl:
defaultZone: ${vcap.services.eureka-service.credentials.uri:http://127.0.0.1:8761}/eureka/
Run Code Online (Sandbox Code Playgroud)
任何建议真的很受欢迎,因为我的想法已经用尽了:)
在Spring-Tools-suite(Eclipse的定制版本)中,有一个选项可以为同一应用程序定义多个运行配置,然后运行它们。
例如,在测试Eureka Server并使用不同的端口和名称定义运行同一应用程序的多个实例以检查注册时。
有谁知道使用Spring和Java Extensions和Visual Studio Code定义类似运行配置的方法吗?
netflix-eureka ×10
spring-boot ×5
spring-cloud ×4
java ×3
spring ×3
netflix-zuul ×2
docker ×1
maven ×1
netflix ×1