跳转至

Storage 负载均衡

用户可以使用SUBMIT JOB BALANCE语句平衡 Raft leader 的分布。详情请参见 SUBMIT JOB BALANCE

Danger

SUBMIT JOB BALANCE命令通过创建和执行一组子任务来迁移数据和均衡分片分布,禁止停止集群中的任何机器或改变机器的 IP 地址,直到所有子任务完成,否则后续子任务会失败。

均衡 leader 分布

用户可以使用命令SUBMIT JOB BALANCE LEADER均衡分布所有图空间中的 Leader 分片副本。

示例

nebula> SUBMIT JOB BALANCE LEADER;

用户可以执行SHOW HOSTS检查结果。

nebula> SHOW HOSTS;
+------------------+------+----------+--------------+-----------------------------------+------------------------+---------+
| Host             | Port | Status   | Leader count | Leader distribution               | Partition distribution | Version |
+------------------+------+----------+--------------+-----------------------------------+------------------------+---------+
| "192.168.10.100" | 9779 | "ONLINE" | 4            | "basketballplayer:3"              | "basketballplayer:8"   | "3.8.0" |
| "192.168.10.101" | 9779 | "ONLINE" | 8            | "basketballplayer:3"              | "basketballplayer:8"   | "3.8.0" |
| "192.168.10.102" | 9779 | "ONLINE" | 3            | "basketballplayer:3"              | "basketballplayer:8"   | "3.8.0" |
| "192.168.10.103" | 9779 | "ONLINE" | 0            | "basketballplayer:2"              | "basketballplayer:7"   | "3.8.0" |
| "192.168.10.104" | 9779 | "ONLINE" | 0            | "basketballplayer:2"              | "basketballplayer:7"   | "3.8.0" |
| "192.168.10.105" | 9779 | "ONLINE" | 0            | "basketballplayer:2"              | "basketballplayer:7"   | "3.8.0" |
+------------------+------+-----------+----------+--------------+-----------------------------------+------------------------+---------+

Caution

在 NebulaGraph 3.8.0 中,Leader 分片副本切换期间,Leader 分片副本会被暂时禁止写入直到切换完成。如果在 Leader 分片副本切换期间,有大量的写入请求,将会导致请求错误(Storage Error E_RPC_FAILURE),错误处理方法见 FAQ

用户可以在 Storage 配置文件中设置raft_heartbeat_interval_secs的值来控制 Leader 副本切换的超时时间。有关配置文件的详细信息,请参见 Storage 配置文件


最后更新: September 6, 2024