zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pubudu gunawardena <pubud...@gmail.com>
Subject Re: Integrate Zookeeper with hadoop mapreduce
Date Sat, 02 Jul 2011 10:48:13 GMT
On Sat, Jul 2, 2011 at 2:01 PM, Paul Rimba <paul.rimba@gmail.com> wrote:

> No worries. Too much email distorted my brain too ;p
>
> hmm.. it does return the string. However, i wanted to store a whole
> configuration files in the znode.
>
If what you want to store something other than a String on a znode, the
setData<http://zookeeper.apache.org/doc/r3.2.2/api/org/apache/zookeeper/ZooKeeper.html#setData%28java.lang.String,%20byte[],%20int%29>method
takes a byte[] as the second parameter. You can convert objects to
byte array and from byte array to objects. Take a look at
this<http://scr4tchp4d.blogspot.com/2008/07/object-to-byte-array-and-byte-array-to.html>code
that does that.
I used the above mentioned method to store data on a znode.(I'm also new to
zookeeper so it would be nice if someone can affirm the above method)

Mahadev asked me to build a tool which i am not sure how to as i am still a
> newbie on zookeeper.
>
> If you could point out how to do it, it would be best.
>
> Thanks
>
> On Sat, Jul 2, 2011 at 4:32 PM, Ted Dunning <ted.dunning@gmail.com> wrote:
>
> > On Fri, Jul 1, 2011 at 10:10 PM, Paul Rimba <paul.rimba@gmail.com>
> wrote:
> >
> > > ...
> > > @Ted : I thought this is the zookeeper mailing list? Could you give me
> a
> > > link for me to store anything on znode?
> > >
> >
> > Silly me!  I saw your reference to mrV2 and had just read a string of
> > Hadoop
> > emails.
> >
> >
> > > so far what i have used is something like this:
> > >
> > > zk.setData(path, value.getBytes(CHARSET), -1);
> > > where protected ZooKeeper zk;
> > >
> > > that only updates like a string to my znode.
> > >
> > > Could you help me with that please?
> > >
> >
> > This is just fine.
> >
> > Are you saying that this:
> >
> >     Stat s = new Stat();
> >     new String(zk.getData(path, false, s), CHARSET);
> >
> > Does not return a copy of your string?
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message