Hello Jürgen, Thank you very much. Explanation you provided in quite concise and clear. Shall explore further ZK capabilities.
Cheers, Yogesh On Thu, Nov 13, 2014 at 1:05 AM, "Jürgen Wagner (DVT)" < [email protected]> wrote: > Hello Yogesh, > it depends on what you want to do. In any case, a znode is not an > attribute-value store but simply a container for a single array of bytes. > > If you will tend to update a whole set of attributes at the same time and > retrieve them as a set, you could put that into a format of your choice, > e.g., assign the znode /Controller1 the value > > set /Controller1 ip=10.22.1.39,port=8383,type=spare,user=svc_node_11 > > or JSON > > set /Controller1 '{"ip": "10.22.1.39", "port": 8383, "type":"spare", > "user": "svc_node_11"}' > > or XML > > set /Controller1 > '<descriptor><ip>10.22.1.39</ip><port>8383</port><type>spare</type><user>svc_node_11</user></descriptor>' > > If you want to update fields separately and maybe also retrieve them > separately, it is advised to put data into different znodes: > > set /Controller1/ip 10.22.1.39 > set /Controller1/port 8383 > set /Controller1/type spare > set /Controller1/user svc_node_11 > > If you always retrieve some fields together, you could replace the first > two in the example by > > set /Controller1/address 10.22.1.39:8383 > > The benefit of having separate znodes is also that you can set watches in > a more fine-grained fashion, e.g., if you're only interested in changes to > the ip and port (or address) attributes. > > Best regards, > --Jürgen > > > On 13.11.2014 06:37, Yogesh Patil 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 > > > > > -- > > Mit freundlichen Grüßen/Kind regards/Cordialement vôtre/Atentamente/С > уважением > *i.A. Jürgen Wagner* > Head of Competence Center "Intelligence" > & Senior Cloud Consultant > > Devoteam GmbH, Industriestr. 3, 70565 Stuttgart, Germany > Phone: +49 6151 868-8725, Fax: +49 711 13353-53, Mobile: +49 171 864 1543 > E-Mail: [email protected], URL: www.devoteam.de > ------------------------------ > Managing Board: Jürgen Hatzipantelis (CEO) > Address of Record: 64331 Weiterstadt, Germany; Commercial Register: > Amtsgericht Darmstadt HRB 6450; Tax Number: DE 172 993 071 > > > -- Sincerely, *Yogesh Patil* +1 352 870 9326 3800 SW, 34th Street Apt-B16, Gainesville, 32608 Florida, USA <http://www.linkedin.com/in/yogeshdpatil/>
