dosubot[bot] commented on issue #2811:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2811#issuecomment-2987430458

   <!-- Answer -->
   HugeGraph-Java-Client 不能自动感知集群,也不支持多节点切换或高可用。没有 Nginx 代理时,你只能在 
HugeClient.builder 里填写某一个节点的 REST API 地址(比如 master 节点的 
http://ip:port),所有请求都会发到这个节点。如果该节点不可用,client 也无法自动切换到其他节点。
   
   所以,直接连接集群时,写法如下:
   
   ```java
   HugeClient hugeClient = HugeClient.builder("http://某个节点IP:端口";, 
"hugegraph").build();
   ```
   
   注意事项:
   - 你只能指定一个节点的 REST 地址,不能写多个。
   - 集群所有节点的 graphs/hugegraph.properties 配置必须完全一致(尤其是 
raft.group_peers),端口不能冲突,网络互通,data/wal 路径可区分。
   - 高可用、负载均衡、自动故障切换只能靠 Nginx 或类似的反向代理实现,Java client 
本身不支持这些功能。[参考](https://github.com/apache/incubator-hugegraph/issues/2787) 
[参考2](https://github.com/apache/incubator-hugegraph/issues/2790)
   
   如果直接连节点,建议选 leader 节点(可通过 REST API 查询当前 leader),否则写入操作可能会被重定向或失败。
   
   
   <!-- 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/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/b5614671-54ae-4670-b031-136776b0a57a?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [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/2811)


-- 
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]

Reply via email to