spring cloud中啟動Eureka Server的方法,cloudeureka

來源:互聯網
上載者:User

spring cloud中啟動Eureka Server的方法,cloudeureka

本文介紹了spring cloud中啟動Eureka Server的方法,分享給大家,具體如下:

一、建立工程

二、工程結構

三、修改設定檔

# 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註解

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就成功的啟動了!

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援幫客之家。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.