我有一个spring引导应用程序,用于在开发和测试环境中设置spring cloud config server和eureka server。奇怪的是,应用程序总是试图连接到localhost:8761,即使我的eureka.client.registerWithEureka设置为false。
我怎么才能让它停用?
错误:
ERROR 3144 --- [et_localhost-12] c.n.e.cluster.ReplicationTaskProcessor : Network level connection to peer localhost; retrying after delay
com.sun.jersey.api.client.ClientHandlerException: org.apache.http.conn.ConnectTimeoutException: Connect to localhost:8761 timed out
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1]
at com.netflix.eureka.cluster.DynamicGZIPContentEncodingFilter.handle(DynamicGZIPContentEncodingFilter.java:48) ~[eureka-core-1.4.10.jar:1.4.10]
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.4.10.jar:1.4.10]
at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar:1.19.1]
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) ~[jersey-client-1.19.1.jar:1.19.1]
at com.netflix.eureka.transport.JerseyReplicationClient.submitBatchUpdates(JerseyReplicationClient.java:116) ~[eureka-core-1.4.10.jar:1.4.10]
at com.netflix.eureka.cluster.ReplicationTaskProcessor.process(ReplicationTaskProcessor.java:71) ~[eureka-core-1.4.10.jar:1.4.10]
at com.netflix.eureka.util.batcher.TaskExecutors$BatchWorkerRunnable.run(TaskExecutors.java:187) [eureka-core-1.4.10.jar:1.4.10]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to localhost:8761 timed out我唯一的一堂课是这样的:
@EnableEurekaServer
@EnableConfigServer
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}The application.yml
server:
port: 8888
eureka:
client:
registerWithEureka: false
fetchRegistry: false
server:
waitTimeInMsWhenSyncEmpty: 0
renewal-percent-threshold: 0.49
security:
basic:
enabled: true
user:
password: mypassword
spring:
jmx:
default-domain: ${spring.application.name}
cloud:
config:
server:
git:
uri: https://example.com/myrepo.git
username: username
password: password
clone-on-start: true
search-paths: '{application},{application}/{profile}'
endpoints:
jmx:
domain: ${spring.application.name}
unique-names: true在bootstrap.yml中,我只设置了应用程序名称。
版本:
spring netflix-eureka:1.1.6,spring config-server:1.1.3
发布于 2017-04-07 05:29:01
你能试着像下面这样改变你的配置吗
eureka:
client:
registerWithEureka: false
fetchRegistry: false
service-url:
defaultZone: http://localhost:8888/eureka您可以指定server.port: 8888。所以你的尤里卡在8888港口运行。但你没有为尤里卡指定任何服务-url。因此,我认为您的eureka服务器正在尝试复制到localhost:8761,因为它是默认的,并且您没有为eureka指定service-url。
发布于 2019-01-03 08:48:09
对我来说,下面的属性是对我有用的。
eureka.client.registerWithEureka= false
eureka.client.fetchRegistry= false
eureka.server.maxThreadsForPeerReplication=0发布于 2017-08-21 21:20:04
请使用8761端口为您的尤里卡服务器如下所示。
server:
port: 8761
eureka:
client:
registerWithEureka: false
fetchRegistry: false这里我们配置了一个应用程序端口- 8761是尤里卡服务器的默认端口。我们告诉内置的Eureka客户端不要注册“自身”,因为我们的应用程序应该充当服务器。
https://stackoverflow.com/questions/43247458
复制相似问题