简体   繁体   English

如何在 Spring Boot 的 eureka 服务器上从 Grails 注册 eureka 客户端

[英]How to register eureka client from Grails on eureka server in Spring boot

I want to register my eureka client that is in Grails 2.4.4 on a eureka server which is in spring boot.我想在 Spring Boot 的 eureka 服务器上注册 Grails 2.4.4 中的 eureka 客户端。

I already have registered another eureka service from spring boot on the same eureka server and it is working fine.我已经在同一个 eureka 服务器上从 spring boot 注册了另一个 eureka 服务,它工作正常。 When I run grails app, it gives me an error :当我运行 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

Here is my application.properties file:这是我的 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/

Any help will be appriciable.任何帮助将是适当的。

Thanks !谢谢 !

Here are my findings that I have applied to this issue.以下是我已应用于此问题的发现。 However, I did lots of search on google to get it right back on the track.但是,我在谷歌上进行了大量搜索以使其重新回到正轨。

Step 1: Create a file named eureka-client.properties第 1 步:创建一个名为eureka-client.properties的文件

Step 2: Now remove your configuration code from application.properties file and paste it into the newly created file.第 2 步:现在从application.properties文件中删除您的配置代码并将其粘贴到新创建的文件中。

Step 3: Pass your eureka port there and of course serviceId in this file.第 3 步:在那里传递您的 eureka 端口,当然还有这个文件中的serviceId

Configuration CODE:配置代码:

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/

Now save the changes and run your application.现在保存更改并运行您的应用程序。 It will connect to your Eureka server.它将连接到您的 Eureka 服务器。 After refreshing your Eureka home page, you will find it there.刷新您的 Eureka 主页后,您会在那里找到它。

Not sure if it's a TYPO in your question or a genuine error but the line eureka.port = 1116eureka.name=Grails-Service should be:不确定这是您的问题中的 TYPO 还是真正的错误,但eureka.port = 1116eureka.name=Grails-Service应该是:

eureka.port = 1116
eureka.name=Grails-Service

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用安全的 Eureka 服务器注册 Spring Boot 客户端应用程序 - How to register a Spring Boot client application with a secure Eureka server eureka客户端如何在spring boot 1.5.2中找到eureka服务器? - How does the eureka client find the eureka server in spring boot 1.5.2? 从单个主机注册Spring Boot Eureka Client的多个实例 - Register multiple Instances of a Spring Boot Eureka Client from a single host 如何在我的 eureka 服务器上注册 python 微服务(spring boot) - How to register python microservices with my eureka server (spring boot) 如何在 Eureka 发现服务器中注册非 Spring Boot 微服务 - How to register non Spring Boot MicroService in Eureka discovery server 如何在不同主机上使用eureka-server注册eureka-clients。 春季启动 - How to register eureka-clients with eureka-server on different hosts. Spring-boot 使用 spring 引导在 Docker 中运行 Eureka Server 和 Eureka Client - Running Eureka Server and Eureka Client in Docker using spring boot 在 Spring 启动 Eureka Client eureka.client.service-url.defaultZone 是如何工作的以及如何添加新的 eureka 服务器? - In Spring Boot Eureka Client How does eureka.client.service-url.defaultZone work and how to add new eureka server? Eureka客户端无法向Eureka服务器注册服务 - Eureka client unable to register service to eureka server 如何将Keycloak注册到Spring Eureka Server - How to register Keycloak to Spring Eureka Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM