Can we use weighted leader election? (And java 7 question)

60 views
Skip to first unread message

Joe Fair

unread,
Jun 2, 2017, 10:18:01 AM6/2/17
to jgroups-raft
I have 8 servers in two datacenters.  I'd prefer servers 1-4 to be a leader if available, and 5-8 to be a leader if 1-4 is down.

I currently have a system that uses weighted values (100, 200, etc.) and the highest one is the leader.

Can that be done in jgroups-raft?  Where would you suggest I start?

Also, is there already a port of java 7?
Thx,
Joe

Bela Ban

unread,
Jun 6, 2017, 2:26:17 AM6/6/17
to jgroup...@googlegroups.com
Hi Joe,

On 02/06/17 16:18, Joe Fair wrote:
> I have 8 servers in two datacenters. I'd prefer servers 1-4 to be a
> leader if available, and 5-8 to be a leader if 1-4 is down.
> I currently have a system that uses weighted values (100, 200, etc.) and
> the highest one is the leader.
>
> Can that be done in jgroups-raft? Where would you suggest I start?

This is possible in JGroups itself [1], but not in jgroups-raft. The
reason is that jgroups-raft implements the Raft election specification
pretty closely [2], and Raft knows no weighted election.

There are 2 criteria for leader election: (1) majority of votes and (2)
highest log index. (1) could be weighted, but not (2). For example, if
you have a leader election and server 6 has the highest log index (e.g.
after a network partition healed), then none of servers 1-4 should
become leader, but server 6 should become leader.

So, in a nutshell, I believe adding weighted election would break the
semantics of Raft.

> Also, is there already a port of java 7?

What do you mean? jgroups-raft works on Java 8, but still uses JGroups
3.6.x. Do you mean upgrading jgroups-raft to use JGroups 4.0?

Cheers

[1] http://www.jgroups.org/manual4/index.html#MembershipChangePolicy
[2]
https://github.com/belaban/jgroups-raft/blob/master/src/org/jgroups/protocols/raft/ELECTION.java

> Thx,
> Joe
>
> --
> You received this message because you are subscribed to the Google
> Groups "jgroups-raft" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jgroups-raft...@googlegroups.com
> <mailto:jgroups-raft...@googlegroups.com>.
> To post to this group, send email to jgroup...@googlegroups.com
> <mailto:jgroup...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-raft/1519ece6-8934-4834-82e7-3b5951310829%40googlegroups.com
> <https://groups.google.com/d/msgid/jgroups-raft/1519ece6-8934-4834-82e7-3b5951310829%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Bela Ban | http://www.jgroups.org

Reply all
Reply to author
Forward
0 new messages