zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McKenzie <mckenzie....@gmail.com>
Subject Re: Data part in z-node
Date Thu, 13 Nov 2014 05:48:44 GMT
hey Yogesh,
You can encode the data into any format you want and store it in the zNode,
it's just stored as an array of bytes. So, you could encode your multiple
data items into key value pairs separated by newlines, or use some other
similar scheme. When you pull the data out of the zNode you'd need to
decode it again.
cheers

On Thu, Nov 13, 2014 at 4:37 PM, Yogesh Patil <patyogesh@gmail.com> wrote:

> Hi,
> Pardon me if this turns out to be too silly a question.
>
> My understanding of znode and data at that node was: like UNIX file stores
> data spanning multiple lines, znode can also have multiple data values.
> However it seems that was wrong.
>
> I ran following set of commands and I could see that each znode can only
> store one data unit (say some string).
>
> [zk: 192.168.0.1:2181(CONNECTED) 15] set /Controller1 IP=192.168.0.1
> [zk: 192.168.0.1:2181(CONNECTED) 16] get /Controller1
> IP=192.168.0.1
>
> [zk: 192.168.0.1:2181(CONNECTED) 15] set /Controller1 port=6655
> [zk: 192.168.0.1:2181(CONNECTED) 16] get /Controller1
> port=6655    <<<<< See data field 'IP' is lost and overwritten by port
data
>
> does that mean I have to create one znode for every type of data that I
> want to store??
> i.e.
> [zk: 192.168.0.1:2181(CONNECTED) 15] set /Controller1/IP 192.168.0.1
> [zk: 192.168.0.1:2181(CONNECTED) 15] set /Controller1/port 6655
>
> Kindly let me know if I am missing something here.
>
>
>
>
> Thanks,
> Yogesh Patil
>
> Graduate Student
> University of Florida
>

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