Hello,

I think the NodeFilter was designed exactly for that case. Please take a
look at this method: CacheConfiguration#setNodeFilter() [1]

So, it can be used as follows:
 - for example, you can add a node attribute - "you-custom-attribute" that
can be used to determine the fact that a cache should be resided on the
given node or not.
 - create a cache with corresponding node filter as follows:

CacheConfiguration persConfig = new CacheConfiguration("persistent-cache")
    .setDataRegionName("persistent-region")
    .setNodeFilter(new IgnitePredicate<ClusterNode>() {
        @Override public boolean apply(ClusterNode node) {
            // check node's attribute, and return {@code true} if your
cache should reside on the given node.
            Boolean persistentNodeAttr =
node.attribute("your-custom-attribute");
            return (persistentNodeAttr != null &&
Boolean.TRUE.equals(persistentNodeAttr));
        }
    });

IgniteCache cache = ignite.getOrCreateCache(persConfig);

CacheConfiguration nonPersConfig = new
CacheConfiguration("non-persistent-cache")
    .setDataRegionName("non-persistent-region")
    .setNodeFilter(new IgnitePredicate<ClusterNode>() {
        @Override public boolean apply(ClusterNode node) {
            // check node's attribute, and return {@code true} if your
cache should reside on the given node.
            Boolean persistentNodeAttr =
node.attribute("your-custom-attribute");
            return (persistentNodeAttr != null &&
Boolean.FALSE.equals(persistentNodeAttr));
        }
    })
    .setCacheStoreFactory(...);

I hope that the main idea is clear.

[1]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/CacheConfiguration.html#setNodeFilter-org.apache.ignite.lang.IgnitePredicate-
[2]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/IgniteConfiguration.html#setUserAttributes-java.util.Map-

Thanks,
S.

чт, 12 июл. 2018 г. в 14:17, siva <siva.ka...@bizruntime.com>:

> Hi,
>
> we need to use both Native and Cache store persistence.
>
>
> Is it possible to devide nodes like only particular nodes need to store
> cache store data and other nodes need to store native persistence data.
>
> According to Baseline Topology
>
> Start the node normally(native persistnce disabled for this node). At this
> point:
>
> The cluster remains active.
> The new node joins the cluster, but it is not added to the baseline
> topology.
> The new node can be used to store data of caches/tables who do not use
> Ignite persistence.
> The new node cannot hold data of caches/tables who persist data in Ignite
> persistence.
> The new node can be used from computation standpoint (Ignite compute grid).
>
> I have followed as above ,but not storing the cache store data in the newly
> joined node.Its adding in baseline topology node and giving worning
>
> Both Ignite native persistence and CacheStore are configured for cache
> 'cacheStoresivacache'. This configuration does not guarantee strict
> consistency between CacheStore and Ignite data storage upon restarts.
> Consult documentation for more details.
>
>
>
>
> Thanks
> siva
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to