Files
orbit/examples/health/README.md

30 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 健康检查
查询存活、数据库/迁移就绪状态与运行版本。
## 准备
- Go 1.27.1、当前版本 Orbit;服务启动和初始化见[仓库 README](../../README.md#快速开始)。
- 无需凭据;服务地址必须可达。
- [示例总索引](../README.md)提供统一初始化和权限说明;完整字段、失败处理见[详细手册](../../docs/api/health.md)。
## 运行
以下命令从仓库根目录执行;凭据路径替换为实际初始化输出。
```sh
cd examples
export ORBIT_URL=http://127.0.0.1:8080
go run ./health
```
## 结果核对
liveness=alive readiness=ready scope=database_and_schema。具体 ID 和统计值以本次运行为准。程序会核对上述关键条件,失败时打印错误并以非零状态退出。
## 接入自己的项目
阅读[main.go](main.go)中的客户端创建、请求及错误处理。业务项目通过 `go get git.yuntuo.hk/k2safe/orbit/sdk/go@v0.1.1` 引入 SDK,无需导入本示例包。
本例只读,不创建任务、队列或订阅。