Hazelcast春季启动应用程序未作为ec2服务运行



我用本指南中的代码创建了spring-boot应用程序。榛子果。yaml如下。

hazelcast:
network:
join:
multicast:
enabled: false
aws:
enabled: true
host-header: ec2
interfaces:
enabled: true
interfaces:
- 10.9.*.*
map:
books:
time-to-live-seconds: 60

但是我收到错误

2021-07-15 10:14:08.101信息1-[main]c.h.i.config.AbstractConfigLocator:从类路径加载'hazelcast.yaml'。2021-07-15 10:14:08.911信息1---[main]com.hazecast.instance.AddressPicker:[LOCAL][dev][4.2.1]接口已启用,试图选择一个与以下地址之一匹配的地址:[10.9..]2021-07-15 10:14:09.098信息1-[main]com.hazecast.system:[10.09.4]:5701[dev][4.2.1]hazelcast 4.2.1(20210630-06a018)从[10.09.4]:5701开始2021-07-15 10:14:11.700信息1-[主]com.hazecast.aws.AwsDiscoveryStrategy:使用配置为AwsConfig的aws发现插件{accessKey='',secretKey='',iamRole='null',region='nul',hostHeader='ec2',securityGroupName='null],tagKey='null',tagValue='null`,hzPort=5701-5708,cluster='null'-,family='nulls',serviceName='nul'',connectionTimeoutSeconds=10,connectionRetries=3,readTimeoutSeconds=100}2021-07-15 10:14:11.717错误1-[main]com.hazecast.instance.impl.Node:[10.9.04]:5701[dev][4.2.1]节点创建失败java.lang.RuntimeException:无法配置发现策略网址:com.hazelcast.spi.sdiscovery.impl.DefaultDiscoveryService.loadDiscoveryStrategies(DefaultDiscoveryServices.java:161)~[hazelcast all-4.2.1.jar!/:4.2.1]网址:com.hazelcast.spi.discovery.impl.DefaultDiscoveryService.(DefaultDiscoveryService.java:58)~[hazelcast all-4.2.1.jar!/:4.2.1]网址:com.hazelcast.spi.decovery.impl.DefaultDiscoveryServiceProvider.newDiscoveryService(DefaultDiscoveryServicesProvider.java:29)~[hazelcast all-4.2.1.jar!/:4.2.1]在com.hazelcast.instance.impl.Node.createDiscoveryService(Node.java:343)~[Hazzecast-all-4.21.jar!/:4.2.1]在com.hazelcast.instance.impl.Node.(Node.java:269)~[hazelccast-all-4.21.jar!/:4.2.1]在com.hazelcast.instance.impl.HazalcastInstanceImpl.createNode(HazelcastInstanceImpl.java:148)[Hazalcast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.instance.impl.HazelcastInstanceImpl.(HazelcastInstanceImpl.java:117)[hazelcast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.instance.impl.HazalcastInstanceFactory.constructHazelcastInstance(hazelcast实例工厂.java:211)[Hazalcast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.instance.impl.HazalcastInstanceFactory.newHazelcastInstance(hazelcast实例工厂.java:190)[Hazalcast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.instance.impl.HazalcastInstanceFactory.newHazelcastInstance(hazelcast实例工厂.java:128)[Hazalcast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.core.Hazalcast.newHazelcastInstance(hazelcast.java:91)[Hazalcast-all-4.21.jar!/:4.2.1]网址:org.springframework.boot.autoconfig.hazalcast.HazalcastServerConfiguration$HazelcastServerConfigFileConfiguration.hazalcast实例(hazelcast服务器配置.java:55)[spring-boot-autoconfigure-2.4.2.jar!/:2.4.2]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)~[na:1.8.0_212]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)~[na:1.8.0_212]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[na:1.8.0_212]位于java.lang.reflect.Method.ioke(Method.java:498)~[na:1.8.0_212]网址:org.springframework.beans.factory.support.SimpleInstantiationStrategy.instante(SimpleInstantiatonStrategy.java:154)[spring-beans-5.3.3.jar!/:5.3.3]位于org.springframework.beans.factory.support.ConstructureResolver.instante(ConstructorResolver.java:653)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.ConstructureResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory:java:1336)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)[spring-beans-5.3.3.jar!/:5.3.3]位于org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)[spring-beans-5.3.3.jar!/:5.3.3]位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)~[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory:java:333)[spring-beans-5.3.3.jar!/:5.3.3]网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory:java:208)[spring-beans-5.3.3.jar!/:5.3.3]位于org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)~[spring-beans-5.3.3.jar!/:5.3.3]位于org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:923)~[spring-context-5.3.3.jar!/:5.3.3]网址:org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)~[spring-context-5.3.3.jar!/:5.3.3]网址:org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplication context.java:144)~[spring-boot-2.4.2.jar!/:2.4.2]网址:org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)~[spring-boot-2.4.2.jar!/:2.4.2]网址:org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)~[spring-boot-2.4.2.jar!/:2.4.2]网址:org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)~[spring-boot-2.4.2.jar!/:2.4.2]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:326)~[spring-boot-2.4.2.jar!/:2.4.2]在org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)~[spring-boot-2.4.2.jar!/:2.4.2]网址:org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)~[spring-boot-2.4.2.jar!/:2.4.2]网址:com.example.hazelcast.HazelcastApplication.main(HazelcastApplication.java:12)~[classes!/:na]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)~[na:1.8.0_212]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)~[na:1.8.0_212]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[na:1.8.0_212]位于java.lang.reflect.Method.ioke(Method.java:498)~[na:1.8.0_212]网址:org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner:java:49)~[app.jar:na]网址:org.springframework.bootloader.Launcher.launch(Launcher.java:107)~[app.jar:na]网址:org.springframework.bootloader.Launcher.launch(Launcher.java:58)~[app.jar:na]网址:org.springframework.bootloader.JarLauncher.main(JarLauncher.java:88)~[app.jar:na]导致原因:java.lang.NullPointerException:null在java.util.regex.Matcher.getTextLength(Matcher.java:1283)~[na:1.8.0_212]在java.util.regex.Matcher.reset(Matcher.java:309)~[na:1.8.0_212]在java.util.regex.Matcher.(Matcher.java:229)~[na:1.8.0_212]位于java.util.regex.Pattern.matcher(Pattern.java:1093)~[na:1.8.0_212]网址:com.hazecast.aws.RegioValidator.validateRegion(RegionValidator.java:33)~[hazecast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.aws.AwsClientConfigurator.createAwsClient(AwsClientConfigulator.java:53)~[hazelcast all-4.2.1.jar!/:4.2.1]网址:com.hazelcast.aws.AwsDiscoveryStrategy网址:com.hazelcast.aws.AwsDiscoveryStrategyFactory.newDiscoveryStrategy网址:com.hazelcast.spi.sdiscovery.impl.DefaultDiscoveryService.buildDiscoveryStrategy(DefaultDiscoveryServices.java:195)~[Hazzecast-all-4.21.jar!/:4.2.1]网址:com.hazelcast.spi.sdiscovery.impl.DefaultDiscoveryService.loadDiscoveryStrategies(DefaultDiscoveryServices.java:141)~[hazelcast all-4.2.1.jar!/:4.2.1]…省略了45个常见帧2021-07-15 10:14:11.718信息1-[main]com.hazecast.instance.impl.Node:[10.9.04]:5701[dev][4.2.1]正在关闭连接管理器。。。2021-07-15 10:14:11.792信息1-[main]com.hazecast.instance.impl.Node:[10.9.04]:5701[dev][4.2.1]正在关闭节点引擎。。。2021-07-15 10:14:11.804信息1---[main]c.hazecast.instance.impl.NodeExtension:[10.9.04]:5701[dev][4.2.1]正在销毁节点NodeExtension。

但当我尝试只删除host-header: ec2的fargate服务时,它成功了。如何作为ec2服务运行?

该配置适用于EC2上的ECS。

如果您使用的是EC2实例,则配置如下

<hazelcast>
<network>
<join>
<multicast enabled="false"/>
<aws enabled="true">
<tag-key>my-ec2-instance-tag-key</tag-key>
<tag-value>my-ec2-instance-tag-value</tag-value>
</aws>
</join>
</network>
</hazelcast>

请参阅以下链接https://guides.hazelcast.org/ecs-embedded/

由于某种原因,似乎没有从EC2实例中解析该区域。也许您禁用了元数据API。我建议手动配置区域。

hazelcast:
network:
join:
multicast:
enabled: false
aws:
enabled: true
region: <your-region>
host-header: ec2
...

相关内容

  • 没有找到相关文章

最新更新