• spring cloud中启动Eureka Server的方法


    转自:https://www.jb51.net/article/132895.htm

    本文介绍了spring cloud中启动Eureka Server的方法,分享给大家,具体如下:

    一、新建工程

    二、工程结构

    三、修改配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # eureka.client.registerWithEureka :表示是否将自己注册到Eureka Server,默认为true。由于当前这个应用就是Eureka Server,故而设为false
    # eureka.client.fetchRegistry :表示是否从Eureka Server获取注册信息,默认为true。因为这是一个单点的Eureka Server,不需要同步其他的Eureka Server节点的数据,故而设为false。
    # eureka.client.serviceUrl.defaultZone :设置与Eureka Server交互的地址,查询服务和注册服务都需要依赖这个地址。默认是http://localhost:8761/eureka ;多个地址可使用 , 分隔。
    server:
     port: 8761
    eureka:
     client:
      register-with-eureka: false
      fetch-registry: false
      service-url:
       defaultZone: http://localhost:8761/eureka // Eureka Server注册服务的地址

    四、添加开启Eureka Server注解

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    package com.chhliu.springcloud.eureka;
      
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
      
    @SpringBootApplication
    @EnableEurekaServer // 注解支持
    public class SpringcloudEurekaApplication {
      
      public static void main(String[] args) {
        SpringApplication.run(SpringcloudEurekaApplication.class, args);
      }
    }

    五、验证

    在浏览器中输入http://localhost:8761/地址,就可以看到Eureka Server的注册页面了

    通过上面的几个步骤,单机版的Eureka Server就成功的启动了!

  • 相关阅读:
    全局函数和静态函数
    C语言变量总结
    #ifdef、#ifndef 与 #endif
    #include与#define的意义
    exit
    字符常量
    void *:万能指针
    算法(Algorithms)第4版 练习 链表类 1.3.19~1.3.29
    算法(Algorithms)第4版 练习 1.3.219
    算法(Algorithms)第4版 练习 1.3.20
  • 原文地址:https://www.cnblogs.com/sharpest/p/13706468.html
Copyright © 2020-2023  润新知