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: Leader election - Distributed lock manager
Date Sun, 12 May 2013 16:57:44 GMT
Hi Erwin,

Thanks for looking into Helix. In Helix, most of the time the only
configuration needed is the zookeeper address and cluster name. This is the
code you can use to contact a server.

//in the server A code at start up
final RoutingTableProvider routingTable = new RoutingTableProvider();
//Default Externalview implementation
manager = HelixManagerFactory.getZKHelixManager(clusterName, instanceName,
InstanceType.SPECTATOR, zkConnectString)
manager.connect();
manager.addExternalViewChangeListener(routingTable)


//Any time you want to talk to servers B
//you can get a instances for a specific resource, partition in
specific state. e.g getInstances("LockGroup", "lockGroup_0",
"LEADER");
List<InstanceConfig> instances = getInstances(String resourceName,
String partitionName, String state)

//Get all instances in given resource in a specific state e.g
getInstances("LockGroup", "LEADER");
Set<InstanceConfig> instances = getInstances(String resource, String state)


InstanceConfig can give you all details about the server like host, port or
anything else you want to add.

Hope this helps. Thanks for bringing this up, we need to add an example
code for this.

Thanks,
Kishore G

On Sun, May 12, 2013 at 9:00 AM, Erwin Karbasi <erwin@optinity.com> wrote:

>
> Hello Masters,
>
> We'd like to use Helix for Leader Election mechanism.
> Following our scenario:
>
> We have one server (server A) that need to connect to group of other
> servers (server B).
> How server A can access the server B's group - cluster.
>
> As I know from other cluster frameworks, we can concatenate multiple
> server ip:port and the cluster will pass the requests to the leader process
> that in the cluster.
>
> How above scenario could be implemented by using Helix leader election
> (Distributed lock manage) as demonstrated here:
> http://helix.incubator.apache.org/recipes/lock_manager.html
>
> Your insight would be highly appreciated.
>
> Thanks,
> Erwin Karbasi <ek128b@att.com>
> AT&T, Senior Software Architect
>
>

Mime
View raw message