Я создаю Eureka server с весенней загрузкой и клиентские микросервисы для развертывания на aws. Я читал в руководствах, что мне нужно определить eureka.datacenter: cloud в моем application.yml сервера eureka, чтобы он знал, что он находится на aws. Но когда я пытаюсь использовать его в своем файле application.yml, я получаю unknown property 'eureka.datacenter'.
Я включил зависимости для сервера eureka.
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
</dependencies>
Я использую Spring boot 1.5.8.RELEASE и весеннее облако Edgware.SR1.
Включено ли свойство eureka.datacenter в другую версию весеннего облака?
application.yml
spring:
application:
name: eureka-svc
---
spring:
profiles: localhost
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
fetchRegistry: false
register-with-eureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka
---
spring:
profiles: aws
server:
port: 8761
eureka:
instance:
non-secure-port: ${server.port}
environment: production
client:
region: region
register-with-eureka: true
fetchRegistry: true
use-dns-for-fetching-service-urls: true
eureka-server-d-n-s-name: dns-name
eureka-server-port: 8761
eureka-server-u-r-l-context: eureka
server:
a-w-s-access-id: access-id
a-w-s-secret-key: aws-key
binding-strategy: route53
list-auto-scaling-groups-role-name: role-name
Я добавил application.yml.




Возможно, разница не будет, но не могли бы вы попробовать:
eureka.datacenter: cloud
вместо:
eureka.datacenter=cloud
Я допустил ошибку при вводе вопроса. Я использовал eureka.datacenter: cloud. Извини за это. Отредактирую вопрос.
Разве вам не нужно передавать eureka.datacenter как свойство командной строки?
If you are running in the cloud environment, you will need to pass in the java commandline property -Deureka.datacenter=cloud so that the Eureka Client/Server knows to initialize the information specific to AWS cloud.
да, я знаю это, но в некоторых сообщениях в сети это упоминалось в файле .yml. stackoverflow.com/questions/33659412/…github.com/spring-cloud/spring-cloud-netflix/issues/791
Я следую инструкциям от
@EnableEurekaServer
@SpringBootApplication
public class DiscoveryServiceApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryServiceApplication.class, args);
}
@Bean
@Profile("aws")
public EurekaInstanceConfigBean eurekaInstanceConfig(InetUtils inetUtils) {
EurekaInstanceConfigBean b = new EurekaInstanceConfigBean(inetUtils);
AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
b.setDataCenterInfo(info);
return b;
}
}
Как выглядит ваш application.yml? Я не знаю свойства
eureka.datacenter.