mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Support server health check by http://localhost:<port>/v1/system/healthz (#10150)
### What problem does this PR solve? Support server health check. Solved issue: #10106 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -4102,3 +4102,77 @@ Failure:
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### System
|
||||
---
|
||||
### Check system health
|
||||
|
||||
**GET** `/v1/system/healthz`
|
||||
|
||||
Check the health status of RAGFlow’s dependencies (database, Redis, document engine, object storage).
|
||||
|
||||
#### Request
|
||||
|
||||
- Method: GET
|
||||
- URL: `/v1/system/healthz`
|
||||
- Headers:
|
||||
- 'Content-Type: application/json'
|
||||
(no Authorization required)
|
||||
|
||||
##### Request example
|
||||
|
||||
```bash
|
||||
curl --request GET
|
||||
--url http://{address}/v1/system/healthz
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
##### Request parameters
|
||||
|
||||
- `address`: (*Path parameter*), string
|
||||
The host and port of the backend service (e.g., `localhost:7897`).
|
||||
|
||||
---
|
||||
|
||||
#### Responses
|
||||
|
||||
- **200 OK** – All services healthy
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"db": "ok",
|
||||
"redis": "ok",
|
||||
"doc_engine": "ok",
|
||||
"storage": "ok",
|
||||
"status": "ok"
|
||||
}
|
||||
```
|
||||
|
||||
- **500 Internal Server Error** – At least one service unhealthy
|
||||
|
||||
```http
|
||||
HTTP/1.1 500 INTERNAL SERVER ERROR
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"db": "ok",
|
||||
"redis": "nok",
|
||||
"doc_engine": "ok",
|
||||
"storage": "ok",
|
||||
"status": "nok",
|
||||
"_meta": {
|
||||
"redis": {
|
||||
"elapsed": "5.2",
|
||||
"error": "Lost connection!"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Explanation:
|
||||
- Each service is reported as "ok" or "nok".
|
||||
- The top-level `status` reflects overall health.
|
||||
- If any service is "nok", detailed error info appears in `_meta`.
|
||||
|
||||
Reference in New Issue
Block a user