Программисты JAVA общаются здесь
Anonymous
Весна эврика - невозможно определить локальное имя хоста
Сообщение
Anonymous » 22 дек 2025, 03:00
Я пытаюсь развернуть сервер Spring Eureka на своем локальном компьютере. К сожалению, приложение Eureka не может определить локальное имя хоста, поскольку значения registered-replicas и unavaiable-replicas пусты.
Как заставить приложение Spring выбрать
один сетевой интерфейс?
Локальное приложение Eureka
pom-файл
Код: Выделить всё
...
2021.0.5
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.cloud
spring-cloud-starter-netflix-eureka-server
...
EurekApplication.java
Код: Выделить всё
@SpringBootApplication
@EnableEurekaServer
public class EurekaApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
}
application.properties
Код: Выделить всё
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
logging.level.com.netflix.eureka=OFF
logging.level.com.netflix.discovery=OFF
logging.level.org.springframework.cloud.commons.util.InetUtils= trace
логи из консоли
Код: Выделить всё
2022-12-02 13:12:35.170 INFO 13588 --- [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM'
2022-12-02 13:12:35.828 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Software Loopback Interface 1
2022-12-02 13:12:35.830 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: VirtualBox Host-Only Ethernet Adapter
2022-12-02 13:12:35.830 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: VirtualBox Host-Only Ethernet Adapter
2022-12-02 13:12:35.836 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Intel(R) Ethernet Connection (7) I219-V
2022-12-02 13:12:35.882 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter
2022-12-02 13:12:35.893 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter #2
2022-12-02 13:12:36.913 INFO 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2022-12-02 13:12:37.429 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Software Loopback Interface 1
2022-12-02 13:12:37.431 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: VirtualBox Host-Only Ethernet Adapter
2022-12-02 13:12:37.431 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: VirtualBox Host-Only Ethernet Adapter
2022-12-02 13:12:37.437 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Intel(R) Ethernet Connection (7) I219-V
2022-12-02 13:12:37.483 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter
2022-12-02 13:12:37.494 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter #2
2022-12-02 13:12:38.509 INFO 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2022-12-02 13:12:38.751 INFO 13588 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey
2022-12-02 13:12:38.806 WARN 13588 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2022-12-02 13:12:38.826 INFO 13588 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2022-12-02 13:12:38.968 INFO 13588 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2022-12-02 13:12:38.995 INFO 13588 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNOWN with eureka with status UP
2022-12-02 13:12:39.009 INFO 13588 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false
2022-12-02 13:12:39.011 INFO 13588 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context
2022-12-02 13:12:39.019 INFO 13588 --- [ Thread-9] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2022-12-02 13:12:39.023 INFO 13588 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8761 (http) with context path ''
Мои локальные сетевые интерфейсы
Подробнее здесь:
https://stackoverflow.com/questions/746 ... l-hostname
1766361625
Anonymous
Я пытаюсь развернуть сервер Spring Eureka на своем локальном компьютере. К сожалению, приложение Eureka не может определить локальное имя хоста, поскольку значения registered-replicas и unavaiable-replicas пусты. Как заставить приложение Spring выбрать [b]один[/b] сетевой интерфейс? Локальное приложение Eureka [img]https://i.sstatic.net/H32nN.png[/img] pom-файл [code]... 2021.0.5 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.cloud spring-cloud-starter-netflix-eureka-server ... [/code] EurekApplication.java [code]@SpringBootApplication @EnableEurekaServer public class EurekaApplication { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); } } [/code] application.properties [code]server.port=8761 eureka.client.register-with-eureka=false eureka.client.fetch-registry=false logging.level.com.netflix.eureka=OFF logging.level.com.netflix.discovery=OFF logging.level.org.springframework.cloud.commons.util.InetUtils= trace [/code] логи из консоли [code]2022-12-02 13:12:35.170 INFO 13588 --- [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM' 2022-12-02 13:12:35.828 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Software Loopback Interface 1 2022-12-02 13:12:35.830 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: VirtualBox Host-Only Ethernet Adapter 2022-12-02 13:12:35.830 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: VirtualBox Host-Only Ethernet Adapter 2022-12-02 13:12:35.836 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Intel(R) Ethernet Connection (7) I219-V 2022-12-02 13:12:35.882 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter 2022-12-02 13:12:35.893 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter #2 2022-12-02 13:12:36.913 INFO 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2022-12-02 13:12:37.429 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Software Loopback Interface 1 2022-12-02 13:12:37.431 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: VirtualBox Host-Only Ethernet Adapter 2022-12-02 13:12:37.431 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: VirtualBox Host-Only Ethernet Adapter 2022-12-02 13:12:37.437 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Intel(R) Ethernet Connection (7) I219-V 2022-12-02 13:12:37.483 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter 2022-12-02 13:12:37.494 TRACE 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: Hyper-V Virtual Ethernet Adapter #2 2022-12-02 13:12:38.509 INFO 13588 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2022-12-02 13:12:38.751 INFO 13588 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey 2022-12-02 13:12:38.806 WARN 13588 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath. 2022-12-02 13:12:38.826 INFO 13588 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2022-12-02 13:12:38.968 INFO 13588 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' 2022-12-02 13:12:38.995 INFO 13588 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNOWN with eureka with status UP 2022-12-02 13:12:39.009 INFO 13588 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false 2022-12-02 13:12:39.011 INFO 13588 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context 2022-12-02 13:12:39.019 INFO 13588 --- [ Thread-9] e.s.EurekaServerInitializerConfiguration : Started Eureka Server 2022-12-02 13:12:39.023 INFO 13588 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8761 (http) with context path '' [/code] Мои локальные сетевые интерфейсы [img]https://i.sstatic.net/ooZ8k.png[/img] Подробнее здесь: [url]https://stackoverflow.com/questions/74655856/spring-eureka-cannot-determine-local-hostname[/url]