我们有一个c#胖客户端,需要修改它来连接Kubernetes中的Apache Ignite集群节点。c#胖客户端将在Kubernetes之外的Windows机器上运行。我们可以使用spring.xml配置中定义的TcpDiscoveryKubernetesIpFinder或使用任何其他方法来实现这一点吗?
在c#厚客户端访问负载均衡器ip和发现端口时出现以下错误,
[19:34:13,884][WARNING][exchange-worker-#49][TcpCommunicationSpi] Connection timed out (will stop attempts to perform the connect) [node=4dccb2bb-3258-4950-9ca2-1661c6e218cd, connTimeoutStgy=ExponentialBackoffTimeoutStrategy [maxTimeout=600000, totalTimeout=10000, startNanos=30095071382900, currTimeout=16000], failureDetectionTimeoutEnabled=true, timeout=2214, err=null, addr=/10.1.0.12:47100]
[19:34:23,913][WARNING][exchange-worker-#49][TcpCommunicationSpi] Handshake timed out (will stop attempts to perform the handshake) [node=4dccb2bb-3258-4950-9ca2-1661c6e218cd, connTimeoutStrategy=ExponentialBackoffTimeoutStrategy [maxTimeout=600000, totalTimeout=10000, startNanos=30105090262900, currTimeout=16000], err=Failed to perform handshake due to timeout (consider increasing 'connectionTimeout' configuration property)., addr=/127.0.0.1:47100, failureDetectionTimeoutEnabled=true, timeout=2447]
[19:34:23,934][SEVERE][exchange-worker-#49][TcpCommunicationSpi] Failed to send message to remote node [node=TcpDiscoveryNode [id=4dccb2bb-3258-4950-9ca2-1661c6e218cd, consistentId=d435cb01-c152-489c-81a8-f3112cdc503c, addrs=ArrayList [10.1.0.12, 127.0.0.1], sockAddrs=HashSet [/10.1.0.12:47500, /127.0.0.1:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1651673041762, loc=false, ver=2.12.0#20220108-sha1:b1289f75, isClient=false], msg=GridIoMessage [plc=2, topic=TOPIC_CACHE, topicOrd=8, ordered=false, timeout=0, skipOnTimeout=false, msg=GridDhtPartitionsSingleMessage [parts=null, partCntrs=null, partsSizes=null, partHistCntrs=null, err=null, client=true, exchangeStartTime=1651673043426, finishMsg=null, super=GridDhtPartitionsAbstractMessage [exchId=GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=48, minorTopVer=0], discoEvt=DiscoveryEvent [evtNode=TcpDiscoveryNode [id=ca495ae9-b59f-4c9e-863b-2fbb34bb8907, consistentId=ca495ae9-b59f-4c9e-863b-2fbb34bb8907, addrs=ArrayList [0:0:0:0:0:0:0:1, 10.68.137.15, 127.0.0.1], sockAddrs=HashSet [/0:0:0:0:0:0:0:1:0, /127.0.0.1:0, hostname/10.68.137.15:0], discPort=0, order=48, intOrder=0, lastExchangeTime=1651673041420, loc=true, ver=2.12.0#20220108-sha1:b1289f75, isClient=true], topVer=48, msgTemplate=null, span=org.apache.ignite.internal.processors.tracing.NoopSpan@3b224e, nodeId8=ca495ae9, msg=null, type=NODE_JOINED, tstamp=1651673043393], nodeId=ca495ae9, evt=NODE_JOINED], lastVer=GridCacheVersion [topVer=0, order=1651673038156, nodeOrder=0], super=GridCacheMessage [msgId=1, depInfo=null, lastAffChangedTopVer=AffinityTopologyVersion [topVer=-1, minorTopVer=0], err=null, skipPrepare=false]]]]]
class org.apache.ignite.IgniteCheckedException: Failed to connect to node (is node still alive?). Make sure that each ComputeTask and cache Transaction has a timeout set in order to prevent parties from waiting forever in case of network issues [nodeId=4dccb2bb-3258-4950-9ca2-1661c6e218cd, addrs=[/10.1.0.12:47100, /127.0.0.1:47100]]
at org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper.createNioSession(GridNioServerWrapper.java:605)
at org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper.createTcpClient(GridNioServerWrapper.java:693)
at org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.createTcpClient(TcpCommunicationSpi.java:1264)
下面是配置,
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="true"/>
<property name="failureDetectionTimeout" value="10000"/>
<property name="networkTimeout" value="10000"/>
<property name="clientFailureDetectionTimeout" value="30000"/>
<property name="clientConnectorConfiguration">
<bean class="org.apache.ignite.configuration.ClientConnectorConfiguration">
<property name="host" value="127.0.0.1"/>
<property name="port" value="47500"/>
</bean>
</property>
<property name="communicationSpi">
<bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
<property name="forceClientToServerConnections" value="true"/>
</bean>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>localhost:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
由于该厚客户端部署在Kubernetes之外,因此它无法访问k8s服务。您需要显式地为该客户端指定外部节点地址。
另外,按照这里的描述设置forceClientToServerConnections=true
选项。