Bifrost Document

Version 1.6.x

Bifrost ---- A heterogeneous middleware which can synchronize MySQL binlog data To Redis,MongoDB,ClickHouse...

HTTP API

Bifrost Management HTTP API  

Introduction

All require HTTP basic authentication . The default user is Bifrost/Bifrost123.

Examples

Get db list :

[root@localhost ~]# curl -i -u Bifrost:Bifrost123 -k https://127.0.0.1:21036/db/list
HTTP/1.1 200 OK
Date: Wed, 30 Dec 2020 11:41:59 GMT
Content-Length: 399
Content-Type: text/plain; charset=utf-8

{"mysql5.7":{"Name":"mysql5.7","ConnectUri":"root:root@tcp(172.17.0.2:3306)/mysql","ConnStatus":"running","ConnErr":"running","ChannelCount":1,"LastChannelID":1,"TableCount":1,"BinlogDumpFileName":"mysql-bin.000006","BinlogDumpPosition":826,"BinlogDumpTimestamp":1609240241,"MaxBinlogDumpFileName":"","MaxBinlogDumpPosition":0,"ReplicateDoDb":{"bifrost_test":1},"ServerId":103,"AddTime":1609139290}}

del refuse ip

[root@localhost ~]# curl -i -u Bifrost:Bifrost123 -k -H "content-type:application/json" -XDELETE -d'{"Ip":"191.168.220.101"}' https://127.0.0.1:21036/refuseip/del
HTTP/1.1 200 OK
Date: Wed, 30 Dec 2020 11:45:31 GMT
Content-Length: 40
Content-Type: text/plain; charset=utf-8

{"status":1,"msg":"success","data":null}

Reference

GET PUT DELETE POST Administrator Path Description |  eg
x         /overview  
x         /serverMonitor  
x         /freeOSMemory  
             
x         /debug/pprof/  
x         /debug/pprof/allocs  
x         /debug/pprof/block  
x         /debug/pprof/heap  
x         /debug/pprof/goroutine  
x         /debug/pprof/threadcreate  
x         /debug/pprof/mutex  
x         /debug/pprof/cmdline  
x         /debug/pprof/profile  
x         /debug/pprof/symbol  
x         /debug/pprof/trace  
             
      x   /db/check_uri

check privilege and get db current poisiton

param like: {"Uri":"xxtest:xxtest@tcp(10.0.3.31:3306)/mysql","CheckPrivilege":true}

  x   x x /db/add

add datasource

param like: 

{"DbName":"dbTestName","Uri":"xxtest:xxtest@tcp(10.0.3.31:3306)/mysql","BinlogFileName":"mysql-bin.000818","BinlogPosition":229327754,"ServerId":76,"MaxBinlogFileName":"","MaxBinlogPosition":0}

      x x /db/update param like : {"DbName":"dbTestName","Uri":"xxtest:xxtest@tcp(10.0.3.31:3306)/mysql","BinlogFileName":"mysql-bin.000818","BinlogPosition":229327754,"ServerId":76,"MaxBinlogFileName":"","MaxBinlogPosition":0,"UpdateToServer":0}
      x x /db/stop {"DbName":"dbTestName"}
      x x /db/start {"DbName":"dbTestName"}
      x x /db/close {"DbName":"dbTestName"}
  x   x x /db/del {"DbName":"dbTestName"}
x         /db/list  
      x   /db/get_last_position

get datasource current position,and vs last binlog parser position

{"DbName":"dbTestName"}

x         /db/table/fields get table fields list info
url like :
/db/table/fields?DbName=dbTestName&SchemaName=databaseName&TableName=tableName
x         /db/table/list

url like:

/db/table/list?DbName=dbTestName&SchemaName=databaseName

x         /db/table/createsql

show create table,  url like:

/db/table/createsql?DbName=dbTestName&SchemaName=databaseName&TableName=tableName

x         /db/version/get

get db version,  url like:

/db/version/get?DbName=dbTestName

             
x         /channel/list url like : /channel/list?DbName=dbTestName
  x   x x /channel/add

param like : {"DbName":"dbTestName","ChannelName":"default","CosumerCount":1}

result like : {"status": 1, "msg": "success", data: 1}

      x x /channel/stop param like : {"DbName":"dbTestName","ChannelId":1}
      x x /channel/start param like : {"DbName":"dbTestName","ChannelId":1}
      x x /channel/close param like : {"DbName":"dbTestName","ChannelId":1}
  x   x x /channel/del param like : {"DbName":"dbTestName","ChannelId":1}
