Files
z-docs/docs/admin-apis/info-api.md

71 lines
1.5 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.

---
sidebar_position: 1
title: 查看注册情况接口
description: ZHub 服务注册情况查询接口
---
# 查看注册情况接口
## 接口说明
- **路径**: `GET /_/info`
- **功能**: 查看当前服务的注册情况,包括主题订阅、连接状态等信息
- **用途**: 监控服务运行状态,排查问题
## 使用示例
```bash
# 查看服务注册情况
curl http://127.0.0.1:711/_/info
```
## 返回信息
接口返回当前服务的详细状态信息,包括:
- **topics**: 主题详细信息,包含每个主题的组信息
- **topicsize**: 当前活跃的主题数量
- **timersize**: 定时任务数量
- **conns**: 连接信息列表包含远程地址、组ID、订阅主题等
- **connsize**: 当前连接数
**响应示例**
```json
{
"topics": {
"user.login": [
{
"name": "group1",
"subsize": 3,
"offset": 100,
"mcount": 120
}
]
},
"topicsize": 25,
"timersize": 10,
"conns": [
{
"remoteaddr": "127.0.0.1:12345",
"groupid": "test-group",
"topics": ["user.*"],
"timers": ["timer1"],
"user": "admin"
}
],
"connsize": 5
}
```
## 应用场景
1. **服务监控**: 定期检查服务运行状态
2. **问题排查**: 当服务出现异常时查看详细信息
3. **性能分析**: 了解当前的主题和连接数量
4. **运维管理**: 评估服务负载和资源使用情况
## 注意事项
- 该接口为只读操作,不会修改服务状态
- 返回的信息实时反映当前服务状态