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: Participants and service discovery
Date Fri, 02 Jan 2015 19:05:02 GMT
Hi Ricardo,

Happy New Year!.

I generally try to think of Helix along these lines.

STATES
 --- IDEALSTATE, CURRENT STATE, EXTERNAL VIEW
ROLES
-- PARTICIPANT, CONTROLLER, SPECTATOR

IDEALSTATE: the state we want the cluster to be in
CURRENT STATE:  Current stat of the cluster from a PARTICIPANT perspective
EXTERNAL VIEW:  Provides a VIEW across all CURRENT STATES. Generally used
by SPECTATOR.

Roles simply define the access privileges. All roles have read access to
all states.

PARTICIPANT: All read, Write CURRENT STATE
CONTROLLER:All read, All WRITE except CURRENT STATE
SPECTATOR: Only read.

So now coming to your question.

Participants do have a way to check if its the leader, the
stateModelFactory has this information.
statemodelfactory.getStateModel(partitionId).getCurrentState()


To access any other data in helix, you can use helixDataAccessor.

 HelixDataAccessor accessor = helixManager.getHelixDataAccessor();
 Builder keyBuilder = accessor.keyBuilder();
 List<String> liveInstanceNames =
_accessor.getChildNames(keyBuilder.liveInstances());

All data access can be done using the above template.

Regarding your last question.

-- We don't have any specific api for service discovery, we do have a
recipe. Service Discovery is generally needed for clients to access the
system. Helix refers to them as Spectators. Service Discovery in Helix is
as simple as reading the ExternalView of the system. Only additional
property that Spectator provides is that it caches the state of the system
and updates it only when there is a change. This ensures that we dont
bombard zookeeper for every read requests.

Hope that helps.

thanks,
Kishore G











On Fri, Jan 2, 2015 at 4:01 AM, Ricardo Ferreira <ricardojsfer@gmail.com>
wrote:

> Hello,
>
>
> I'm evaluating Helix as the backend framework for a project I'm starting.
> I was primarily using Curator, just to make it easier
> to deal with Zookeeper, but then I came across Helix and it seemed a very
> nice fit, with some overlaps with the API I was thinking of.
>
> However, I'm a bit confused and have a couple of questions.
>
> I've had no problems modelling a cluster, setting the participants,
> controllers and whatnot. Managing and querying the cluster
> is where I'm having a hard time. Don't participants have the sense of
> leadership? If so, is there a way to check if a participant is a leader?
> And how can I get a list of participants in a cluster? I can get a list of
> instances and resources, but not participants?
>
> Maybe I'm not yet grasping the goal of Helix, but I was thinking it would
> give me service discovery and leadership management through participants
> and controllers, yet service discovery
> has it's own API... why?
>
>
> Best regards,
>
> Ricardo
>

Mime
View raw message