Admin.rebalance method won’t invoke user rebalancer

The rebalancer is invoked when ever there is a change in the cluster such
as nodes added/started/stopped etc.

Also look for error message in the log as Lei suggested. Note the
controller should have access to the user defined rebalancer class

On Tue, Oct 9, 2018 at 9:46 AM Lei Xia <[email protected]> wrote:

> Hi, Rob
>
>   It seems your rebalancer class is not correctly linked into Helix lib,
> i.e, Helix can not find your rebalancer class at runtime.   Do you see some
> error log from Helix like: ""Exception while invoking custom rebalancer
> class:"?
>
> On Mon, Oct 8, 2018 at 5:37 AM Rob McKinnon <[email protected]>
> wrote:
>
>> I am working through the tutorial on the User-Defined Rebalancing and I
>> am not able to get my Rebalancer to be invoked.
>>
>> Sample Code
>> ======
>>
>> public static void main(String[] args) {
>>     ZKHelixAdmin admin = new ZKHelixAdmin(Conf.ZK_ADDRESS);
>>
>>     IdealState idealState = admin.getResourceIdealState(Conf.CLUSTER_NAME, 
>> Conf.RESOURCE_NAME);
>>     idealState.setRebalanceMode(IdealState.RebalanceMode.USER_DEFINED);
>>     idealState.setRebalancerClassName(MyRebalancer.class.getName());
>>     admin.setResourceIdealState(Conf.CLUSTER_NAME, Conf.RESOURCE_NAME, 
>> idealState);
>>
>>
>>     admin.rebalance(Conf.CLUSTER_NAME, RESOURCE_NAME, NUM_REPLICAS);
>> }
>>
>> ======
>> I was expecting that when calling the "admin.rebalance" method, it would
>> invoke "MyRebalance" code but when I run it "MyRebalance" code was not
>> invoked.
>>
>>
>> Thanks,
>>
>> Rob
>>
>
>
> --
> Lei Xia
>

Reply via email to