dosubot[bot] commented on issue #2790: URL: https://github.com/apache/incubator-hugegraph/issues/2790#issuecomment-2955130844
<!-- Answer --> 你的分析基本正确,但有几点需要澄清和补充: 1. **raft.mode 是否必须** 在 HugeGraph 1.5.0 版本,[raft.mode 已经被废弃](https://github.com/apache/incubator-hugegraph/issues/2787),只要配置了 `raft.group_peers`,就会自动启用 Raft 集群模式,无需再写 `raft.mode=true`。如果你发现不写 `raft.mode=true` 无法启用集群,建议检查下所有节点的 `hugegraph.properties` 配置是否完全一致,尤其是 `raft.group_peers`、端口等参数。 2. **配置文件位置** `raft.group_peers` 必须写在每个节点的 `graphs/hugegraph.properties` 文件里,[不能写在 rest-server.properties](https://github.com/apache/incubator-hugegraph/issues/2787)。 3. **启动超时原因** 你遇到的启动超时(比如 30s 连接超时),主要原因是 Raft 集群启动和选主需要一定时间,期间 REST 服务端口还未完全 ready,或者 leader 选举还没完成。HugeGraph 内部 raft 相关代码(如 RaftNode、RaftContext)会等待 leader 选举和日志同步,超时会报错,但通常等一会集群就会正常工作(如你后续 curl 查询 raft 状态是正常的)[源码参考](https://github.com/apache/incubator-hugegraph/blob/337dc86567834acd717a2240a79fef2815d4bb6f/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.java)。 4. **建议** - 不要再写 `raft.mode=true`,只保留 `raft.group_peers` 即可。 - 检查所有节点的 `hugegraph.properties` 配置完全一致,端口不冲突。 - 如果启动超时,可以适当调大 `restserver.request_timeout` 或相关 raft 超时参数(如 `raft.rpc_timeout`、`raft.election_timeout`),并确保网络畅通。 - 避免使用已废弃的 raft 相关参数(如 raft.endpoint、raft.election_timeout_ms 等)。 相关讨论和源码可参考: - [raft.mode 已废弃,自动根据 raft.group_peers 判断](https://github.com/apache/incubator-hugegraph/issues/2787) - [Raft 启动和超时机制源码](https://github.com/apache/incubator-hugegraph/blob/337dc86567834acd717a2240a79fef2815d4bb6f/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftNode.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/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/069982b4-f4bf-44af-ac3a-f5672d531d24?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/2790) -- 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]
