Updated Master Server API (markdown)

Chris Lu 2020-09-19 11:33:53 -07:00
parent 3f961a1e50
commit 0bdaeeda7b

@ -18,6 +18,22 @@ curl "http://localhost:9333/dir/assign?count=5"
curl "http://localhost:9333/dir/assign?dataCenter=dc1" curl "http://localhost:9333/dir/assign?dataCenter=dc1"
``` ```
| Parameter | Description | Default |
| ---- | -- | -- |
| count | how many file ids to reserve | 1 |
| collection | required collection name | empty |
| dataCenter | preferred data center | empty |
| rack | preferred rack | empty |
| dataNode | preferred volume server, e.g. 127.0.0.1:8080 | empty |
| replication | replica placement strategy | master defaultReplicaPlacement|
| ttl | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year | never expire|
| preallocate | If no matching volumes, pre-allocate this number of bytes on disk for new volumes. | master preallocateSize |
| memoryMapMaxSizeMb | Only implemented for windows. Use memory mapped files with specified size for new volumes. | 0 |
| writableVolumeCount | If no matching volumes, create specified number of new volumes. | master preallocateSize |
### Lookup volume ### Lookup volume
We would need to find out whether the volumes have moved. We would need to find out whether the volumes have moved.
@ -39,6 +55,13 @@ curl "http://localhost:9333/dir/lookup?volumeId=3,01637037d6"
curl "http://localhost:9333/dir/lookup?volumeId=3&collection=turbo" curl "http://localhost:9333/dir/lookup?volumeId=3&collection=turbo"
``` ```
| Parameter | Description | Default |
| ---- | -- | -- |
| volumeId | volume id | empty |
| collection | optionally to speed up the lookup | empty |
| fileId | If provided, this returns the fileId location and a JWT to update or delete the file. | empty |
| read | works together with "fileId", if read=yes, JWT is generated for reads. | empty |
### Force garbage collection ### Force garbage collection
If your system has many deletions, the deleted file's disk space will not be synchronously re-claimed. There is a background job to check volume disk usage. If empty space is more than the threshold, default to 0.3 which is 30%, the vacuum job will make the volume readonly, create a new volume with only existing files, and switch on the new volume. If you are impatient or doing some testing, vacuum the unused spaces this way. If your system has many deletions, the deleted file's disk space will not be synchronously re-claimed. There is a background job to check volume disk usage. If empty space is more than the threshold, default to 0.3 which is 30%, the vacuum job will make the volume readonly, create a new volume with only existing files, and switch on the new volume. If you are impatient or doing some testing, vacuum the unused spaces this way.
@ -47,6 +70,9 @@ If your system has many deletions, the deleted file's disk space will not be syn
curl "http://localhost:9333/vol/vacuum" curl "http://localhost:9333/vol/vacuum"
curl "http://localhost:9333/vol/vacuum?garbageThreshold=0.4" curl "http://localhost:9333/vol/vacuum?garbageThreshold=0.4"
``` ```
| Parameter | Description | Default |
| ---- | -- | -- |
| garbageThreshold | minimum garbage ratio | 0.3, which is 30% |
The garbageThreshold=0.4 is optional, and will not change the default threshold. You can start volume master with a different default garbageThreshold. The garbageThreshold=0.4 is optional, and will not change the default threshold. You can start volume master with a different default garbageThreshold.
@ -68,7 +94,18 @@ curl "http://localhost:9333/vol/grow?dataCenter=dc1&count=4"
curl "http://localhost:9333/vol/grow?ttl=5d&count=4" curl "http://localhost:9333/vol/grow?ttl=5d&count=4"
``` ```
This generates 4 empty volumes. | Parameter | Description | Default |
| ---- | -- | -- |
| count | how many volumes to grow | required |
| collection | required collection name | empty |
| dataCenter | preferred data center | empty |
| rack | preferred rack | empty |
| dataNode | preferred volume server, e.g. 127.0.0.1:8080 | empty |
| replication | replica placement strategy | master defaultReplicaPlacement|
| ttl | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year | never expire|
| preallocate | Pre-allocate this number of bytes on disk for new volumes. | master preallocateSize |
| memoryMapMaxSizeMb | Only implemented for windows. Use memory mapped files with specified size for new volumes. | 0 |
### Delete Collection ### Delete Collection
@ -77,6 +114,11 @@ This generates 4 empty volumes.
curl "http://localhost:9333/col/delete?collection=benchmark&pretty=y" curl "http://localhost:9333/col/delete?collection=benchmark&pretty=y"
``` ```
| Parameter | Description | Default |
| ---- | -- | -- |
| collection | collection name | required |
### Check System Status ### Check System Status
```bash ```bash