2017-09-06 19 views
0

サーバーの起動時に接続できないというエラーが表示されます。私はlocalhostを使用するのではなく、なぜ192.168.100.16を探すのかと思っています。Zuulサーバー実行アプリケーション

-Djava.net.preferIPv4Stack = trueを使用してアプリケーションを実行しようとしましたが、これも機能しませんでした。

[email protected] ~ $ netstat -tulpn 
(Not all processes could be identified, non-owned process info 
will not be shown, you would have to be root to see it all.) 
Active Internet connections (only servers) 
Proto Recv-Q Send-Q Local Address   Foreign Address   State  PID/Program name 
tcp  0  0 127.0.0.1:44907   0.0.0.0:*    LISTEN  1969/java  
tcp  0  0 127.0.0.1:63342   0.0.0.0:*    LISTEN  1969/java  
tcp  0  0 0.0.0.0:49841   0.0.0.0:*    LISTEN  1969/java  
tcp  0  0 127.0.1.1:53   0.0.0.0:*    LISTEN  -    
tcp  0  0 0.0.0.0:43927   0.0.0.0:*    LISTEN  1969/java  
tcp  0  0 127.0.0.1:631   0.0.0.0:*    LISTEN  -    
tcp  0  0 127.0.0.1:46137   0.0.0.0:*    LISTEN  1969/java  
tcp  0  0 127.0.0.1:6942   0.0.0.0:*    LISTEN  1969/java  
tcp6  0  0 :::44811    :::*     LISTEN  2210/java  
tcp6  0  0 :::36911    :::*     LISTEN  3671/java  
tcp6  0  0 :::46165    :::*     LISTEN  3671/java  
tcp6  0  0 :::41591    :::*     LISTEN  3671/java  
tcp6  0  0 ::1:631     :::*     LISTEN  -    
tcp6  0  0 :::65336    :::*     LISTEN  2210/java  
tcp6  0  0 :::9090     :::*     LISTEN  3671/java  
udp  0  0 0.0.0.0:38293   0.0.0.0:*       -    
udp  0  0 127.0.1.1:53   0.0.0.0:*       -    
udp  0  0 0.0.0.0:68    0.0.0.0:*       -    
udp  0  0 192.168.100.12:123  0.0.0.0:*       -    
udp  0  0 127.0.0.1:123   0.0.0.0:*       -    
udp  0  0 0.0.0.0:123    0.0.0.0:*       -    
udp  0  0 0.0.0.0:631    0.0.0.0:*       -    
udp  0  0 0.0.0.0:50096   0.0.0.0:*       -    
udp  0  0 0.0.0.0:5353   0.0.0.0:*       -    
udp6  0  0 fe80::3468:6113:b62:123 :::*        -    
udp6  0  0 ::1:123     :::*        -    
udp6  0  0 :::123     :::*        -    
udp6  0  0 :::44987    :::*        -    
udp6  0  0 :::5353     :::*        - 

-tulpn

application.yml

server: 
    port: 9090 

# remove that settings in production 
management.security.enabled: false 

eureka: 
    client: 
    serviceUrl: 
     defaultZone: http://127.0.0.1:8761/eureka/ 

zuul: 
    #Service will be mapped under the /api URI 
    prefix: /api 
# Uncomment to disable auto-registering all services read from Eureka 
# ignoredServices: '*' 
    routes: 
    test: 
     path: /redirect/** 
     url: http://google.com 
    customer-by-address: 
     path: /customer-by-address/** 
     url: http://localhost:9098 
    customer-by-service: 
     path: /customer-by-service/** 
     serviceId: CUSTOMER-SERVICE 
    static: 
     path: /static/** 

spring: 
    application: 
    name: zuul-server 

netstatのZuulリストを取得するにはユーレカと通信しようとしている

2017-09-05 10:49:35.310 WARN 3671 --- [nfoReplicator-0] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused (Connection refused) 
2017-09-05 10:49:35.310 WARN 3671 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ZUUL-SERVER/192.168.100.12:zuul-server:9090 - registration failed Cannot execute request on any known server 

答えて

1

私は、このようなエラーが発生していますの要求をルーティングするときに使用するサービス。しかし、netstatの出力にはポート8761でリッスンしているプロセスは表示されません。これはユーレカが設定しなければならない設定です。

1

あなたのZuulインスタンスがユーレカサーバーに接続しようとしています。 あなたのapplication.ymlから

eureka: 
    client: 
    serviceUrl: 
     defaultZone: http://127.0.0.1:8761/eureka/ 

これを削除するか、またはあなたはユーレカとzuulの例を持っているしたい場合は

(あなたがserviceIdといくつかのルートがあり、特に以来)ユーレカを開始し、これは良い資源。 Creating microservice using Spring Cloud, Eureka and Zuul

関連する問題