-
Notifications
You must be signed in to change notification settings - Fork 30
HTTP API
ByteWatch edited this page Dec 26, 2018
·
2 revisions
Dolphinbeat has exposed some HTTP API, here are the descriptions of these API.
Get dolphinbeat's stauts.
Example:
curl 127.0.0.1:8080/status
{
"build_ts": "2018-12-23 12:08:09",
"git_hash": "9a2d25b",
"mode": "leader",
"version": "0.9.0"
}
Get dolphinbeat's metrics in Prometheus style.
Example:
curl 127.0.0.1:8080/metrics
...
# HELP trx_total Counter of trx handled by dolphinbeat.
# TYPE trx_total counter
trx_total 1
...
Get failed ddl statement and reason for current. If dolphinbeat failed to replay DDL in binlog, user can request this HTTP API to debug.
Example:
curl 127.0.0.1:8080/ddl/failed
{
"db": "test1",
"reason": "Error 1146: Table 'test1.ti2' doesn't exist",
"statement": "alter table test1.ti2 add column e int",
"tips": "You can try 'curl .../ddl/exec --data-urlencode 'statement=...' ' to fix, and then 'curl .../ddl/retry' to tell me to retry"
}
Tell dolphinbeat to execute a ddl statment. User can request this HTTP API to fix something if dolphinbeat failed to replay DDL.
Example:
curl --data-urlencode "statement=create table test1.ti2 (id int)" 127.0.0.1:8080/ddl/exec
Tell dolphinbeat to retry a failed ddl.
Example:
curl 127.0.0.1:8080/ddl/retry
Get all schema names in dolphinbeat schema data, which is a history snapshot of source MySQL.
Example:
curl 127.0.0.1:8080/schema
[
"test1",
"test2",
"test3"
]
Get all table names in specified schema.
Example:
curl 127.0.0.1:8080/schema/test1
[
"ti1",
"ti2",
"tm1",
"tm2"
]
Get info of specified schema.table.
Example:
curl 127.0.0.1:8080/schema/test1/ti1
{
"charset": "utf8mb4",
"columns": [
{
"charset": "",
"inner_type": 3,
"key": "PRI",
"name": "a",
"nullable": false,
"type": "int(11)",
"unsigned": false
},
{
"charset": "",
"inner_type": 3,
"key": "",
"name": "b",
"nullable": true,
"type": "int(11)",
"unsigned": false
},
{
"charset": "",
"inner_type": 3,
"key": "",
"name": "c",
"nullable": true,
"type": "int(11)",
"unsigned": false
}
],
"database": "test1",
"indices": [
{
"columns": [
"a"
],
"flag": 0,
"key": "PRI",
"name": "PRIMARY"
}
],
"name": "ti1"
}