You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Kamal C <ka...@gmail.com> on 2016/02/29 10:00:13 UTC

IgniteCache: How to receive Load Re-balance notifications?

Hi,

    I have a replicated ignite cache with 3 nodes. I want to listen for
data rebalance notifications in all the nodes whenever a new node joined /
left the cluster.

Using Ignite Events, I'd tried to register for cache re-balance
notifications. But, I'm unable to receive any notifications.

CacheConfiguration<String, Integer> cacheCfg = new
CacheConfiguration<>("cache_name");
cacheCfg.setCacheMode(CacheMode.REPLICATED);


IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);

ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
    new IgnitePredicate<CacheRebalanacingEvent>() {

    private static final long serialVersionUID = 1L;

                    @Override
                    public boolean apply(CacheRebalanacingEvent e)
                    {
                        if(e.cacheName.equals("cache_name")) {
                            logger.info("Received rebalancing Event : {}",
e);
                        }
                        return true;
                    }
                }, EventType.EVTS_CACHE_REBALANCE);




*In logs,* WARN [2016-02-29 13:01:31,661] [main] (Log4JLogger.java:480) -
Added listener for disabled event type: CACHE_REBALANCE_STARTED
 WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_STOPPED
 WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_PART_LOADED
 WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
 WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
 WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
 WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST


How to receive REBALANCE_STOPPED notification ?

--
Kamal

Re: IgniteCache: How to receive Load Re-balance notifications?

Posted by vkulichenko <va...@gmail.com>.
Hi Kamal,

Can you please elaborate more on your use case? Why do you need to listen to
these events and what are you trying to achieve?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/IgniteCache-How-to-receive-Load-Re-balance-notifications-tp3241p3318.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: IgniteCache: How to receive Load Re-balance notifications?

Posted by Kamal C <ka...@gmail.com>.
Pavel,

I'd like to receive notifications when a node left / joined the cluster.

Gone through discovery notifications. But, In my application it would be
more appropriate to receive notification after re-balance / a backup
partition in a node becomes primary.

On Tue, Mar 1, 2016 at 9:36 PM, Pavel Tupitsyn <pt...@gridgain.com>
wrote:

> Kamal,
>
> In replicated mode all data is already on every node, so there is no need
> to rebalance.
> http://apacheignite.gridgain.org/docs/cache-modes
>
> On Tue, Mar 1, 2016 at 6:58 PM, Kamal C <ka...@gmail.com> wrote:
>
>> Vladimir,
>>
>> I had included the re-balance event types in *example-default.xml. *I'm
>> able to receive REBALANCE notifications when cache mode is set to
>> partitioned.
>>
>> Does re-balancing won't trigger when cache mode is replicated ?
>>
>> --
>> Kamal
>> On 29-Feb-2016 7:07 PM, "Vladimir Ozerov" <vo...@gridgain.com> wrote:
>>
>>> Kamal,
>>>
>>> You should enable these event type in configuration. See IgniteConfiguration.setIncludeEventTypes(int
>>> ...) method.
>>>
>>> Vladimir.
>>>
>>> On Mon, Feb 29, 2016 at 12:00 PM, Kamal C <ka...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>>     I have a replicated ignite cache with 3 nodes. I want to listen for
>>>> data rebalance notifications in all the nodes whenever a new node joined /
>>>> left the cluster.
>>>>
>>>> Using Ignite Events, I'd tried to register for cache re-balance
>>>> notifications. But, I'm unable to receive any notifications.
>>>>
>>>> CacheConfiguration<String, Integer> cacheCfg = new
>>>> CacheConfiguration<>("cache_name");
>>>> cacheCfg.setCacheMode(CacheMode.REPLICATED);
>>>>
>>>>
>>>> IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);
>>>>
>>>> ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
>>>>     new IgnitePredicate<CacheRebalanacingEvent>() {
>>>>
>>>>     private static final long serialVersionUID = 1L;
>>>>
>>>>                     @Override
>>>>                     public boolean apply(CacheRebalanacingEvent e)
>>>>                     {
>>>>                         if(e.cacheName.equals("cache_name")) {
>>>>                             logger.info("Received rebalancing Event :
>>>> {}", e);
>>>>                         }
>>>>                         return true;
>>>>                     }
>>>>                 }, EventType.EVTS_CACHE_REBALANCE);
>>>>
>>>>
>>>>
>>>>
>>>> *In logs,* WARN [2016-02-29 13:01:31,661] [main]
>>>> (Log4JLogger.java:480) - Added listener for disabled event type:
>>>> CACHE_REBALANCE_STARTED
>>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_STOPPED
>>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_PART_LOADED
>>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
>>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
>>>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
>>>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>>>> listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST
>>>>
>>>>
>>>> How to receive REBALANCE_STOPPED notification ?
>>>>
>>>> --
>>>> Kamal
>>>>
>>>>
>>>
>

Re: IgniteCache: How to receive Load Re-balance notifications?

Posted by Pavel Tupitsyn <pt...@gridgain.com>.
Kamal,

In replicated mode all data is already on every node, so there is no need
to rebalance.
http://apacheignite.gridgain.org/docs/cache-modes

On Tue, Mar 1, 2016 at 6:58 PM, Kamal C <ka...@gmail.com> wrote:

