【问题标题】:Apache Ignite Thin Client is not connect to AKSApache Ignite 瘦客户端未连接到 AKS
【发布时间】:2021-10-04 23:25:36
【问题描述】:

我创建了一个 AKS,并在其上部署了 Apache Ignite 服务。 当我检查 pod 时,我可以看到它们正在工作。

另外,我可以获得负载均衡器的 IP。

我按照 Apache 的官方说明尝试将 Ignite 与 ThinClient 连接。 我分享我的代码和指令代码。

这是我的代码:

public void ConnectIgnite()
{
    var cfg = new IgniteClientConfiguration
    {
       Endpoints = new[] { "20.101.12.***:10800" }
    };
    
    var client = Ignition.StartClient(cfg);
}

但我的代码出现以下错误;

System.AggregateException: '未能建立 Ignite 瘦客户端 连接,检查内部异常以了解详细信息。'

内部异常 ExtendedSocketException:连接尝试失败 因为连接方在一段时间后没有正确响应 时间,或建立连接失败,因为连接的主机有 没有回应。

这是Apache的指令代码;

ClientConfiguration cfg = new ClientConfiguration().setAddresses("13.86.186.145:10800");
IgniteClient client = Ignition.startClient(cfg);

ClientCache<Integer, String> cache = client.getOrCreateCache("test_cache");

cache.put(1, "first test value");

System.out.println(cache.get(1));

client.close();

另外,这里是官方说明link

我不明白这是怎么回事?此外,该指令说我不需要 clientid 和 clientsecret,但我不想在没有任何安全性的情况下进行连接,但这完全是另一个问题。

【问题讨论】:

    标签: azure kubernetes ignite azure-aks


    【解决方案1】:

    尝试从外部使用20.101.12.*** 地址进行连接。 顺便说一句,13.86.186.145 是什么,你为什么要连接它?

    更新: 好像您只是从文档中复制粘贴它,您需要将其替换为您自己的值。

    【讨论】:

    • 另外,如果您只是使用 Ignite 进行测试,您可能会使用 GridGain Operator,根据我的经验,它可以大大简化安装gridgain.com/docs/latest/installation-guide/operator/…
    • 我没有连接到 13.86.186.145。该代码是 apache 的示例代码。我的在上面。我的 IP 以 20 开头
    • 嗨,Alexandr,我回答了这个问题。你能检查一下,如果它是正确的,请投票。
    • 嗨,是的,必须有一些简单的东西,我认为你是对的。
    • 顺便说一句,我在想作者可以用绿色按钮将其标记为正确。
    【解决方案2】:

    我发现了问题所在。 Apache的官方页面说:使用下面的XML进行配置。

    <bean class="org.apache.ignite.configuration.IgniteConfiguration">
    
        <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>
    </bean>
    

    但是,

    首先,XML 需要在 XML 顶部有一个 beans 标记。 此外,namespace 值和 serviceName 值与 apache 的官方说明页面不兼容。如果您按照 apache 的页面进行设置;

    您必须使用以下值

    <property name="namespace" value="ignite" />
    <property name="serviceName" value="ignite-service" />
    

    而不是

    <property name="namespace" value="default" />
    <property name="serviceName" value="ignite" />
    

    你的 XML 的变化结束

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd">
        <bean class="org.apache.ignite.configuration.IgniteConfiguration">
            <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="ignite" />
                                    <property name="serviceName" value="ignite-service" />
                                </bean>
                            </constructor-arg>
                        </bean>
                    </property>
                </bean>
            </property>
        </bean>
    </beans>
    

    我更改了我的配置 XML 并使用以下命令重新启动 pod,它工作正常。

    kubectl -n service rollout restart deployment ignite-cluster
    

    【讨论】:

      猜你喜欢
      • 2021-05-23
      • 2019-07-20
      • 2020-06-21
      • 2020-02-14
      • 2019-11-09
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      相关资源
      最近更新 更多