Skip to content

Commit

Permalink
docs: update api.md radondb#558
Browse files Browse the repository at this point in the history
[summary]
Add migrate API description.
[test case]
N/A
[patch codecov]
N/A
  • Loading branch information
zhyass committed Jan 11, 2020
1 parent 91a9d73 commit c92b30e
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Contents
* [balanceadvice](#balanceadvice)
* [shift](#shift)
* [reload](#reload)
* [migrate](#migrate)
* [backend](#backend)
* [health](#health)
* [backends](#backends)
Expand Down Expand Up @@ -335,6 +336,56 @@ Content-Length: 0
Content-Type: text/plain; charset=utf-8
```


### migrate

This api is used to migrate the data from one backend to another.

```
Path: /v1/shard/migrate
Method: POST
Request: {
"to-flavor": "Destination db flavor, like mysql/mariadb/radondb, default mysql"
"from": "Source MySQL backend(host:port)", [required]
"from-user": "MySQL user, must have replication privilege", [required]
"from-password": "MySQL user password", [required]
"from-database": "Source database", [required]
"from-table": "Source table", [required]
"to": "Destination MySQL backend(host:port)", [required]
"to-user": "MySQL user, must have replication privilege", [required]
"to-password": "MySQL user password", [required]
"to-database": "Destination database", [required]
"to-table": "Destination table", [required]
"radonurl": "Radon RESTful api(default: http://peer-address)",
"cleanup": "Cleanup the from table after shifted(defaults false)",
"mysqldump": "mysqldump path",
"threads": "shift threads num(defaults 16)",
"behinds": "position behinds num(default 2048)",
"checksum": "Checksum the from table and to table after shifted(defaults true)",
"wait-time-before-checksum": "seconds sleep before checksum"
}
```

`Status:`

```
200: StatusOK
204: StatusNoContent
500: StatusInternalServerError
```

`Example: `

```
$ curl -i -H 'Content-Type: application/json' -X POST -d '{"from": "127.0.0.1:3000","from-user":"usr","from-password":"123456","from-table":"t1","from-database":"test", \
"to":"127.0.0.1:4000","to-user":"usr","to-password":"123456","to-database":"test","to-table":"t1","cleanup":true}' http://127.0.0.1:8080/v1/shard/migrate
---Response---
HTTP/1.1 200 OK
Date: Fri, 10 Jan 2020 10:56:31 GMT
Content-Length: 0
```

## backend

### health
Expand Down

0 comments on commit c92b30e

Please sign in to comment.