0
votes

I have 2 cluster and cluster 1 has a cache named "cache1" and it has some datas

What I want, when client connect cluster 2, and when it says igniteCache.getOrCreateCache("cache1"), it should return the cache that I have created in cluster 1, and also client should able to CRUD operation in cluster 2 which will update caches in both cluster 1 and cluster 2.

(From my research I can use Apache Ignite Native Persistence here is the link http://frommyworkshop.blogspot.com/2017/09/the-apache-ignite-native-persistence.html)

I can use Postgresql with Ignite Persistence ? or I should find another solution. (Especially I am looking for an answer about ignite features)

No cache configuration in both xml files but assume that it will be

Here is the my cluster 1 configuration

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:util="http://www.springframework.org/schema/util"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util.xsd">


    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <!--set the cluster name-->
        <property name="igniteInstanceName" value="FirstCluster"/>
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <!--Initial local port to listen-->
                <property name="localPort" value="48500"/>
                <!--determine local port range-->
                <property name="localPortRange" value="20"/>

                <!--Set the ip finder-->
                <property name="ipFinder">
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                <value>127.0.0.1:48500..48520</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
        <property name="communicationSpi">

            <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">

                <property name="localPort" value="48100"/>

            </bean>

        </property>
    </bean>

Here is the my cluster 2 configuration

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:util="http://www.springframework.org/schema/util"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/util
    http://www.springframework.org/schema/util/spring-util.xsd">



<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <!--set the cluster name-->
    <property name="igniteInstanceName" value="SecondCluster"/>

    <!-- Enabling Apache Ignite Persistent Store. -->
    <!--<property name="dataStorageConfiguration">-->
        <!--<bean class="org.apache.ignite.configuration.DataStorageConfiguration">-->
            <!--<property name="defaultDataRegionConfiguration">-->
                <!--<bean class="org.apache.ignite.configuration.DataRegionConfiguration">-->
                    <!--<property name="persistenceEnabled" value="true"/>-->
                <!--</bean>-->
            <!--</property>-->
        <!--</bean>-->
    <!--</property>-->
    <property name="discoverySpi">
        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
            <!-- Initial local port to listen to. -->
            <property name="localPort" value="49500"/>
            <!-- Changing local port range. This is an optional action. -->
            <property name="localPortRange" value="20"/>
            <!-- Setting up IP finder for this cluster -->
            <property name="ipFinder">
                <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                    <property name="addresses">
                        <list>
                            <!--
                                Addresses and port range of the nodes from the second
                                cluster.
                                127.0.0.1 can be replaced with actual IP addresses or
                                host names. Port range is optional.
                            -->
                            <value>127.0.0.1:49500..49520</value>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </property>
    <property name="communicationSpi">
        <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
            <property name="localPort" value="49100"/>
        </bean>
    </property>
</bean>

1

1 Answers

0
votes

GridGain, which is built upon Apache Ignite, has Datacenter Replication feature.

Otherwise, it's up to you to implement that. You basically have three choices:

  • Cluster 2 uses custom CacheStore to pull data from Cluster 1.
  • Cluster 1 uses ContinuousQuery to push updates to Cluster 2.
  • Both Cluster 1 and 2 use JDBC CacheStore to pull data from the same source (such as PostgreSQL).