[
https://issues.apache.org/jira/browse/MESOS-2340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550958#comment-14550958
]
Marco Massenzio edited comment on MESOS-2340 at 5/19/15 6:30 PM:
-----------------------------------------------------------------
so, this is the simplest code I could came up with (this needs refining,
obviously!) (in {{src/zookeeper/group.cpp}}:
{code}
// if label is not None, this is the MasterInfo being serialized
if (label.isSome()) {
// TODO: how do we serialize MasterInfo to JSON? we only have the
// raw serialized data here
string json = "{\"value\": \"foobar\"}";
string loc = result + ".json";
string jsonResult;
zk->create(
loc,
json,
acl,
ZOO_EPHEMERAL,
&jsonResult);
LOG(INFO) << "Added JSON data to " << jsonResult;
}
{code}
If I now start the Master, I can see both nodes in the {{/test/json}} folder.
{noformat}
$ ./bin/mesos-master.sh --zk=zk://127.0.0.1:2181/json/test
--work_dir=/tmp/mesos --quorum=1
{noformat}
{noformat}
[zk: localhost:2181(CONNECTED) 8] ls /json/test
[log_replicas, info_0000000010, info_0000000010.json]
[zk: localhost:2181(CONNECTED) 9] get /json/test/info_0000000010.json
{"value": "foobar"}
cZxid = 0xe6
ctime = Tue May 19 11:24:55 PDT 2015
mZxid = 0xe6
mtime = Tue May 19 11:24:55 PDT 2015
pZxid = 0xe6
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x14d496680460057
dataLength = 19
numChildren = 0
{noformat}
and there's no .json in {{log_replicas}}.
I would like to get suggestions as to where to "inject" the JSON, as in the
Group class, we only get the serialized String, not the {{MasterInfo}} PB.
There are obviously way around this, but I'd like to come up with an extensible
way.
was (Author: marco-mesos):
so, this is the simplest code I could came up with (this needs refining,
obviously!) (in {{src/zookeeper/group.cpp}}:
{code}
// if label is not None, this is the MasterInfo being serialized
if (label.isSome()) {
// TODO: how do we serialize MasterInfo to JSON? we only have the
// raw serialized data here
string json = "{\"value\": \"foobar\"}";
string loc = result + ".json";
string jsonResult;
zk->create(
loc,
json,
acl,
ZOO_EPHEMERAL,
&jsonResult);
LOG(INFO) << "Added JSON data to " << jsonResult;
}
{info}
If I now start the Master, I can see both nodes in the {{/test/json}} folder.
{noformat}
$ ./bin/mesos-master.sh --zk=zk://127.0.0.1:2181/json/test
--work_dir=/tmp/mesos --quorum=1
{noformat}
{noformat}
[zk: localhost:2181(CONNECTED) 8] ls /json/test
[log_replicas, info_0000000010, info_0000000010.json]
[zk: localhost:2181(CONNECTED) 9] get /json/test/info_0000000010.json
{"value": "foobar"}
cZxid = 0xe6
ctime = Tue May 19 11:24:55 PDT 2015
mZxid = 0xe6
mtime = Tue May 19 11:24:55 PDT 2015
pZxid = 0xe6
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x14d496680460057
dataLength = 19
numChildren = 0
{noformat}
and there's no .json in {{log_replicas}}.
I would like to get suggestions as to where to "inject" the JSON, as in the
Group class, we only get the serialized String, not the {{MasterInfo}} PB.
There are obviously way around this, but I'd like to come up with an extensible
way.
> Publish JSON in ZK instead of serialized MasterInfo
> ---------------------------------------------------
>
> Key: MESOS-2340
> URL: https://issues.apache.org/jira/browse/MESOS-2340
> Project: Mesos
> Issue Type: Improvement
> Reporter: Zameer Manji
> Assignee: haosdent
>
> Currently to discover the master a client needs the ZK node location and
> access to the MasterInfo protobuf so it can deserialize the binary blob in
> the node.
> I think it would be nice to publish JSON (like Twitter's ServerSets) so
> clients are not tied to protobuf to do service discovery.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)