sofastack / sofa-jraft

A production-grade java implementation of RAFT consensus algorithm.
https://www.sofastack.tech/projects/sofa-jraft/
Apache License 2.0
3.59k stars 1.15k forks source link

How MULTI-RAFT-GROUP can achieve leader balance in all nodes? #476

Closed runzhiwang closed 4 years ago

runzhiwang commented 4 years ago

Your question

For example, in MULTI-RAFT-GROUP, there are 3 nodes partitipate in 3 raft groups. But how we can avoid one node act as leader in all 3 raft groups ? If one node act as leader in all 3 raft groups, it's pressure is very high.

fengjiachun commented 4 years ago

rebalance api: https://github.com/sofastack/sofa-jraft/blob/master/jraft-core/src/main/java/com/alipay/sofa/jraft/CliService.java#L190

runzhiwang commented 4 years ago

@fengjiachun Thanks for explanation. One more question, rebalance api is rebalance leader when leader has been elected, so do sofa-jraft can consider the node load when leader election ? For example, if node1 has been elected as leader in group1, it will not be elected as leader in group2 again.

fengjiachun commented 4 years ago

Currently, there is no correlation between the different raft groups,but maybe you can try priority-election

runzhiwang commented 4 years ago

@fengjiachun Thank you very much.