Skip to content

instance-oom/zookeeper-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

zookeeper-api

zookeeper rest api by golang

Usage

Clone And Install Dependencies

git clone https://github.com/lon-yang/zookeeper-api.git
cd ./zookeeper-api/src/zookeeper-api
glide install

Build

go build zookeeper-api

Run

zookeeper-api.exe

API

Get Childs

http://localhost:8000/za/v1/childs/{path}

Example

CURL http://localhost:8000/za/v1/childs/zookeeper
{
  "Childs": [
    "quota"
  ],
  "Path": "/zookeeper"
}

Get Node

http://localhost:8000/za/v1/node/{path}

Example

CURL http://localhost:8000/za/v1/node/zookeeper
{
  "ChildNum": 1,
  "InDate": 0,
  "LastEditDate": 0,
  "Path": "/zookeeper",
  "Value": "",
  "Version": 0
}

Create Node

POST - http://localhost:8000/za/v1/node/{path}

Example

//URL: http://localhost:8000/za/v1/node/test
//Request Body
{
    "value": "test"
}

//Response
{
  "Path": "/test"
}

Update Node

PUT - http://localhost:8000/za/v1/node/{path}

Example

//URL: http://localhost:8000/za/v1/node/test
//Request Body
{
    "value": "test2"
}

//Empty Response

Delete Node

DELETE - http://localhost:8000/za/v1/node/{path}

Example

//URL: http://localhost:8000/za/v1/node/test
//Request Body
{
    "value": "test2"
}

//Empty Response

Server State

GET - http://localhost:8000/za/v1/stat/{ip:port}

Example

CURL http://localhost:8000/za/v1/stat/127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
[                                
  {                              
    "Server": "127.0.0.1:2181",
    "NodeCount": 280,            
    "MinLatency": 0,             
    "AvgLatency": 0,             
    "MaxLatency": 103,          
    "Connections": 35,           
    "Mode": "follower",          
    "Version": "3.4.5-1392090",  
    "Error": null                
  },
  {                              
    "Server": "127.0.0.1:2182",
    "NodeCount": 280,            
    "MinLatency": 0,             
    "AvgLatency": 0,             
    "MaxLatency": 158,          
    "Connections": 10,           
    "Mode": "leader",          
    "Version": "3.4.5-1392090",  
    "Error": null                
  },
  {                              
    "Server": "127.0.0.1:2183",
    "NodeCount": 280,            
    "MinLatency": 0,             
    "AvgLatency": 0,             
    "MaxLatency": 514,          
    "Connections": 2,           
    "Mode": "follower",          
    "Version": "3.4.5-1392090",  
    "Error": null                
  }                                  
]                                

About

zookeeper rest api by golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages