Sidecar:异构平台整合。做了一个桥
package com.itmuch.cloud;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.sidecar.EnableSidecar;@SpringBootApplication@EnableSidecarpublic class SidecarApplication { public static void main(String[] args) { SpringApplication.run(SidecarApplication.class, args); }}
spring: application: name: microservice-sidecarserver: port: 8070eureka: #加入到eureka client: service-url: defaultZone: http://user:password123@localhost:8761/eureka instance: prefer-ip-address: truesidecar: port: 8060 #异构微服务的端口,nodejs服务的端口 healthUri: http://localhost:8060/aaa.json #nodejs的直接访问方式#通过zuul访问sidecar进而访问nodejs的aaa.json接口:http://localhost:8040/microservice-sidecar/aaa.json#通过zuul访问sidecar进而访问nodejs的首页: http://localhost:8040/microservice-sidecar#user和movie微服务之间的调用用http://microservice-sidecar/aaa.json就不用通过zuul了#zuul查看eureka的代理节点http://localhost:8040/routes : {"/user-path/**":"microservice-provider-user","/microservice-sidecar/**":"microservice-sidecar"}#sidecar的health:http://localhost:8070/health#sidecar和异构的应用要配置到同一个host上面去,不在同一个host就要配置eureka.instance.hostName,十个微服务是异构的就要10个sidecar。也可以通过别的方式注册异构系统。#http://localhost:8070/是sidecar的首页。
4.0.0 com.itmuch.cloud microservice-spring-cloud 0.0.1-SNAPSHOT microservice-sidecar jar UTF-8 org.springframework.cloud spring-cloud-netflix-sidecar org.springframework.cloud spring-cloud-starter-eureka