netflix-eureka

How to register eureka-clients with eureka-server on different hosts. Spring-boot

烈酒焚心 提交于 2019-12-05 22:28:37
问题 I'm running my eureka-server on my localhost. I'm able to register all my other on localhost running services and everthing works like expected. Now I want to register a service which is running on a linux machine. My properties looks like that: spring.application.name=myService-service spring.cloud.config.uri=http://myMachine.domain.lan:8888 server.port=8002 eureka.client.service-url.default-zone=http://myMachine.domain.lan:8761/eureka/ But the service is not able to register on eureka

Spring redirect url issue when behind Zuul proxy

烈酒焚心 提交于 2019-12-05 20:27:17
问题 I've been trying to get to the bottom of a strange redirection issue for the past 2 days without success. Based on the spring-cloud example projects, I've configured Eureka, Zuul and a basic service that runs behind Zuul. I have the following method; @RequestMapping(method = RequestMethod.POST, value = "/register") public String registerDevice(Principal principal, String response) { // ... return "redirect:/account"; } The form is setup to post to the proxied URL as follows; POST https:/

Microservices - RestTemplate UnknownHostException

孤街浪徒 提交于 2019-12-05 18:58:06
I have a simple setup with a Eureka service registration server, a service for the public API and a service that gets called from the public API using RestTemplate. Eureka tells me that the services are successfully registered, but when I call the service @Service public class MyServiceService { @Autowired private RestTemplate restTemplate; private final String serviceUrl; public MyServiceService() { this.serviceUrl = "http://MY-SERVICE"; } public Map<String, String> getTest() { Map<String, String> vars = new HashMap<>(); vars.put("id", "1"); restTemplate.setRequestFactory(new

Eureka Server - list all registered instances

三世轮回 提交于 2019-12-05 07:51:37
I have a Spring Boot application that is also a Eureka Server. I want to list all instances that have been registered to this Eureka Server. How do I do it? Fetch the registry using EurekaServerContextHolder.getInstance().getServerContext().getRegistry() then use the registry to list all Applications PeerAwareInstanceRegistry registry = EurekaServerContextHolder.getInstance().getServerContext().getRegistry(); Applications applications = registry.getApplications(); applications.getRegisteredApplications().forEach((registeredApplication) -> { registeredApplication.getInstances().forEach(

Netflix Eureka and 2 instances of application on local environment

倖福魔咒の 提交于 2019-12-05 03:52:54
问题 I'm getting started with Netflix Eureka and using its 1.1.145 (https://github.com/Netflix/eureka/tree/1.1.145) version. I want to start locally 2 instances of the same application on different ports and have them both registered with Eureka. I'm using sample service (https://github.com/Netflix/eureka/blob/1.1.145/eureka-server/conf/sampleservice/sample-eureka-service.properties) So I start Eureka itself and 2 instances using above config - one app on 8001 port and another on 8002. For some

Spring Cloud discovery for multiple service versions

隐身守侯 提交于 2019-12-05 01:58:00
问题 I'm asking myself a question without finding responses for it. Maybe someone here would have ideas about that ;-) Using a services registry (Eureka) in Spring Cloud with RestTemplate and Feign clients, I have different build versions of the same service. The build version being documented through Actuator's /info endpoint. { "build": { "version": "0.0.1-SNAPSHOT", "artifact": "service-a", "name": "service-a", "group": "com.mycompany", "time": 1487253409000 } } ... { "build": { "version": "0.0

Eureka Renews threshold & Renews (last min)

亡梦爱人 提交于 2019-12-04 17:01:33
I have one Eureka Server A and two client instances of B(Client3) and C(Client4) I got logs from Eureka Server, which are as follows : 2018-01-25 12:56:27.828 INFO 7145 --- [nio-8765-exec-2] c.n.e.registry.AbstractInstanceRegistry : Registered instance CLIENT3/client3:bb488bb73fd313321e393915f746bfe5 with status UP (replication=false) 2018-01-25 12:56:28.417 INFO 7145 --- [nio-8765-exec-3] c.n.e.registry.AbstractInstanceRegistry : Registered instance CLIENT3/client3:bb488bb73fd313321e393915f746bfe5 with status UP (replication=true) 2018-01-25 12:56:33.028 INFO 7145 --- [nio-8765-exec-3] c.n.e

Spring Zuul: Dynamically disable a route to a service

北慕城南 提交于 2019-12-04 16:06:04
I'm trying to disable a Zuul route to a microservice registered with Eureka at runtime (I'm using spring boot). This is an example: localhost/hello localhost/world Those two are the registered microservices. I would like to disable the route to one of them at runtime without shutting it down. Is there a way to do this? Thank you, Nano Alternatively to using Cloud Config, custom ZuulFilter can be used. Something like (partial implementation to show the concept): public class BlackListFilter extends ZuulFilter { @Override public String filterType() { return "pre"; } ... @Override public Object

How to write integration tests with spring-cloud-netflix and feign

微笑、不失礼 提交于 2019-12-04 15:47:12
问题 I use Spring-Cloud-Netflix for communication between micro services. Let's say I have two services, Foo and Bar, and Foo consumes one of Bar's REST endpoints. I use an interface annotated with @FeignClient : @FeignClient public interface BarClient { @RequestMapping(value = "/some/url", method = "POST") void bazzle(@RequestBody BazzleRequest); } Then I have a service class SomeService in Foo, which calls the BarClient . @Component public class SomeService { @Autowired BarClient barClient;

Use Eureka despite having random external port of docker containers

无人久伴 提交于 2019-12-04 08:21:12
问题 I am writing an application that is composed of a few spring boot based microservices with a zuul based reverse proxy in the front- It works when I start the services on my machine, but for server rollout I'd like to use docker for the services, but this seems not to be possible right now. Normally you would have a fixed "internal" port and randomized ports at the outside of the container. But the app in the container doesn't know the outside port (and IP). The Netflix tools match what I