You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Stanislav Lukyanov <st...@gmail.com> on 2018/03/21 15:06:44 UTC

RE: Is backup copy always stored on different host - is it host-awarereplication

Hi,

To make sure that two nodes on the same host don’t have primary and backup versions of the same partition you can use
    cacheConfiguration.setAffinity(new RendezvousAffinityFunction(true));
See https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.html for details
(note the excludeNeighbors parameter).

Stan

From: Naveen
Sent: 21 марта 2018 г. 17:38
To: user@ignite.apache.org
Subject: Is backup copy always stored on different host - is it host-awarereplication

Hi 

Using ignite 2.3
When we use backup as 1, does it mean that backup copy is store in another
host 

Lets say, if we have cluster with 3 hosts H1, H2, H3, each host running 2
ignite nodes

H1 is holding the primary copy, backup copy should be on H2 or H3, it should
not be on H1, but on different node. 

Is it host-aware replication ??

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


RE: Is backup copy always stored on different host - is it host-awarereplication

Posted by Gaurav Bajaj <ga...@gmail.com>.
Hi Naveen,

 Also there is a way you control on which exact host backup be will be
created using Backupfilter :

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.html#setAffinityBackupFilter-org.apache.ignite.lang.IgniteBiPredicate-


Thanks,
Gaurav

On 22-Mar-2018 6:17 AM, "Naveen" <na...@gmail.com> wrote:

> Thanks Stan.
>
> I am creating the cache thru SQL DDL with below statement
>
> CREATE TABLE MAP_ASSOCIATED (PARTY_ID VARCHAR, ASSOCIATED_LIST VARCHAR,
> UPDATEDDATETIME TIMESTAMP, UPDATEDBY VARCHAR, PRIMARY KEY (PARTY_ID))WITH
> "template=partitioned,backups=1,cache_name=MAP_ASSOCIATED,
> value_type=com.ril.edif.model.MAP_ASSOCIATED";
>
> So how do I specify the cacheConfiguration.setAffinity(new
> RendezvousAffinityFunction(true))
>
> Objective is to keep the backup on different host
>
> Thanks
> Naveen
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Is backup copy always stored on different host - is ithost-awarereplication

Posted by Denis Magda <dm...@apache.org>.
Hi Naveen,

Taken from CREATE TABLE documentation - see Ignite.addCacheConfiguration
parameter


   - TEMPLATE=<cache's template name> - case-sensitive name of a cache
   template registered in Ignite to use as a configuration for the distributed
   cache that is deployed by the CREATE TABLE command. A template is an
   instance of the CacheConfiguration class registered with
   Ignite.addCacheConfiguration in the cluster. Use predefined
   TEMPLATE=PARTITIONED or TEMPLATE=REPLICATEDtemplates to create the cache
   with the corresponding replication mode. The rest of the parameters will be
   those that are defined in the CacheConfiguration object. By default,
   TEMPLATE=PARTITIONED is used if the template is not specified explicitly.

https://apacheignite-sql.readme.io/docs/create-table

On Mon, Apr 9, 2018 at 8:49 AM, Naveen <na...@gmail.com> wrote:

> Hi Stan
>
> I wanted to create a cache template with the below
>
>                 <bean id="EDIFCacheTemplate"
> class="org.apache.ignite.configuration.CacheConfiguration">
>                                 <property name="name" value="EDIFCache*"/>
>                                 <property name="cacheMode"
> value="PARTITIONED" />
>                                 <property name="backups" value="1" />
>                                 <property name="affinity">
>                                         <bean
> class="org.apache.ignite.cache.affinity.rendezvous.
> RendezvousAffinityFunction">
>                                                         <property
> name="excludeNeighbors" value="true"/>
>                                         </bean>
>                                         </property>
>                 </bean>
>
> How do I use this template while creating the cache, what is the property I
> should set
>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="AccountCache"/>
>
>
> Thanks
> Naveen
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

RE: Is backup copy always stored on different host - is ithost-awarereplication

Posted by Naveen <na...@gmail.com>.
Hi Stan

I wanted to create a cache template with the below

                <bean id="EDIFCacheTemplate"
class="org.apache.ignite.configuration.CacheConfiguration"> 
			        <property name="name" value="EDIFCache*"/> 
			        <property name="cacheMode" value="PARTITIONED" /> 
			        <property name="backups" value="1" /> 
				<property name="affinity">
					<bean
class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
							<property name="excludeNeighbors" value="true"/>
					</bean>
					</property>
		</bean> 

How do I use this template while creating the cache, what is the property I
should set

                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="AccountCache"/>


Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: Is backup copy always stored on different host - is ithost-awarereplication

Posted by Stanislav Lukyanov <st...@gmail.com>.
You need to create a cache template (a cache configuration with a name ending with a *),
and specify that in the CREATE TABLE.
To define a cache template:
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="excludeNeighbors*"/>
                    <property name="affinity">
                        <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
                            <property name="excludeNeighbors" value="true"/>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>

To use it in CREATE TABLE:
    CREATE TABLE FOO (...) WITH "template=excludeNeighbors";

Stan

From: Naveen
Sent: 22 марта 2018 г. 8:17
To: user@ignite.apache.org
Subject: RE: Is backup copy always stored on different host - is ithost-awarereplication

Thanks Stan.

I am creating the cache thru SQL DDL with below statement

CREATE TABLE MAP_ASSOCIATED (PARTY_ID VARCHAR, ASSOCIATED_LIST VARCHAR,
UPDATEDDATETIME TIMESTAMP, UPDATEDBY VARCHAR, PRIMARY KEY (PARTY_ID))WITH
"template=partitioned,backups=1,cache_name=MAP_ASSOCIATED,
value_type=com.ril.edif.model.MAP_ASSOCIATED";

So how do I specify the cacheConfiguration.setAffinity(new
RendezvousAffinityFunction(true))

Objective is to keep the backup on different host

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


RE: Is backup copy always stored on different host - is it host-awarereplication

Posted by Naveen <na...@gmail.com>.
Thanks Stan.

I am creating the cache thru SQL DDL with below statement

CREATE TABLE MAP_ASSOCIATED (PARTY_ID VARCHAR, ASSOCIATED_LIST VARCHAR,
UPDATEDDATETIME TIMESTAMP, UPDATEDBY VARCHAR, PRIMARY KEY (PARTY_ID))WITH
"template=partitioned,backups=1,cache_name=MAP_ASSOCIATED,
value_type=com.ril.edif.model.MAP_ASSOCIATED";

So how do I specify the cacheConfiguration.setAffinity(new
RendezvousAffinityFunction(true))

Objective is to keep the backup on different host

Thanks
Naveen



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/