Eureka Server按配置文件的多个实例

时间:2018-11-28 06:13:25

标签: java spring spring-boot java-ee spring-cloud

我创建了一个eureka命名服务器。我在其中创建了2个配置文件。并将这两个配置文件彼此注册。

我的Application.yml如下-


尤里卡:   实例:     主机名:localhost   客户:     registerWithEureka:是     fetchRegistry:true     serviceUrl:       defaultZone:http:// $ {eureka.instance.hostname}:$ {server.port} / eureka /


春天:   个人资料:eureka-host1 服务器:   端口:8761 尤里卡:   实例:     主机名:eureka-host1   客户:     serviceUrl:       defaultZone:http://eureka-host2:8762/eureka/


春天:   个人资料:eureka-host2 服务器:   端口:8762 尤里卡:   实例:     主机名:eureka-host2   客户:     serviceUrl:       defaultZone:http://eureka-host1:8761/eureka/


运行两个配置文件后,如果我按下http://localhost:8761/http://localhost:8762/,则可以看到Spring Eureka Server的两个页面。但是没有实例注册。但是,如果我按下http://eureka-host1:8761/http://eureka-host2:8762/,则会看到“无法访问此网站”

一段时间后,我在Spring-Eureka-Server中收到以下消息-----

“紧急情况!如果不是的话,EUREKA可能会错误地要求提供实例。续订的门槛要小得多,因此不必再保证实例的安全。”

请帮助-----

我的POM如下-----

http://maven.apache.org/xsd/maven-4.0.0.xsd“>     4.0.0

<groupId>com</groupId>
<artifactId>service-discovery-high-availability</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>rsmortgage-service-discovery-ha-latest</name>
<description>Spring Starter Project for Service Discovery for High Availability</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Dalston.SR1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案