Raj
Raj

Reputation: 1

Can we give the path of text files as data in zookeeper znodes?

I am newbie to zookeeper. I have a question related to data for znodes. If we want to store the contents of the text file as a data in znodes what will be the syntax? Can we specify the path of the text file in the data. The syntax is create /MyZnode “ZnodeData”

Can we save the contents of the text files as: create /MyZnode “Path of txtfile”

Upvotes: 0

Views: 579

Answers (1)

HRB
HRB

Reputation: 1

Well, not through the zkcli.

create /MyZnode "ZnodeData" always expects data in byte array format. But programmatically, you can read a file and convert it into byte array using obj.toString().getBytes(theCharset) and then pass the contents to the znode. Never tried this but it should work.

Upvotes: 0

Related Questions