This document introduces BookKeeper HTTP endpoints, which can be used for BookKeeper administration. To use this feature, set httpServerEnabled
to true
in file conf/bk_server.conf
.
Currently all the HTTP endpoints could be divided into these 4 components:
Code | Description |
---|---|
200 | Successful operation |
Description: Get value of all configured values overridden on local server config
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: Update a local server config
Parameters:
Name | Type | Required | Description |
---|---|---|---|
configName | String | Yes | Configuration name(key) |
configValue | String | Yes | Configuration value(value) |
Body:
{ "configName1": "configValue1", "configName2": "configValue2" }
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: Delete a ledger.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
ledger_id | Long | Yes | ledger id of the ledger. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: List all the ledgers.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
print_metadata | Boolean | No | whether print out metadata |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "ledgerId1": "ledgerMetadata1", "ledgerId2": "ledgerMetadata2", ... }
Description: Get the metadata of a ledger.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
ledger_id | Long | Yes | ledger id of the ledger. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "ledgerId1": "ledgerMetadata1" }
Description: Read a range of entries from ledger.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
ledger_id | Long | Yes | ledger id of the ledger. |
start_entry_id | Long | No | start entry id of read range. |
end_entry_id | Long | No | end entry id of read range. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "entryId1": "entry content 1", "entryId2": "entry content 2", ... }
Description: Get all the available bookies.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
type | String | Yes | value: “rw” or “ro” , list read-write/read-only bookies. |
print_hostnames | Boolean | No | whether print hostname of bookies. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "bookieSocketAddress1": "hostname1", "bookieSocketAddress2": "hostname2", ... }
Description: Get bookies disk usage info of this cluster.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "bookieAddress" : {free: xxx, total: xxx}, "bookieAddress" : {free: xxx, total: xxx}, ... "clusterInfo" : {total_free: xxx, total: xxx} }
Description: Get the last log marker.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ JournalId1 : position1, JournalId2 : position2, ... }
Description: Get all the files on disk of current bookie.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
type | String | No | file type: journal/entrylog/index. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "journal files" : "filename1 filename2 ...", "entrylog files" : "filename1 filename2...", "index files" : "filename1 filename2 ..." }
Description: Expand storage for a bookie.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: Ledger data recovery for failed bookie
Body:
{ "bookie_src": [ "bookie_src1", "bookie_src2"... ], "bookie_dest": [ "bookie_dest1", "bookie_dest2"... ], "delete_cookie": <bool_value> }
Parameters:
Name | Type | Required | Description |
---|---|---|---|
bookie_src | Strings | Yes | bookie source to recovery |
bookie_dest | Strings | No | bookie data recovery destination |
delete_cookie | Boolean | No | Whether delete cookie |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: Get all under replicated ledgers.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
missingreplica | String | No | missing replica bookieId |
excludingmissingreplica | String | No | exclude missing replica bookieId |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ [ledgerId1, ledgerId2...] }
Description: Get auditor bookie id.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Response Body format:
{ "Auditor": "hostname/hostAddress:Port" }
Description: Force trigger audit by resting the lostBookieRecoveryDelay.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Method: GET
Description: Get lostBookieRecoveryDelay value in seconds.
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Method: PUT
Description: Set lostBookieRecoveryDelay value in seconds.
Body:
{ "delay_seconds": <delay_seconds> }
Parameters:
Name | Type | Required | Description |
---|---|---|---|
delay_seconds | Long | Yes | set delay value in seconds. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |
Description: Decommission Bookie, Force trigger Audit task and make sure all the ledgers stored in the decommissioning bookie are replicated.
Body:
{ "bookie_src": <bookie_src> }
Parameters:
Name | Type | Required | Description |
---|---|---|---|
bookie_src | String | Yes | Bookie src to decommission.. |
Response:
Code | Description |
---|---|
200 | Successful operation |
403 | Permission denied |
404 | Not found |