> Vladimir,
>
> I had included the re-balance event types in *example-default.xml. *I'm
> able to receive REBALANCE notifications when cache mode is set to
> partitioned.
>
> Does re-balancing won't trigger when cache mode is replicated ?
>
> --
> Kamal
> On 29-Feb-2016 7:07 PM, "Vladimir Ozerov" <vo...@gridgain.com> wrote:
>
>> Kamal,
>>
>> You should enable these event type in configuration. See IgniteConfiguration.setIncludeEventTypes(int
>> ...) method.
>>
>> Vladimir.
>>
>> On Mon, Feb 29, 2016 at 12:00 PM, Kamal C <ka...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>>     I have a replicated ignite cache with 3 nodes. I want to listen for
>>> data rebalance notifications in all the nodes whenever a new node joined /
>>> left the cluster.
>>>
>>> Using Ignite Events, I'd tried to register for cache re-balance
>>> notifications. But, I'm unable to receive any notifications.
>>>
>>> CacheConfiguration<String, Integer> cacheCfg = new
>>> CacheConfiguration<>("cache_name");
>>> cacheCfg.setCacheMode(CacheMode.REPLICATED);
>>>
>>>
>>> IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);
>>>
>>> ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
>>>     new IgnitePredicate<CacheRebalanacingEvent>() {
>>>
>>>     private static final long serialVersionUID = 1L;
>>>
>>>                     @Override
>>>                     public boolean apply(CacheRebalanacingEvent e)
>>>                     {
>>>                         if(e.cacheName.equals("cache_name")) {
>>>                             logger.info("Received rebalancing Event :
>>> {}", e);
>>>                         }
>>>                         return true;
>>>                     }
>>>                 }, EventType.EVTS_CACHE_REBALANCE);
>>>
>>>
>>>
>>>
>>> *In logs,* WARN [2016-02-29 13:01:31,661] [main] (Log4JLogger.java:480)
>>> - Added listener for disabled event type: CACHE_REBALANCE_STARTED
>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_STOPPED
>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_PART_LOADED
>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
>>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
>>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
>>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>>> listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST
>>>
>>>
>>> How to receive REBALANCE_STOPPED notification ?
>>>
>>> --
>>> Kamal
>>>
>>>
>>

Re: IgniteCache: How to receive Load Re-balance notifications?

Posted by Kamal C <ka...@gmail.com>.
Vladimir,

I had included the re-balance event types in *example-default.xml. *I'm
able to receive REBALANCE notifications when cache mode is set to
partitioned.

Does re-balancing won't trigger when cache mode is replicated ?

--
Kamal
On 29-Feb-2016 7:07 PM, "Vladimir Ozerov" <vo...@gridgain.com> wrote:

> Kamal,
>
> You should enable these event type in configuration. See IgniteConfiguration.setIncludeEventTypes(int
> ...) method.
>
> Vladimir.
>
> On Mon, Feb 29, 2016 at 12:00 PM, Kamal C <ka...@gmail.com> wrote:
>
>> Hi,
>>
>>     I have a replicated ignite cache with 3 nodes. I want to listen for
>> data rebalance notifications in all the nodes whenever a new node joined /
>> left the cluster.
>>
>> Using Ignite Events, I'd tried to register for cache re-balance
>> notifications. But, I'm unable to receive any notifications.
>>
>> CacheConfiguration<String, Integer> cacheCfg = new
>> CacheConfiguration<>("cache_name");
>> cacheCfg.setCacheMode(CacheMode.REPLICATED);
>>
>>
>> IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);
>>
>> ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
>>     new IgnitePredicate<CacheRebalanacingEvent>() {
>>
>>     private static final long serialVersionUID = 1L;
>>
>>                     @Override
>>                     public boolean apply(CacheRebalanacingEvent e)
>>                     {
>>                         if(e.cacheName.equals("cache_name")) {
>>                             logger.info("Received rebalancing Event :
>> {}", e);
>>                         }
>>                         return true;
>>                     }
>>                 }, EventType.EVTS_CACHE_REBALANCE);
>>
>>
>>
>>
>> *In logs,* WARN [2016-02-29 13:01:31,661] [main] (Log4JLogger.java:480)
>> - Added listener for disabled event type: CACHE_REBALANCE_STARTED
>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_STOPPED
>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_PART_LOADED
>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
>>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
>>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
>> listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST
>>
>>
>> How to receive REBALANCE_STOPPED notification ?
>>
>> --
>> Kamal
>>
>>
>

Re: IgniteCache: How to receive Load Re-balance notifications?

Posted by Vladimir Ozerov <vo...@gridgain.com>.
Kamal,

You should enable these event type in configuration. See
IgniteConfiguration.setIncludeEventTypes(int
...) method.

Vladimir.

On Mon, Feb 29, 2016 at 12:00 PM, Kamal C <ka...@gmail.com> wrote:

> Hi,
>
>     I have a replicated ignite cache with 3 nodes. I want to listen for
> data rebalance notifications in all the nodes whenever a new node joined /
> left the cluster.
>
> Using Ignite Events, I'd tried to register for cache re-balance
> notifications. But, I'm unable to receive any notifications.
>
> CacheConfiguration<String, Integer> cacheCfg = new
> CacheConfiguration<>("cache_name");
> cacheCfg.setCacheMode(CacheMode.REPLICATED);
>
>
> IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);
>
> ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
>     new IgnitePredicate<CacheRebalanacingEvent>() {
>
>     private static final long serialVersionUID = 1L;
>
>                     @Override
>                     public boolean apply(CacheRebalanacingEvent e)
>                     {
>                         if(e.cacheName.equals("cache_name")) {
>                             logger.info("Received rebalancing Event :
> {}", e);
>                         }
>                         return true;
>                     }
>                 }, EventType.EVTS_CACHE_REBALANCE);
>
>
>
>
> *In logs,* WARN [2016-02-29 13:01:31,661] [main] (Log4JLogger.java:480) -
> Added listener for disabled event type: CACHE_REBALANCE_STARTED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_STOPPED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_LOADED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST
>
>
> How to receive REBALANCE_STOPPED notification ?
>
> --
> Kamal
>
>