How-to use cUrl for work with ZKUI.


ZKUI is an open source (under Apache 2.0 license ) a UI dashboard that allows CRUD operations on Zookeeper.


But sometimes you can want to upload something to the Zookeeper via ZKUI automatically. And as far as I could understand ZKUI don't have API for this purpose, but you can always use cUrl.

First of all, you need to authenticate in the ZKUI using LDAP login/password:
curl -c COOKIE --data "username=USERNAME&password=PASSWORD&action='Sign In'" https://ZKUI_ADDRESS/login

After that, you can use the COOKIE file to communicate with ZKUI.

Use the next commands:
To export all data to a file:
curl -c COOKIE -b COOKIE -s -S "https://ZKUI_ADDRESS/export?zkPath=/" > FILE
To import data from a file:
curl -c COOKIE -b COOKIE -s -S --form scmFile=@FILE --form Import=submit https://ZKUI_ADDRESS/import

Please note: you can set "--form scmOverwrite=true" if you want to overwrite existing properties.

To delete a node need to:
curl -c COOKIE -b COOKIE -s -S --data "nodeChkGroup=NODE_NAME&action=Delete"  https://ZKUI_ADDRESS/home

To delete one property:
curl -c COOKIE -b COOKIE -s -S --data "propChkGroup=PROPERTY_PATH&action=Delete" https://ZKUI_ADDRESS/home

Комментарии

Популярные сообщения из этого блога

How to work with authentication in Zookeeper?

Consul-template: how to run exec command, if file changed? Create a "watcher" via consul-template.