发现Eureka Server搭建(Service Discovery: Eureka Server)

官方文档:http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#spring-cloud-eureka-server

   第一步:创建项目
     第二步: 启动类添加注解 @EnableEurekaServer

@SpringBootApplication
@EnableEurekaServer
public class Application {

    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class).web(true).run(args);
    }

}

     第三步:增加配置application.yml

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    #声明自己是个服务端
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

       第四步:访问注册中心页面

    http://localhost:8761/

猜你喜欢

转载自www.cnblogs.com/big-cut-cat/p/9877773.html