• springcloud12---sidecar


    Sidecar:异构平台整合。做了一个桥

    package com.itmuch.cloud;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.sidecar.EnableSidecar;
    
    @SpringBootApplication
    @EnableSidecar
    public class SidecarApplication {
      public static void main(String[] args) {
        SpringApplication.run(SidecarApplication.class, args);
      }
    }
    spring:
      application:
        name: microservice-sidecar
    server:
      port: 8070
    eureka: #加入到eureka
      client:
        service-url:
          defaultZone: http://user:password123@localhost:8761/eureka
      instance:
        prefer-ip-address: true
    sidecar:
      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的首页。
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <parent>
            <groupId>com.itmuch.cloud</groupId>
            <artifactId>microservice-spring-cloud</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </parent>
    
        <artifactId>microservice-sidecar</artifactId>
        <packaging>jar</packaging>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-netflix-sidecar</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-eureka</artifactId>
            </dependency>
        </dependencies>
    
    </project>
  • 相关阅读:
    爬虫 比较好的视频推荐
    Scrapy爬取某装修网站部分装修效果图
    scrapy爬取阳光电影网全站资源
    爬虫练手实例
    Scrapy框架详解
    淘宝商品信息定向爬虫实例介绍
    Python基础第20天
    Python基础第19天
    Python基础第18天
    Python基础第17天
  • 原文地址:https://www.cnblogs.com/yaowen/p/9159022.html
Copyright © 2020-2023  润新知