ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ght230 <ght...@163.com>
Subject How to set isolated Ignite Clusters
Date Thu, 07 Jul 2016 14:01:14 GMT
I need to start two isolated Ignite clusters on the same machine.

I followed the guide about "Isolated Ignite Clusters on the Same Set of
Machines", but it does not work.

Ignite1 and ignite2 seems not isolated, they are connected.

The 1000 records are saved in both ignite1 and ignite2, but not only in
ignite1.

Anything wrong about my test?

Following is my test code. 


public class Test {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Ignition.setClientMode(true);
		Ignite ignite1 = Ignition.start("resources/Isolated1.xml");
		IgniteCache<Integer, String> cache1 =
ignite1.getOrCreateCache("myCache1");
		
	    for (int i = 0; i < 1000; i++)
	        cache1.put(i, Integer.toString(i));
			
		Ignite ignite2 = Ignition.start("resources/Isolated2.xml");
	}
}

Isolated1.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 id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        
        <property name="gridName" value="myGrid1"/>
        <property name="clientMode" value="false"/>
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
				
				<property name="localPort" value="48500"/>
				
				<property name="localPortRange" value="20"/>
                <property name="ipFinder">
                    
                    
                    
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <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>
</beans>

Isolated2.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 id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        
        <property name="gridName" value="myGrid2"/>
        <property name="clientMode" value="false"/>
        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
				
				<property name="localPort" value="49500"/>
				
				<property name="localPortRange" value="20"/>
                <property name="ipFinder">
                    
                    
                    
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                
                                <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>
</beans>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-set-isolated-Ignite-Clusters-tp6151.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message