작성
·
972
0
apigatewayservice에서 application.yml 파일에서 lb://MY-FIRST-SERVICE 이렇게 load balancer로 수정을 하니까 이전에 뜨지 않았던 아래와 같은 오류가 뜹니다. 이유가 무엇인가요,,,? 이걸 어떻게 해결해야할지 모르겠어요.
java.net.UnknownHostException: failed to resolve 'DESKTOP-QSU4PN8.mshome.net' after 2 queries
at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:1046) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP GET "/first-service/welcome" [ExceptionHandlingWebHandler]
Original Stack Trace:
at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:1046) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:999) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:417) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsResolveContext.access$600(DnsResolveContext.java:65) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsResolveContext$2.operationComplete(DnsResolveContext.java:466) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:571) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:550) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:609) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsQueryContext.tryFailure(DnsQueryContext.java:224) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.resolver.dns.DnsQueryContext$4.run(DnsQueryContext.java:176) ~[netty-resolver-dns-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[netty-transport-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.70.Final.jar:4.1.70.Final]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: io.netty.resolver.dns.DnsNameResolverTimeoutException: [/203.246.162.253:53] query via UDP timed out after 5000 milliseconds (no stack trace available)
답변 2
2
안녕하세요, 이도원입니다.
올려주신 에러 코드가 질문하신 분의 특정한 상황의 에러코드여서, 정확한 답변을 드리기 어렵지만, lb://MY-FIRST-SERVICE 라고 설정했다는 것은, Eureka에 등록된 서비스 중 MY-FIRST-SERVICE로 요청정보를 이동하기 위한 설정 부분인거 같습니다. MY-FIRST-SERVICE라는 인스턴스가 여러가 실행되어 LB(Load Balancer)를 사용할 수 있는 설정이라면, 해당 서비스 이름만으로 여러 인스턴스들 중에 하나를 선택하여 사용할 수 있게 됩니다. 문제는 Eureka에 등록 될때, Windows OS의 hostname(질문자님의 경우 DESKTOP-QSU4PN8.mshome.net)으로 서비스들이 등록되어서, 이러한 hostname을 찾을 수 없다는 에러인것 같습니다. 아래와 같이 직접 IP로 인스턴스를 등록하도록 수정한 다음 실행해 보시기 바랍니다.
eureka:
instance:
instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
prefer-ip-address: true
ip-address: ${server.address}
client:
service-url:
defaultZone: http://127.0.0.1:8761/eureka
fetch-registry: true
register-with-eureka: true
감사합니다.
0