Hi Michael,

As I see from your configuration you are going to have cluster with two
ignite servers and PARTITIONED cache.

You can't choose directly on what node will be stored your cache entities
because ignite will use its own affinity function that will maps keys to
partitions (not nodes).

In this case data from your cache could be stored on both nodes.

What you can to do:

1)Create two caches and setup the node filters for them:

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/CacheConfiguration.html#setNodeFilter-org.apache.ignite.lang.IgnitePredicate-

2)Ignite can try to give you guarantee that entities calculated on Node A
will be stored on one node and entities calculated on node B will be stored
on another. But there is no guarantee that it will be the same nodes where
it was calculated. setup your own AffinityKey. For example something like
that:

    public static class EntityKey {
        public EntityKey(String id, long nodeId) {
            this.id = id;
            this.nodeId = nodeId;
        }

        private String id;

        // Subscriber ID which will be used for affinity.
        @AffinityKeyMapped
        private long nodeId;

        public long getNodeId() {
            return nodeId;
        }

        public String getId() {
            return id;
        }

    }

After that use it as follow:

        IgniteCache<EntityKey, HosCache > cache =
ignite.getOrCreateCache(cfg);

        cache.putIfAbsent( new EntityKey(hid, 0), monthValues ) //from node
A
        cache.putIfAbsent( new EntityKey(hid, 1), monthValues ) //from node
B

Thanks,
Andrei








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

Reply via email to