![](/img/trans.png)
[英]How to register a Spring Boot client application with a secure Eureka server
[英]How to register eureka client from Grails on eureka server in Spring boot
我想在 Spring Boot 的 eureka 服務器上注冊 Grails 2.4.4 中的 eureka 客戶端。
我已經在同一個 eureka 服務器上從 spring boot 注冊了另一個 eureka 服務,它工作正常。 當我運行 grails 應用程序時,它給了我一個錯誤:
| Error 2018-02-21 17:29:39,765 [localhost-startStop-1] ERROR aws.ConfigClusterResolver - Cannot resolve to any endpoints from provided configuration: {defaultZone=[]}
| Error 2018-02-21 17:29:39,771 [localhost-startStop-1] ERROR transport.EurekaHttpClients - Initial resolution of Eureka server endpoints failed. Check ConfigClusterResolver logs for more info
| Error 2018-02-21 17:29:39,841 [localhost-startStop-1] ERROR discovery.DiscoveryClient - DiscoveryClient_UNKNOWN/pawan - was unable to refresh its cache! status = There is no known eureka server; cluster server list is empty
Message: There is no known eureka server; cluster server list is empty
Line | Method
->> 107 | execute in com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 134 | getApplications in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator
| 137 | execute . . . . . . . . . . . . in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6
| 77 | execute in com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient
| 134 | getApplications . . . . . . . . in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator
| 1051 | getAndStoreFullRegistry in com.netflix.discovery.DiscoveryClient
| 965 | fetchRegistry . . . . . . . . . in ''
| 414 | <init> in ''
| 269 | <init> . . . . . . . . . . . . . in ''
| 265 | <init> in ''
| 257 | <init> . . . . . . . . . . . . . in ''
| 31 | initializeEurekaClient in EurekaConfiguration
| 20 | doCall . . . . . . . . . . . . . in BootStrap$_closure1
| 327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
| 320 | executeForEnvironment . . . . . in ''
| 296 | executeForCurrentEnvironment in ''
| 266 | run . . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1149 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 624 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 748 | run in java.lang.Thread
這是我的 application.properties 文件:
#Grails Metadata file
#Grails Metadata file
#Grails Metadata file
#Grails Metadata file
#Fri Jan 19 17:25:36 IST 2018
app.grails.version=2.4.4
app.name=GrailsMicroservice
app.version=0.1
#app.port=8080
eureka.region = default
eureka.vipAddress = localhost
eureka.port = 1116eureka.name=Grails-Service
eureka.hostname=localhost
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:1116/eureka/
任何幫助將是適當的。
謝謝 !
以下是我已應用於此問題的發現。 但是,我在谷歌上進行了大量搜索以使其重新回到正軌。
第 1 步:創建一個名為eureka-client.properties
的文件
第 2 步:現在從application.properties
文件中刪除您的配置代碼並將其粘貼到新創建的文件中。
第 3 步:在那里傳遞您的 eureka 端口,當然還有這個文件中的serviceId
。
配置代碼:
app.grails.version=2.4.4
app.name=GrailsMicroservice
app.version=0.1
#app.port=8080
eureka.region = default
eureka.vipAddress = localhost
eureka.port = 1116
eureka.name=Grails-Service
eureka.hostname=localhost
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:1116/eureka/
現在保存更改並運行您的應用程序。 它將連接到您的 Eureka 服務器。 刷新您的 Eureka 主頁后,您會在那里找到它。
不確定這是您的問題中的 TYPO 還是真正的錯誤,但eureka.port = 1116eureka.name=Grails-Service
應該是:
eureka.port = 1116
eureka.name=Grails-Service
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.