Ignite 点燃Kubernetes中的瘦客户端
我正试图通过Kubernetes环境中的瘦客户机,使用Ignite和我的java应用程序建立分布式缓存 在我的Kubernetes集群中,我有两个装有java应用程序的吊舱和两个ignite吊舱。为了让java吊舱与ignite吊舱通信,我配置了一个瘦客户机来连接ignite kubernetes服务。通过这种配置,我希望负载平衡是在kubernetes方面。以下是我在java代码中所做的工作:Ignite 点燃Kubernetes中的瘦客户端,ignite,Ignite,我正试图通过Kubernetes环境中的瘦客户机,使用Ignite和我的java应用程序建立分布式缓存 在我的Kubernetes集群中,我有两个装有java应用程序的吊舱和两个ignite吊舱。为了让java吊舱与ignite吊舱通信,我配置了一个瘦客户机来连接ignite kubernetes服务。通过这种配置,我希望负载平衡是在kubernetes方面。以下是我在java代码中所做的工作: ClientConfiguration cfg = new ClientConfiguration(
ClientConfiguration cfg = new ClientConfiguration()
.setAddresses("ignite-service.default.svc.cluster.local:10800")
.setUserName("user")
.setUserPassword("password");
IgniteClient igniteClient = Ignition.startClient(cfg);
在从ignite存储和获取对象时,我删除了其中一个ignite吊舱,过了一段时间,我收到错误消息,说“ignite cluster不可用”:
org.apache.ignite.client.ClientConnectionException:ignite群集不可用
对于这种行为,我假设ClientConfiguration类中的方法setAddresses存储pod的一个IP,并将所有通信传送到该pod
这种方法就是这样吗
点火版本2.7
Kubernetes 1.12.3版您需要传递多个IP地址才能在瘦客户端上启用故障切换(即自动重新连接)。查找更多详细信息。虽然您可能已经解决了该问题,因为该问题已发布很久,但仍在此处为其他人提供答案 使用ApacheIgnite版本(2.7+),您可以修改部署以使用Kubernetes IP Finder。通过这种方式,Kubernetes将负责发现和连接所有服务器和客户端节点 TcpDiscoveryKubernetesIpFinder模块将帮助您实现这一点 这是需要添加到配置中的发现SPI(替换为适当的命名空间和服务名称)
官方文档可在此处找到-Hi@dmagda,不需要传递所有POD的IP地址。Ignite服务已经提供了故障转移机制,我认为瘦客户机也可以管理它。我决定在每次需要对Ignite执行操作时都实施重试机制。
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.kubernetes.TcpDiscoveryKubernetesIpFinder">
<constructor-arg>
<bean class="org.apache.ignite.kubernetes.configuration.KubernetesConnectionConfiguration">
<property name="namespace" value="default" />
<property name="serviceName" value="ignite" />
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</property>