Eureka Server

application.ymlhtml

server:
  port: 8888
eureka:
  instance:
    hostname: localhost
  client:
    service-url:
          defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
    register-with-eureka: false #值爲false意味着自身僅做爲服務器,不做爲客戶端
    fetch-registry: false #值爲false意味着無需註冊自身
  server:
    enable-self-preservation: false

 

application.propertiesgit

server.port: 8761
eureka.instance.hostname: localhost
eureka.client.registerWithEureka: false
eureka.client.fetchRegistry: false
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

 

Applicationgithub

package com.xp.cn;

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

@SpringBootApplication
@EnableEurekaServer
public class EurekaApp {

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

}

 

 

spring boot啓動報錯:No active profile set, falling back to default profiles: default
spring

 

參考文檔:https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance服務器

springCloud:   http://projects.spring.io/spring-cloud/spring-cloud.html#_service_discovery_eureka_clientsapp

相關文章
相關標籤/搜索