zoukankan      html  css  js  c++  java
  • springcloud:eureka集群配置

    服务器1:

    application.yml配置文件:

     server:
      port: 8777


    eureka:
      instance:
        hostname: EurekaServer8777
      client:
        register-with-eureka: false
        fetch-registry: false
        service-url:
          defaultZone: http://EurekaServer8888.com:8888/eureka/

    依赖文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <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">
        <parent>
            <artifactId>microservice_cloud_01</artifactId>
            <groupId>com.offcn</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>microservice_cloud_05_privider_eureka01_8777</artifactId>

        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-server -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
                <version>2.1.0.RELEASE</version>
            </dependency>
        </dependencies>

    </project>

    启动类:

    package com.offcn;


    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

    @SpringBootApplication
    @EnableEurekaServer
    public class AppStarts {

        public static void main(String[] args) {
            SpringApplication.run(AppStarts.class,args);
        }
    }

    服务器二:

    application.yml配置文件:

     server:
      port: 8777


    eureka:
      instance:
        hostname: EurekaServer8888
      client:
        register-with-eureka: false
        fetch-registry: false
        service-url: 
          defaultZone: http://EurekaServer8777.com:8777/eureka/

    依赖文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <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">
        <parent>
            <artifactId>microservice_cloud_01</artifactId>
            <groupId>com.offcn</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>microservice_cloud_06_privider_eureka01_8888</artifactId>

        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-server -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
                <version>2.1.0.RELEASE</version>
            </dependency>
        </dependencies>

    </project>

    启动类:

    package com.offcn;


    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

    @SpringBootApplication
    @EnableEurekaServer
    public class AppStart {

        public static void main(String[] args) {
            SpringApplication.run(AppStart.class,args);
        }
    }

  • 相关阅读:
    设计模式总结
    字符编码小结
    搞定java.io
    将代码托管到GitHub上
    linuxlinux 路由表设置 之 route 指令详解 路由表设置 之 route 指令详解
    linux子系统的初始化_subsys_initcall()
    Linux系统目录结构介绍
    EtherType :以太网类型字段及值
    socket编程原理
    linux下的网络接口和网络桥接
  • 原文地址:https://www.cnblogs.com/wycBolg/p/11816937.html
Copyright © 2011-2022 走看看