在 2 节点集群中启动 Ignite 缓存需要帮助

Need help on starting the Ignite cache in 2 node cluster

我是 Ignite 的新手,正在尝试利用 Ignite 设置内存缓存。我做了一些基本配置,并在单个节点上启动了基于 Ignite 的可插拔持久性工作。现在,我计划测试 2 节点集群的性能并按照以下设置点燃配置:

<?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 id="countryCacheStoreFactory" class="javax.cache.configuration.FactoryBuilder" factory-method="factoryOf">
<constructor-arg><value>com.xyz.exploreignite.cache.CustomCacheStore</value></constructor-arg>
</bean>

<bean id="stateCacheStoreFactory" class="javax.cache.configuration.FactoryBuilder" factory-method="factoryOf">
<constructor-arg><value>com.xyz.exploreignite.cache.CustomStateCacheStore</value></constructor-arg>
</bean>

<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="peerClassLoadingEnabled" value="false"/>
<property name="clientMode" value="true"/>
<property name="gridName" value="clusterGrid"/>
    <property name="cacheConfiguration">
        <list>
            <!-- Partitioned cache example configuration (Atomic mode). -->
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="atomicityMode" value="ATOMIC"/>
                <property name="backups" value="1"/>
                <property name="name" value="customCountryCache"/>
                <property name="readThrough" value="true"/>
                <property name="writeThrough" value="true"/>
                <property name="cacheMode" value="PARTITIONED"/>
                <property name="writeBehindEnabled" value="true"/>
                <property name="copyOnRead" value="true"/>
                <property name="memoryMode" value="OFFHEAP_TIERED"/>
                <property name="atomicWriteOrderMode" value="PRIMARY"/>
                <property name="indexedTypes" >
        <list>
            <value>java.lang.Integer</value>
            <value>com.xyz.exploreignite.pojo.Country</value>
        </list>
        </property>
        <!-- Cache store. -->
        <property name="cacheStoreFactory" ref="countryCacheStoreFactory"/>
            </bean>
    <bean class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="atomicityMode" value="ATOMIC"/>
                <property name="backups" value="1"/>
                <property name="name" value="customStateCache"/>
                <property name="readThrough" value="true"/>
                <property name="writeThrough" value="true"/>
                <property name="cacheMode" value="PARTITIONED"/>
                <property name="writeBehindEnabled" value="true"/>
                <property name="copyOnRead" value="true"/>
                <property name="memoryMode" value="OFFHEAP_TIERED"/>
                <property name="atomicWriteOrderMode" value="PRIMARY"/>
                <property name="indexedTypes" >
        <list>
            <value>java.lang.Integer</value>
            <value>com.xyz.exploreignite.pojo.State</value>
        </list>
        </property>
        <!-- Cache store. -->
        <property name="cacheStoreFactory" ref="stateCacheStoreFactory"/>
            </bean>
        </list>
    </property>


    <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <property name="ipFinder">
                <!--
                    Ignite provides several options for automatic discovery that can be used
                    instead os static IP based discovery. For information on all options refer
                    to our documentation: http://apacheignite.readme.io/docs/cluster-config
                -->
                <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
                    <property name="addresses">
                        <list>
                            <value>127.0.0.1:47500..47509</value>
                            <value>172.26.49.1:47500..47509</value>
                            <!-- In distributed environment, replace with actual host IP address. -->
                            <value>172.26.49.2:47500..47509</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
</bean>

现在,当在两个节点上使用 "bin/ignite.sh " 启动 ignite 时,它​​显示无法连接到服务器。虽然 运行 只有 "bin/ignite.sh" 与上面的并行,但两个单独的 ignite 配置实例都以独立模式启动,只有 1 个客户端。我需要让他们都使用共享实例。请在我的 deployment/execution.

中提出可能的问题

尝试从发现配置中删除 <value>127.0.0.1:47500..47509</value> 行。它对分布式集群没有多大帮助。

该配置在 <property name="clientMode" value="true"/> 您需要至少将一个节点设置为 <property name="clientMode" value="false"/> 否则您的客户端将无法连接任何服务器节点。