rbmd/README.md

193 lines
3.0 KiB
Markdown
Raw Normal View History

2016-12-30 14:26:41 +03:00
RBD mount wrapper cluster
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->
**Table of Contents**
2017-01-03 21:37:20 +03:00
- [-](#-)
- [Usage](#usage)
- [Example](#example)
2016-12-30 14:26:41 +03:00
- [API](#api)
- [GET /status](#get-status)
- [Example](#example)
- [GET /node](#get-node)
- [Example](#example)
- [GET /health](#get-health)
- [Example](#example)
- [POST /mount](#post-mount)
- [POST /umount](#post-umount)
2016-12-30 14:31:53 +03:00
- [AUTHORS](#authors)
- [LICENSE](#license)
2016-12-30 14:26:41 +03:00
<!-- markdown-toc end -->
## Dependencies
* Zookeeper
* Access to ceph cluster(for map/unmap images)
## Usage
```
Usage of ./rbmd:
-listen string
HTTP API listen address (default "0.0.0.0:9076")
-tick int
Tick time loop (default 5)
2017-01-03 10:33:19 +03:00
-ws string
Websockets listen address (default "0.0.0.0:7690")
2016-12-30 14:26:41 +03:00
-zk string
Zookeeper servers comma separated (default "127.0.0.1:2181")
-zkPath string
Zookeeper path (default "/rbmd")
```
### Example
```./rbmd -listen 127.0.0.1:9908 -zkPath /rbmd-ru-dc3-rack5```
## API
### GET /status
Return JSON of quorum status
#### Example
```
curl 127.0.0.1:9076/status | jq
{
2017-01-03 10:33:19 +03:00
"quorum": {
"node.example.com": {
"node": "node.example.com",
2016-12-30 14:26:41 +03:00
"ip": {
"v4": [
"10.0.3.1"
],
"v6": [
2017-01-03 10:33:19 +03:00
"fe80::f869:d0ff:fea3:3c0a"
2016-12-30 14:26:41 +03:00
]
},
2017-01-03 10:33:19 +03:00
"updated": 1483428452,
2016-12-30 14:26:41 +03:00
"mounts": null
}
2017-01-03 10:33:19 +03:00
},
"health": "alive.",
"leader": "node.example.com"
2016-12-30 14:26:41 +03:00
}
```
### GET /node
Return JSON of node stats
#### Example
```
{
"node": "difrex-mac.wargaming.net",
"ip": {
"v4": [
"169.254.156.1"
],
"v6": [
"fe80::108d:fcff:fe77:3df6"
]
},
"updated": 1483095493,
"mounts": null
}
```
### GET /health
Return string with quorum health check result
2016-12-30 14:55:42 +03:00
Statuses:
2016-12-30 15:05:20 +03:00
* alive. Match regexp: ```^alive\.$``` -- all is good
* resizing. Match regexp: ```^resizing\. (.+)``` -- One or more nodes goind down
* deadly. Match regexp: ```^deadly\. (.+)``` -- One or more nodes is down and they has mapped images. Return string with \n
2016-12-30 14:55:42 +03:00
2016-12-30 14:26:41 +03:00
#### Example
```
curl 127.0.0.1:9076/health
alive.
```
### POST /mount
2017-01-03 21:37:20 +03:00
Map rbd image and mount it
#### Example
Accept JSON
```
{
"node": "node.example.com",
"pool": "web",
2017-01-04 16:59:43 +03:00
"image": "pictures",
2017-01-03 21:37:20 +03:00
"mountpoint": "/var/www/pictures",
"mountopts": "noatime,nodiratime",
"fstype": "xfs"
}
```
Return JSON.
On success
```
{
"state": "OK",
"message": "OK"
}
```
On failure
```
{
"state": "FAIL"
"message": "mount: /dev/null not a block device"
}
```
2016-12-30 14:26:41 +03:00
### POST /umount
2017-01-09 23:12:50 +03:00
Unmount filesystem and unmap RBD device
#### Example
Accept JSON
```
{
"node": "node.example.com",
"mountpoint": "/var/www/pictures",
"block": "rbd0"
}
```
Return JSON.
On success
```
{
"state": "OK",
"message": "OK"
}
```
On failure
```
{
"state": "FAIL"
"message": "Not found"
}
```
2016-12-30 14:31:53 +03:00
# AUTHORS
Denis Zheleztsov <difrex.punk@gmail.com>
# LICENSE
GPL version 3 see LICENSE