IgniteCache: How to receive Load Re-balance notifications?

classic Classic list List threaded Threaded
6 messages Options
Kamal Kamal
Reply | Threaded
Open this post in threaded view
|

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

Vladimir Ozerov Vladimir Ozerov
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]> 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


Kamal Kamal
Reply | Threaded
Open this post in threaded view
|

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

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" <[hidden email]> 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 <[hidden email]> 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


Pavel Tupitsyn Pavel Tupitsyn
Reply | Threaded
Open this post in threaded view
|

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

Kamal,

In replicated mode all data is already on every node, so there is no need to rebalance.

On Tue, Mar 1, 2016 at 6:58 PM, Kamal C <[hidden email]> 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" <[hidden email]> 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 <[hidden email]> 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



Kamal Kamal
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]> wrote:
Kamal,

In replicated mode all data is already on every node, so there is no need to rebalance.

On Tue, Mar 1, 2016 at 6:58 PM, Kamal C <[hidden email]> 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" <[hidden email]> 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 <[hidden email]> 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




vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

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

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