简体   繁体   中英

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”

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM