SpringCloud (nine): sidecar heterogeneous microService

0, understanding

By sidecar heterogeneous platform micro-service registration to Eureka; ecological space and let SpringCloud connected together;

1,

pom.xml`

<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-netflix-sidecar</artifactId>
</dependency>
复制代码

application.yml

spring:
  application:
    name: microservice-sidecar
server:
  port: 8070
eureka: 
  client: 
    service-url:
      defaultZone: http://localhost:8761/eureka
  instance:
    prefer-ip-address: true
sidecar:
  port: 8060
  health-uri: http://localhost:8060/health.json
   
复制代码

Start class SidecarApplication.java

@SpringBootApplication
//注册Sidecar;@EnableSidecar是一个组合注解
@EnableSidecar
public class SidecarApplication {
	public static void main(String[] args) {
		System.out.println("Hello Zuul!");
		SpringApplication.run(SidecarApplication.class, args);
	}
}
复制代码

note

  • 1, when the micro-heterogeneous services and eureka not run on the same hostname, we need to configure ${eureka.instance.hostName}
  • 2, each micro-heterogeneous service node requires a sidecar, when you need a lot of heterogeneous micro service, very trouble; and sidecar no effect on the business itself, just do a 'summary'.

Reproduced in: https: //juejin.im/post/5cfdcdf251882510715e2d18

Guess you like

Origin blog.csdn.net/weixin_34204057/article/details/93184009