helix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kishore g <g.kish...@gmail.com>
Subject Re: Some newbie questions
Date Fri, 17 May 2013 07:40:10 GMT
Hi Alexandre,

You can get more control in AUTO mode, you are currently using
AUTO_REBALANCE where Helix decides who should be leader and where should it
be. If you look at Idealstate it basically looks like this.
p1:[]

In Auto mode you set the preference list for each partition
so you can set something like p1:[n1,n2,n3]

In this case if n1 is alive, helix will make n1 the leader n2 n3 will be
standby. If you want to make some one else leader, say n2 simply change
this to
p1:[n2,n3,n1].

Change this line in your code

admin.addResource( clusterName, lockGroupName, 1, "LeaderStandby",
IdealStateModeProperty.AUTO_REBALANCE.toString() );
admin.rebalance( clusterName, lockGroupName, numInstances );
to

admin.addResource( clusterName, lockGroupName, 1, "LeaderStandby",
IdealStateModeProperty.AUTO.toString() );
admin.rebalance( clusterName, lockGroupName, numInstances );


//  if you want to change the current leader, you can do the following.

idealState = admin.getResourceIdealState(String clusterName, String
resourceName);
List preferenceList; //set the newleader you want as the first entry
 idealState.getRecord().setListField(partitionName,preferenceList);

admin.addResource(String clusterName,String resourceName, IdealState idealstate)


Read more about the different execution modes
http://helix.incubator.apache.org/Concepts.html and
http://helix.incubator.apache.org/Features.html

Thanks,
Kishore G



On Thu, May 16, 2013 at 11:09 PM, Alexandre Porcelli <porcelli@redhat.com>wrote:

> Hello all,
>
>  Sorry to revamp this thread, but I think I'll have to ask again... is it
> possible to force, via an api call, a transition from Leader to "Wait"
> without disable an instance or partition? The transition from Leader to
> Offline triggered  by the disabled partition is causing me some troubles...
>  The main problem is that my transition from "Offline" to "Standby" syncs
> data with the rest of the cluster (an expensive task, that should be
> executed only if that node was really offline, in other words: there was a
> partition, the node crashed or whatever).
>
>  I predict that I may need build my own transition model... not sure (not
> even sure on how to do it and be able to control/expose that transition
> from Leader to "Wait")...
>
>  Well... any help/suggestion is really welcomed!
>
> Cheers,
> ---
> Alexandre Porcelli
> porcelli@redhat.com
>
> On May 2, 2013, at 2:26 PM, Alexandre Porcelli <porcelli@redhat.com>
> wrote:
>
> > Hi Vinayak,
> >
> >  You were right, all my mistake! Disabling the partition works like a
> charm! Thank you very much.
> >
> > Regards,
> > ---
> > Alexandre Porcelli
> > porcelli@redhat.com
> >
> > On May 2, 2013, at 1:22 PM, Vinayak Borkar <vinayakb@gmail.com> wrote:
> >
> >> Looking at the signature of HelixAdmin.enablePartition, I see this:
> >>
> >>  void enablePartition(boolean enabled,
> >>                       String clusterName,
> >>                       String instanceName,
> >>                       String resourceName,
> >>                       List<String> partitionNames);
> >>
> >>
> >>
> >> So when you disable the partition, you are doing so only on a
> perticular instance. So my understanding is that the same partition at
> other instances will participate in an election to come out of standby.
> >>
> >> Vinayak
> >>
> >>
> >> On 5/2/13 9:14 AM, Alexandre Porcelli wrote:
> >>> Hi Vinayak,
> >>>
> >>>  Thanks for your quick answer, but I don't think this would be the
> case... once the partition `represents` the locked resource, so If i
> disable it no other instance in the cluster will be able to be promoted to
> Leader (at this point other nodes should be in standby just waiting to be
> able to acquire the lock - in other words, become Leader).
> >>>  Anyway thanks for your support.
> >>>
> >>> Cheers,
> >>> ---
> >>> Alexandre Porcelli
> >>> porcelli@redhat.com
> >>>
> >>>
> >>> On May 2, 2013, at 1:06 PM, Vinayak Borkar <vinayakb@gmail.com> wrote:
> >>>
> >>>>>
> >>>>>  1. I'm using a LeaderStandby in order to build a single global
lock
> on my cluster, it works as expected.. but in order to release the lock I
> have to put the current leader in standby... I could achieve this by
> disabling the current instance. It works, but doing this I loose (at least
> seems to be) the ability to send/receive user defined messages. I'd like to
> know if it's possible to, via an api call, force a transition from Leader
> to Standby without disable an instance.
> >>>>
> >>>> I am a newbie to Helix too and I had a similar question a few days
> ago. Have you looked into disabling the resource by using the
> disablePartition() call in HelixAdmin using a partition number of 0? This
> should disable just the resource without impacting the instance.
> >>>>
> >>>> Vinayak
> >>>>
> >>>>>
> >>>>>  2. I've been taking a quick look on Helix codebase, more specific
> on ZooKeeper usage. Seems that you're using ZooKeeper as a default
> implementation, but Helix architecture is not tied to it, right? I'm asking
> this, because I'm interested to implement (in a near future) a different
> backend (Infinispan).
> >>>>>
> >>>>> That's it for now...  thanks in advance.
> >>>>>
> >>>>> Cheers,
> >>>>> ---
> >>>>> Alexandre Porcelli
> >>>>> porcelli@redhat.com
> >>>>>
> >>>>
> >>>
> >>>
> >>
> >
>
>

Mime
View raw message