dosubot[bot] commented on issue #2787: URL: https://github.com/apache/incubator-hugegraph/issues/2787#issuecomment-2954580577
<!-- Answer --> 验证 HugeGraph 集群状态,可以通过 REST API 查询 Raft 组成员和 leader 信息,以及系统和后端健康指标。由于你已设置用户名和密码,API 请求需带 HTTP Basic Auth 认证。 常用接口如下: 1. 查询 Raft 集群所有节点(peers): ``` GET http://<host>:<port>/graphs/<graph>/raft/list_peers ``` 2. 查询当前 leader 节点: ``` GET http://<host>:<port>/graphs/<graph>/raft/get_leader ``` 3. 查询系统健康指标: ``` GET http://<host>:<port>/metrics/system ``` 4. 查询后端存储健康指标: ``` GET http://<host>:<port>/metrics/backend ``` 认证方式: 请求头需加 ``` Authorization: Basic <base64编码后的用户名:密码> ``` 例如用户名 admin,密码 123456,base64 编码为 YWRtaW46MTIzNDU2,完整请求头为: ``` Authorization: Basic YWRtaW46MTIzNDU2 ``` 你可以用 curl 测试(以查询 peers 为例): ```bash curl -X GET "http://192.168.1.10:8081/graphs/hugegraph/raft/list_peers" \ -H "Authorization: Basic YWRtaW46MTIzNDU2" ``` 返回结果会列出所有 raft 节点,正常情况下所有节点都在列表里,且 leader 信息能正常获取。 如需获取系统/后端指标,只需将 URL 换成 /metrics/system 或 /metrics/backend 即可。 接口需 admin 权限,普通用户无权访问[参考](https://github.com/apache/incubator-hugegraph/issues/2727) [RaftAPI源码](https://github.com/apache/incubator-hugegraph/blob/337dc86567834acd717a2240a79fef2815d4bb6f/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/raft/RaftAPI.java) [MetricsAPI源码](https://github.com/apache/incubator-hugegraph/blob/337dc86567834acd717a2240a79fef2815d4bb6f/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/metrics/MetricsAPI.java)。 如有特殊报错可贴出返回内容进一步排查。 <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6cbf1938-1118-40d7-9582-9dd9c47d19fa?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [! [Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2787) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
