Cloud Foundry : Eureka Server 作为用户提供服务和添加服务
Cloud Foundry : Eureka Server as user provided service and add services
我们组织中的 cloud foundry 没有安装 Spring 云服务。我已经创建了一个 Eureka Server 并将其部署在 Cloud foundry 中并且能够看到 Eureka 主页
我已经创建了一个用户提供服务并使用此处提供的步骤绑定了应用程序 (https://github.com/making/cf-eureka-server)!
由于没有Spring CLoud
,我已经给出了以下依赖项
<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-service-registry</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
和
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
但是我在 CF 日志中收到以下错误
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173) ~[jersey-apache-client4-1.19.1.jar!/:1.19.1]
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] ... 30 common frames omitted
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 WARN [DiscoveryClient-HeartbeatExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution failed with message: java.net.ConnectException: Connection refused (Connection refused)
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 WARN [DiscoveryClient-CacheRefreshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution failed with message: java.net.ConnectException: Connection refused (Connection refused)
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 ERROR [DiscoveryClient-HeartbeatExecutor-0] c.n.d.DiscoveryClient - DiscoveryClient_C2M-LAUNCH-SERVICE/app-launch-service.apps.np.sdppcf.com:d2c76a2f-f2c4-45f9-7e3b-f807 - was unable to send heartbeat!
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
该应用程序是 Spring 引导应用程序,我已使用 @EnableDiscoveryClient 启用发现。由于这个错误,我无法在 Eureka 中看到服务。
是否可以在不在 Cloud foundry 中安装 Spring Cloud Services 的情况下创建 Eureka 服务并使用 feign Clients 等?任何方向都会有所帮助。
spring-cloud-services-starter-*
客户端库的开发是为了匹配 Spring 云服务部署和保护 Spring 云应用程序(如 Eureka)的方式。这些 Spring 云服务库不太可能与您自己编写的 Eureka 服务一起使用,除非您实现与 SCS 相同的安全性和其他配置。
而不是使用 io.pivotal.spring.cloud:spring-cloud-services-starter-service-registry
,您应该使用 org.springframework.cloud:spring-cloud-starter-eureka
并使用 application.properties
或 application.yml
中的属性配置 Eureka。您可以将适当的属性设置为从用户提供的服务实例解析的值,如 making's example from the Github repo 所示:
eureka.client.service-url.defaultZone=${vcap.services.eureka-service.credentials.uri:http://localhost:8761}/eureka/
我们组织中的 cloud foundry 没有安装 Spring 云服务。我已经创建了一个 Eureka Server 并将其部署在 Cloud foundry 中并且能够看到 Eureka 主页
我已经创建了一个用户提供服务并使用此处提供的步骤绑定了应用程序 (https://github.com/making/cf-eureka-server)!
由于没有Spring CLoud
,我已经给出了以下依赖项<dependency>
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-service-registry</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
和
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
但是我在 CF 日志中收到以下错误
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173) ~[jersey-apache-client4-1.19.1.jar!/:1.19.1]
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] ... 30 common frames omitted
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 WARN [DiscoveryClient-HeartbeatExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution failed with message: java.net.ConnectException: Connection refused (Connection refused)
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 WARN [DiscoveryClient-CacheRefreshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClient - Request execution failed with message: java.net.ConnectException: Connection refused (Connection refused)
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] 2017-Nov-13 09:09:05.237 ERROR [DiscoveryClient-HeartbeatExecutor-0] c.n.d.DiscoveryClient - DiscoveryClient_C2M-LAUNCH-SERVICE/app-launch-service.apps.np.sdppcf.com:d2c76a2f-f2c4-45f9-7e3b-f807 - was unable to send heartbeat!
2017-11-13T14:39:05.238+05:30 [APP/PROC/WEB/0] [OUT] com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
该应用程序是 Spring 引导应用程序,我已使用 @EnableDiscoveryClient 启用发现。由于这个错误,我无法在 Eureka 中看到服务。
是否可以在不在 Cloud foundry 中安装 Spring Cloud Services 的情况下创建 Eureka 服务并使用 feign Clients 等?任何方向都会有所帮助。
spring-cloud-services-starter-*
客户端库的开发是为了匹配 Spring 云服务部署和保护 Spring 云应用程序(如 Eureka)的方式。这些 Spring 云服务库不太可能与您自己编写的 Eureka 服务一起使用,除非您实现与 SCS 相同的安全性和其他配置。
而不是使用 io.pivotal.spring.cloud:spring-cloud-services-starter-service-registry
,您应该使用 org.springframework.cloud:spring-cloud-starter-eureka
并使用 application.properties
或 application.yml
中的属性配置 Eureka。您可以将适当的属性设置为从用户提供的服务实例解析的值,如 making's example from the Github repo 所示:
eureka.client.service-url.defaultZone=${vcap.services.eureka-service.credentials.uri:http://localhost:8761}/eureka/