x         /channel/table/index url like : /channel/table/index?DbName=dbTestName&ChannelId=1
x         /channel/table/list url like : /channel/table/list?DbName=dbTestName&ChannelId=1
             
x         /table/list

get database table list ,and table sync info

url like : /table/list?DbName=dbTestName

  x   x x /table/add

add table to bifrost, to binlog parser

param like : {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ChannelId":1,"IgnoreTable":""}

      x x /table/update

update table config IgnoreTable

param like : {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","IgnoreTable":"binlog_field_test_1"}

    x x x /table/del param like : {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*"}
             
x         /table/toserver/list

get table sync

 

  x   x x /table/toserver/add

param like :

{"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerKey":"TableCountTest","PluginName":"TableCount","MustBeSuccess":true,"FilterQuery":false,"FilterUpdate":true,"FieldList":[],"PluginParam":{}}

result : {"status":1,"msg":"success","data":1}

      x x /table/toserver/start param like :  {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerId":1,"Index":0}
      x x /table/toserver/stop param like :  {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerId":1,"Index":0}
      x x /table/toserver/del param like :  {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerId":1,"Index":0}
      x x /table/toserver/deal param like :  {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerId":1,"Index":0}
             
x         /table/synclist/list url like :  /table/synclist/list?DbName=&SchemaName=&TableName=&ChannelId=&SyncStatus=&ToServerKey
             
x         /toserver/list dest server 
  x   x x /toserver/add param like :  {"ToServerKey":"2RedisTest","PluginName":"redis","ConnUri":"172.17.0.5:6379","MaxConn":20,"MinConn":0,Notes:"2RedisTest"}
      x x /toserver/update param like :  {"ToServerKey":"2RedisTest","PluginName":"redis","ConnUri":"172.17.0.5:6379","MaxConn":20,"MinConn":0,Notes:"2RedisTest"}
    x x x /toserver/del param like :  {"ToServerKey":"2RedisTest"}
      x   /toserver/check_uri param like :  {"ConnUri":"172.17.0.5:6379","PluginName":"redis"}
             
          /history/list url like :  /history/list?DbName=&SchemaName=&TableName=&Status=
  x   x x /history/add

param like :  {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","TableNames":"binlog_field_test_1;binlog_field_test_2;","Property":{"ThreadNum":1,"ThreadCountPer":1000,"Where":"","LimitOptimize":1,"SyncThreadNum":1},"ToserverIds":[1]}

result : {"status":1,"msg":"success","data":2}

    x x x /history/del param like :  {"DbName":"dbTestName","Id":2}
          /history/start param like :  {"DbName":"dbTestName","Id":2}
          /history/stop param like : {"DbName":"dbTestName","Id":2}
          /history/kill param like : {"DbName":"dbTestName","Id":2}
          /history/check_where param like : {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","TableNames":"binlog_field_test_1;binlog_field_test_2;","Property":{"Where":"id>1000"}}
      x x /table/toserver/filequeue/update

start file queue

param like : {"DbName":"dbTestName","SchemaName":"bifrost_test","TableName":"binlog_field_test_*","ToServerId":1,"Index":0}

x         /table/toserver/filequeue/getinfo url like :  /table/toserver/filequeue/getinfo?DbName=dbTestName&SchemaName=databaseName&TableName=tableName&ToServerId=&Index=
             
x         /user/list  
      x x /user/update param like :  {"UserName":"userName","Password":"Password123","Group":"administrator","Host":"192.168.%,172.17.0.2"}
    x x x /user/del param like :  {"UserName":"userName"}
x         /user/login/log get all user login log (max 8Kb),return html content
             
      x   /dologin param like :  {"UserName":"userName","Password":"Password123"}
          /logout  
             
x         /warning/config/list  
  x   x x /warning/config/add

param like : {"Type":"Email","Param":{}}

result : {"status":1,"msg":"success","data":"bifrost_warning_config_1"}

 

    x x x /warning/config/del param like :  {"Type":"Email","Param":{}}
      x   /warning/config/check param like : {"Type":"Email","Param":{}}
             
x         /plugin/list  
             
x         /refuseip/list  
      x x /refuseip/del param like : {"Ip":"192.168.220.101"}
             
x         /flow/get url like :  /flow/get??DbName=&SchemaName=&TableName=ChannelId=&Type=tenminute
             
x         /backup/export backup config
  x x /backup/import import backup config
Last updated on 29 Dec 2020
Published on 29 Dec 2020
Edit on GitHub