Search code examples
kubernetesignite

ignite client can not reconnect to ignite Kubernetes cluster,after pod restart


below if client code config KubernetesConnectionConfiguration kcfg = new KubernetesConnectionConfiguration();

kcfg.setNamespace(igniteK8sNameSpace);
kcfg.setServiceName(igniteK8sServiceName);
cfg.setAddressesFinder(new ThinClientKubernetesAddressFinder(kcfg));
cfg.setRetryPolicy(new ClientRetryAllPolicy());

after ignite pod restart

client throw Exception
org.apache.ignite.client.ClientConnectionException: Connection timed out
        at org.apache.ignite.internal.client.thin.io.gridnioserver.GridNioClientConnectionMultiplexer.open(GridNioClientConnectionMultiplexer.java:144)
        at org.apache.ignite.internal.client.thin.TcpClientChannel.<init>(TcpClientChannel.java:178)
        at org.apache.ignite.internal.client.thin.ReliableChannel$ClientChannelHolder.getOrCreateChannel(ReliableChannel.java:917)
        at org.apache.ignite.internal.client.thin.ReliableChannel$ClientChannelHolder.getOrCreateChannel(ReliableChannel.java:898)
        at org.apache.ignite.internal.client.thin.ReliableChannel$ClientChannelHolder.access$200(ReliableChannel.java:847)
        at org.apache.ignite.internal.client.thin.ReliableChannel.applyOnDefaultChannel(ReliableChannel.java:759)
        at org.apache.ignite.internal.client.thin.ReliableChannel.applyOnDefaultChannel(ReliableChannel.java:731)
        at org.apache.ignite.internal.client.thin.ReliableChannel.service(ReliableChannel.java:167)
        at org.apache.ignite.internal.client.thin.ReliableChannel.request(ReliableChannel.java:288)
        at org.apache.ignite.internal.client.thin.TcpIgniteClient.getOrCreateCache(TcpIgniteClient.java:185)

and i use retry to reconnect and print clientConfiguration.getAddressesFinder().getAddresses() and it address is pod address,but client not reconnect

while (retryTimeTmp < retryTimes) {
  try {
                return igniteClient.getOrCreateCache(new ClientCacheConfiguration()
                        .setName(cacheName)
                        .setAtomicityMode(TRANSACTIONAL)
                        .setCacheMode(PARTITIONED)
                        .setBackups(2)
                        .setWriteSynchronizationMode(PRIMARY_SYNC));
 }catch (Exception e) {
                LOGGER.error("get cache [{}] not success", cacheName, e);
                LOGGER.error("get address info [{}], ipfinder [{}]", clientConfiguration.getAddresses(), clientConfiguration.getAddressesFinder().getAddresses());

                retrySleep();
            } finally {
                retryTimeTmp++;
            }

Solution

  • https://github.com/apache/ignite/pull/10110.

    I pull request and fix this issue