"Fossies" - the Fresh Open Source Software Archive

Member "apache-zookeeper-3.8.1/zookeeper-contrib/zookeeper-contrib-rest/README.txt" (25 Jan 2023, 2422 Bytes) of package /linux/misc/apache-zookeeper-3.8.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 ZooKeeper REST implementation using Jersey JAX-RS.
    3 --------------------------------------------------
    4 
    5 This is an implementation of version 2 of the ZooKeeper REST spec.
    6 
    7 Note: This interface is currently experimental, may change at any time,
    8 etc... In general you should be using the Java/C client bindings to access
    9 the ZooKeeper server.
   10 
   11 This REST ZooKeeper gateway is useful because most of the languages
   12 have built-in support for working with HTTP based protocols.
   13 
   14 See SPEC.txt for details on the REST binding.
   15 
   16 Quickstart:
   17 -----------
   18 
   19 1) start a zookeeper server on localhost port 2181
   20 
   21 2) run "ant run"
   22 
   23 3) use a REST client to access the data (see below for more details)
   24 
   25   curl http://localhost:9998/znodes/v1/
   26 
   27 or use the provided src/python scripts 
   28 
   29   zk_dump_tree.py
   30 
   31 
   32 Tests:
   33 ----------
   34 
   35 1) the full testsuite can be run via "ant test" target
   36 2) the python client library also contains a test suite
   37 
   38 Examples Using CURL
   39 -------------------
   40 
   41 First review the spec SPEC.txt in this directory.
   42 
   43 #get the root node data
   44 curl http://localhost:9998/znodes/v1/
   45 
   46 #get children of the root node
   47 curl http://localhost:9998/znodes/v1/?view=children
   48 
   49 #get "/cluster1/leader" as xml (default is json)
   50 curl -H'Accept: application/xml' http://localhost:9998/znodes/v1/cluster1/leader
   51 
   52 #get the data as text
   53 curl -w "\n%{http_code}\n" "http://localhost:9998/znodes/v1/cluster1/leader?dataformat=utf8"
   54 
   55 #set a node (data.txt contains the ascii text you want to set on the node)
   56 curl -T data.txt -w "\n%{http_code}\n" "http://localhost:9998/znodes/v1/cluster1/leader?dataformat=utf8"
   57 
   58 #create a node
   59 curl -d "data1" -H'Content-Type: application/octet-stream' -w "\n%{http_code}\n" "http://localhost:9998/znodes/v1/?op=create&name=cluster2&dataformat=utf8"
   60 
   61 curl -d "data2" -H'Content-Type: application/octet-stream' -w "\n%{http_code}\n" "http://localhost:9998/znodes/v1/cluster2?op=create&name=leader&dataformat=utf8"
   62 
   63 #create a new session
   64 curl -d "" -H'Content-Type: application/octet-stream' -w "\n%{http_code}\n" "http://localhost:9998/sessions/v1/?op=create&expire=10"
   65 
   66 #session heartbeat
   67 curl -X "PUT" -H'Content-Type: application/octet-stream' -w "\n%{http_code}\n" "http://localhost:9998/sessions/v1/02dfdcc8-8667-4e53-a6f8-ca5c2b495a72"
   68 
   69 #delete a session
   70 curl -X "DELETE" -H'Content-Type: application/octet-stream' -w "\n%{http_code}\n" "http://localhost:9998/sessions/v1/02dfdcc8-8667-4e53-a6f8-ca5c2b495a72"
   71 
   72