У меня есть вопрос. В настоящее время я занимаюсь развертыванием своей микросервисной инфраструктуры через Amazon Web Service. У меня сейчас 2 экземпляра. 1 Eureka Discovery Service и шлюз Api. Оба микросервиса работают после запуска изображений docker. Тем не менее, мой Api Gateway не зарегистрирован в eureka. Почему нет?
В исходном коде 1 вы можете видеть логи шлюза Api. Там нет ошибок. Но когда я запускаю свои микросервисы локально, вы видите, что шлюз Api зарегистрирован в eureka.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.4.RELEASE)
2020-02-13 04:15:47.546 INFO 1 --- [ main] s.L.LoginJwtApiGatewayApplication : No active profile set, falling back to default profiles: default
2020-02-13 04:15:50.031 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-02-13 04:15:50.579 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 528ms. Found 1 JPA repository interfa ces.
2020-02-13 04:15:51.162 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'bus-env' contains invalid characters, please migrate to a valid form at.
2020-02-13 04:15:51.915 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'bus-refresh' contains invalid characters, please migrate to a valid format.
2020-02-13 04:15:52.096 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a v alid format.
2020-02-13 04:15:52.174 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'hystrix.stream' contains invalid characters, please migrate to a val id format.
2020-02-13 04:15:52.902 INFO 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=55afe708-ad15-310b-9a37-2661146187a0
2020-02-13 04:15:53.825 INFO 1 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default Pu blishSubscribeChannel will be created.
2020-02-13 04:15:53.837 INFO 1 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default T hreadPoolTaskScheduler will be created.
2020-02-13 04:15:53.856 INFO 1 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. The refore, a default DefaultHeaderChannelRegistry will be created.
2020-02-13 04:15:54.235 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfig uration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example : not eligible for auto-proxying)
2020-02-13 04:15:54.783 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.suppor t.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-13 04:15:54.793 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integra tion.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-13 04:15:54.892 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-02-13 04:15:55.897 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8800 (http)
2020-02-13 04:15:55.934 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-02-13 04:15:55.934 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.30]
2020-02-13 04:15:56.111 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-02-13 04:15:56.112 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 8451 ms
2020-02-13 04:15:56.454 WARN 1 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-02-13 04:15:56.458 INFO 1 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius. configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-13 04:15:56.542 INFO 1 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.con fig.ConcurrentCompositeConfiguration@c94fd30
2020-02-13 04:15:56.757 WARN 1 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-02-13 04:15:57.426 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-02-13 04:15:57.660 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.4.10.Final}
2020-02-13 04:15:58.091 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-02-13 04:15:58.437 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-02-13 04:15:59.512 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-02-13 04:15:59.563 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
docker run -d -e "eureka.client.serviceUrl.defauftZone=http://ec2-18-185-58-36.eu-central-1.compute.amazonaws.com:8762/" -e "server.port=8800" -p 8800:8800 -e "eureka.instance.ip-address=3.134.175.64" -e "eureka.instance.prefer-ip-address=true" doncarlito/sendmessage
В исходном коде 2 вы можете видеть, как я делаю свой экземпляр с моим docker контейнером. Может кто-нибудь сказать мне, что я делаю не так?