Re: Java detector for mess masters and leader

2015-07-09 Thread Nikolaos Ballas neXus
Subject: Re: Java detector for mess masters and leader @ Nicolaos I really don’t think that will work. When you use this code, it creates a node under /mesos named like: _c_e7007a30-1eaf-4826-bb99-011e8a33ac111-lock-99 because it is gaining leadership. It does not create nodes like mesos

Re: Java detector for mess masters and leader

2015-07-08 Thread Nikolaos Ballas neXus
Don…the bellow code will return leader node for mesos marathon framework. import … public class SomeClass { CuratorFramework client; public void init(){ client = CuratorFrameworkFactory.newClient(connectionString, new ExponentialBackoffRetry(1000, 3)) } public String

Re: Java detector for mess masters and leader

2015-07-08 Thread Donald Laidlaw
@Nikolaos Ballas neXus I can see no way to instantiate the Curator LeaderSelector without actually becoming a participant in leader election. If I do instantiate that class, it does not accept a null value for the LeaderSelectorListener and so anything instantiating LeaderSelector must also

Re: Java detector for mess masters and leader

2015-07-08 Thread Ken Sipe
awesome sharing of code! I’ll add that if you are using Mesos-DNS, that the dns name master.mesos will resolve to the masters and leader.mesos will resolve to the leader. if you are looking to resolve to marathon leader you would have to use the code below against zk at the moment. - ken On

Re: Java detector for mess masters and leader

2015-07-08 Thread Donald Laidlaw
@ Nicolaos I really don’t think that will work. When you use this code, it creates a node under /mesos named like: _c_e7007a30-1eaf-4826-bb99-011e8a33ac111-lock-99 because it is gaining leadership. It does not create nodes like mesos does, with names like info_000123. It therefore

RE: Java detector for mess masters and leader

2015-07-08 Thread Nikolaos Ballas neXus
for mess masters and leader @ Nicolaos I really don't think that will work. When you use this code, it creates a node under /mesos named like: _c_e7007a30-1eaf-4826-bb99-011e8a33ac111-lock-99 because it is gaining leadership. It does not create nodes like mesos does, with names like

Re: Java detector for mess masters and leader

2015-07-08 Thread Donald Laidlaw
exactly what you described Sent from my Samsung device Original message From: Donald Laidlaw donlaid...@me.com Date: 08/07/2015 19:49 (GMT+01:00) To: user@mesos.apache.org Subject: Re: Java detector for mess masters and leader @ Nicolaos I really don’t think

RE: Java detector for mess masters and leader

2015-07-08 Thread Nikolaos Ballas neXus
Great Sent from my Samsung device Original message From: Donald Laidlaw donlaid...@me.com Date: 08/07/2015 19:57 (GMT+01:00) To: user@mesos.apache.org Subject: Re: Java detector for mess masters and leader @Nicolaos Thanks for the offer. But I am almost finished writing

Re: Java detector for mess masters and leader

2015-07-08 Thread Adam Bordelon
Ballas neXus nikolaos.bal...@nexusgroup.com wrote: Great Sent from my Samsung device Original message From: Donald Laidlaw donlaid...@me.com Date: 08/07/2015 19:57 (GMT+01:00) To: user@mesos.apache.org Subject: Re: Java detector for mess masters and leader @Nicolaos

Re: Java detector for mess masters and leader

2015-07-07 Thread Donald Laidlaw
Thank you all. I will use the Curator recipe, since I already use Curator for a bunch of other things. If curator can find the leader and the participants that is good enough. Otherwise I will parse the protocol buffer contents, and provide a way to parse the future son contents when that

Re: Java detector for mess masters and leader

2015-07-07 Thread David Greenberg
You can check out Satellite: https://github.com/twosigma/satellite which is a complete monitoring metrics system for Mesos. It avoids the need to snoop the ZK connection by instead discovering that info via the rest API. On Tue, Jul 7, 2015 at 9:03 AM Donald Laidlaw donlaid...@me.com wrote:

Re: Java detector for mess masters and leader

2015-07-07 Thread Dick Davies
The active master has a flag set in /metrics/snapshot : master/elected which is 1 for the active master and 0 otherwise, so it's easy enough to only load the metrics from the active master. (I use the collectd plugin and push data rather than poll, but the same principle should apply). On 7

Re: Java detector for mess masters and leader

2015-07-07 Thread Nikolaos Ballas neXus
The only downside to that approach is that you consider you have apriori knowledge of the ip’s of the master. But if you are doing that from an external application and the nodes goes up and down the same ip/master/state.json can’t be conceived as granted. I used to go down that path, but if

Re: Java detector for mess masters and leader

2015-07-07 Thread Nikolaos Ballas neXus
Hi Don, actually you can use Apache Curator, to create a connection to Zookeeper and then instantiate a LeaderSelector object. If you pass as path the path under which you mesos master nodes register for formaming an ensemble then the that object you can call getLeader() or getParticipants and

Re: Java detector for mess masters and leader

2015-07-07 Thread Nikolaos Ballas neXus
Just not to forget, you can use the native Zookeeper API but in that case you should be aware that detecting the leader is a bit tricky. You ask for getPath(“/mesos/“ , true) and then you iterate over the children again calling getPath(). The string object returned contains some timestamps and

Re: Java detector for mess masters and leader

2015-07-07 Thread Philippe Laflamme
Querying for /master/state.json will provide you with the master. So you can query any one of the hosts in your list of potential masters, extract the master information from that and then hit your master on the endpoint you're interested in. Philippe On Tue, Jul 7, 2015 at 9:02 AM, Donald

Re: Java detector for mess masters and leader

2015-07-07 Thread Marco Massenzio
Hi Donald, the information stored in the Zookeeper znode is a serialized Protocol Buffer (see MasterInfo in mesos/mesos.proto https://git-wip-us.apache.org/repos/asf?p=mesos.git;a=blob;f=include/mesos/mesos.proto;h=3dd4a5b7a4b3bc56bdc690d6adf05f88c0d28273;hb=HEAD); here is a brief explanation of