1.5.0版本hugegraph.properties配置集群报错
Bug Type (问题类型)
None
Before submit
- [x] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
- Server Version: 1.5.0 (Apache Release Version)
- Backend: RocksDB
- OS:32 CPUs, 64G RAM, KylinV10
- Data Size: xx vertices, xx edges
Expected & Actual behavior (期望与实际表现)
hugegraph.properties配置如下
gremlin.graph=org.apache.hugegraph.HugeFactory vertex.cache_type=l2 edge.cache_type=l2 backend=rocksdb serializer=binary store=hugegraph task.scheduler_type=local task.schedule_period=10 task.retry=0 task.wait_timeout=10 search.text_analyzer=jieba search.text_analyzer_mode=INDEX rocksdb.data_path=./data rocksdb.wal_path=./wal raft.mode=true raft.group_peers=192.168.230.128:8091,192.168.230.129:8092,192.168.230.130:8093
rest-server.properties配置如下
server.id=server-2 server.role=worker rpc.server_host=192.168.230.129 rpc.server_port=8092 rpc.server_timeout=30 rpc.remote_url=192.168.230.128:8091,192.168.230.129:8092,192.168.230.130:8093
如果 raft.mode=true 不写的话则不会开启集群功能
[root@localhost bin]# curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/list_peers" |jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 139 100 139 0 0 2194 0 --:--:-- --:--:-- --:--:-- 2241 { "exception": "class org.apache.hugegraph.HugeException", "message": "Allowed list_peers operation only when working on raft mode", "cause": "" }
如果 raft.mode=true 但是如果开启,
`
[root@localhost bin]# ./start-hugegraph.sh
Starting HugeGraphServer in daemon mode...
Connecting to HugeGraphServer (http://0.0.0.0:8080/graphs)...............
The operation timed out(30s) when attempting to connect to http://0.0.0.0:8080/graphs
See /home/apache-hugegraph-incubating-1.5.0/apache-hugegraph-server-incubating-1.5.0/logs/hugegraph-server.log for HugeGraphServer log output.
会报错,但是等一会通过验证集群是正常的
[root@localhost logs]# curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/list_peers" |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 84 100 84 0 0 380 0 --:--:-- --:--:-- --:--:-- 392
{
"hugegraph": [
"192.168.230.128:8091",
"192.168.230.129:8092",
"192.168.230.130:8093"
]
}
[root@localhost bin]# curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/get_leader" |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 1947 0 --:--:-- --:--:-- --:--:-- 2000
{
"hugegraph": "192.168.230.128:8091"
}
`
Vertex/Edge example (问题点 / 边数据举例)
所以如果要开启集群那么 raft.mode=true 这个参数是必须要写的,但是在之前lssues反馈中却说raft.mode=true已经废弃,只需要写raft.group_peers=192.168.230.128:8091,192.168.230.129:8092,192.168.230.130:8093 这个参数就自动开启集群模式,这个显然是错误的。
上诉启动报错是否是因为超时的原因
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
你的分析基本正确,但有几点需要澄清和补充:
-
raft.mode 是否必须
在 HugeGraph 1.5.0 版本,raft.mode 已经被废弃,只要配置了raft.group_peers,就会自动启用 Raft 集群模式,无需再写raft.mode=true。如果你发现不写raft.mode=true无法启用集群,建议检查下所有节点的hugegraph.properties配置是否完全一致,尤其是raft.group_peers、端口等参数。 -
配置文件位置
raft.group_peers必须写在每个节点的graphs/hugegraph.properties文件里,不能写在 rest-server.properties。 -
启动超时原因
你遇到的启动超时(比如 30s 连接超时),主要原因是 Raft 集群启动和选主需要一定时间,期间 REST 服务端口还未完全 ready,或者 leader 选举还没完成。HugeGraph 内部 raft 相关代码(如 RaftNode、RaftContext)会等待 leader 选举和日志同步,超时会报错,但通常等一会集群就会正常工作(如你后续 curl 查询 raft 状态是正常的)源码参考。 -
建议
- 不要再写
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 等)。
相关讨论和源码可参考:
如还有具体日志报错,可以贴出来进一步分析。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
1.5.0版本 如果不写 raft.mode=true 无法启用集群,每个节点都是单节点的状态允许。上面我已经提供api请求查询节点状态的信息,显示非集群状态 所有节点的 hugegraph.properties 配置完全一致,尤其是 raft.group_peers、端口等参数是完全一致的
1.5.0版本 如果不写 raft.mode=true 无法启用集群,每个节点都是单节点的状态允许。上面我已经提供api请求查询节点状态的信息,显示非集群状态 所有节点的 hugegraph.properties 配置完全一致,尤其是 raft.group_peers、端口等参数是完全一致的
@wanwancloud refer here https://github.com/apache/incubator-hugegraph/issues/2787#issuecomment-2954951182
最新的代码里, 配置文件这里过时的 raft 参数已经全部移除了, 不会再对用户产生误导:
建议官方文档更新一下,踩坑踩了很多。从cassandra到Rocksdb ,特别是集群部署官方文档中没有提及,只有单机部署。
建议官方文档更新一下,踩坑踩了很多。从cassandra到Rocksdb ,特别是集群部署官方文档中没有提及,只有单机部署。
@wanwancloud 感谢建议, 文档结构已经做了大的重构和改进, 后续会快速同步更多的子文档了
refer: https://hugegraph.apache.org/docs/quickstart/hugegraph/