2017-12-21 8 views
1

私はスタンドアロンのスプリングブートアプリケーション(バージョン1.5.9.RELEASE)を持っています。クライアントはユーレカに登録していますサーバ。春のブートアプリケーションで必要とされる applicaiton.ymlファイルがスプリングブート1.5.9.RELEASE - ユーレカはipaddress inspiteの代わりにhostnameを使用しています。

spring: 
    application: 
    admin: 
     jmx-name: hello-server 

server: 
    port: 8070 
    address: 10.12.134.54 

eureka: 
    client: 
    register-with-eureka: true 
    fetch-registry: true 
    availability-zones: 
     local: http://10.12.134.54:8070/eureka/ 
    instance: 
    prefer-ip-address: true 
    hostname: localhost 

以下のようになります。しかし、私は、アプリケーションを起動したとき、それは、ホスト名使用しているため、それはユーレカサーバに登録することができない:代わりにIPアドレスのポート:ポートを。

誰も私にこの問題を取り除く方法を教えてもらえますか?

ここでエラーログ

Caused by: java.net.ConnectException: Connection refused: connect 
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_66] 
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_66] 
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_66] 
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_66] 
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_66] 
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_66] 
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_66] 
    at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_66] 
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:134) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[httpclient-4.5.3.jar:4.5.3] 
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.3.jar:4.5.3] 
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173) ~[jersey-apache-client4-1.19.1.jar:1.19.1] 
    ... 72 common frames omitted 

2017-12-21 18:23:05.031 WARN 15652 --- [   main] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused: connect 
2017-12-21 18:23:05.033 ERROR 15652 --- [   main] com.netflix.discovery.DiscoveryClient : DiscoveryClient_UNKNOWN/MOB80737.hq.k.grp:8070 - was unable to refresh its cache! status = Cannot execute request on any known server 

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server 
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:111) ~[eureka-client-1.7.0.jar:1.7.0] 
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.7.0.jar:1.7.0] 

答えて

0

次は私のユーレカクライアントの設定です:

eureka: 
    client: 
    serviceUrl: 
     defaultZone: ${DISCOVERY_URL:http://discovery-service:8761}/eureka/ 
    registry-fetch-interval-seconds: 6 
    instance-info-replication-interval-seconds: 6 
    register-with-eureka: true 
    fetch-registry: true 
    heartbeat-executor-thread-pool-size: 5 
    eureka-service-url-poll-interval-seconds: 10 
    instance: 
    leaseRenewalIntervalInSeconds: 10 
    leaseExpirationDurationInSeconds: 20 
    prefer-ip-address: true 

が、これは

を役に立てば幸い
関連する問題