我在我的 aws ec2 实例中运行 eureka 服务器,成功启动后,我看到永久 CPU 负载约为 15-20%,我预计它应该在零左右,因为我只注册了 3 个服务。
我使用尤里卡教程并尝试通过删除所有我不理解的东西来使用 application.yml 文件,但到目前为止还没有运气。
== 应用程序.yml ==
server:
port: 8000
eureka:
instance:
preferIpAddress: true
hostname: localhost
client:
registerWithEureka: false # telling the server not to register himself in the service
fetchRegistry: false
serviceUrl:
defaultZone : http://${eureka.instance.hostname}:${server.port}/eureka/
我使用java 1.8。
== build.gradle ==
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'org.example.eureka'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext {
springCloudVersion = 'Finchley.SR1'
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
tasks.withType(Jar) {
archiveName = "eurekaserver.jar"
}
我在日志中看到以下几行:
Running the evict task with compensationTime 0ms
很可能我在配置中遗漏了一些东西,但不知道在谷歌中我到目前为止还没有找到相关的提示/设置。任何人都可以建议吗?