jgroup-raft not working with TCP protocol

55 views
Skip to first unread message

Sanjeev Rai

unread,
Aug 3, 2023, 8:31:36 AM8/3/23
to jgroups-raft
I am using below TCP config which is not  working. i mean nodes are not able to find each other and and no leader is being elected, while if i changed from TCP to UDP (as given by Belaban in Github raft.xml) then its working fine.if jgroup-raft does nt work with TCP or am i missing something :

<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<TCP bind_port="${jgroups.tcp.bind_port:9091}"
 send_buf_size="128K"
 thread_pool.min_threads="2"
 thread_pool.max_threads="100"
 thread_pool.keep_alive_time="5000" />

<TCPPING async_discovery="true"
             initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800],localhost[7801],localhost[7801]}"
             return_entire_cache="${jgroups.tcpping.return_entire_cache:false}"
             port_range="${jgroups.tcp.port_range:2}"/>
    <MERGE3  min_interval="10000"
             max_interval="30000"/>
<FD_SOCK />
<FD_ALL3 />
<VERIFY_SUSPECT timeout="1500" />
<pbcast.NAKACK2 xmit_interval="500"
xmit_table_num_rows="100" xmit_table_msgs_per_row="2000"
xmit_table_max_compaction_time="30000" use_mcast_xmit="false"
discard_delivered_msgs="true" />
<UNICAST3 xmit_interval="500" xmit_table_num_rows="100"
xmit_table_msgs_per_row="2000" xmit_table_max_compaction_time="60000"
conn_expiry_timeout="0" />
<pbcast.STABLE desired_avg_gossip="50000" max_bytes="4M" />
<raft.NO_DUPES />
<pbcast.GMS print_local_addr="true" join_timeout="2000" />
<!--BATCH flush_interval="1" max_batch_size="50" / -->
<UFC max_credits="2M" min_threshold="0.4" />
<MFC max_credits="2M" min_threshold="0.4" />
<FRAG4 frag_size="60K" />
<raft.ELECTION />
<raft.RAFT members="${raft_members:A,B,C}"
raft_id="${raft_id}" log_dir="/rafttest/src/logdir" />
<raft.REDIRECT />
<raft.CLIENT bind_addr="0.0.0.0" />
</config>

Bela Ban

unread,
Aug 3, 2023, 1:04:42 PM8/3/23
to jgroup...@googlegroups.com
Make sure that initial_hosts (default: localhost) matches bind_addr in
TCP. So if A binds to 1.2.3.4:7800 and B to 5.6.7.8:7800, then
initial_hosts should be "1.2.3.4[7800],5.6.7.8[7800]"
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>.

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

Sanjeev Rai

unread,
Aug 5, 2023, 1:12:08 AM8/5/23
to jgroups-raft
I Set bind_addr but still all members are on their Own, xml is same as i sent earlier:

For MemberA output is:
Aug 05, 2023 10:36:16 AM org.jgroups.JChannel setAddress
INFO: local_addr: A, name: A

-------------------------------------------------------------------
GMS: address=A, cluster=raft-cluster, physical address=172.24.48.1:7800
-------------------------------------------------------------------
Aug 05, 2023 10:36:21 AM org.jgroups.protocols.pbcast.ClientGmsImpl joinInternal
INFO: A: no members discovered after 2010 ms: creating cluster as coordinator

for Member B Output is:
Aug 05, 2023 10:36:48 AM org.jgroups.JChannel setAddress
INFO: local_addr: B, name: B

-------------------------------------------------------------------
GMS: address=B, cluster=raft-cluster, physical address=172.24.48.1:7801
-------------------------------------------------------------------
Aug 05, 2023 10:36:53 AM org.jgroups.protocols.pbcast.ClientGmsImpl joinInternal
INFO: B: no members discovered after 2005 ms: creating cluster as coordinator

For Member C output is:

Aug 05, 2023 10:39:03 AM org.jgroups.JChannel setAddress
INFO: local_addr: C, name: C

-------------------------------------------------------------------
GMS: address=C, cluster=raft-cluster, physical address=172.24.48.1:7802
-------------------------------------------------------------------
Aug 05, 2023 10:39:11 AM org.jgroups.protocols.pbcast.ClientGmsImpl joinInternal
INFO: C: no members discovered after 2010 ms: creating cluster as coordinator


Code which i am using to connect is:
System.setProperty("-Djgroups.bind_addr", "localhost[7802]"); //this property i am seeting to localhost[7800],localhost[7801],localhost[7802] for A,B and C
JChannel ch = new JChannel("src/main/resources/raft-tcp.xml").name("C");
// JChannel ch = create("B", 600_000, 1_000_000);
ReplicatedStateMachine<String, String> sm = null;
RaftHandle handle = new RaftHandle(ch, sm = new ReplicatedStateMachine<String, String>(ch)).raftId("C");
ch.connect("raft-cluster");
handle.addRoleListener(role -> {
if (role == Role.Leader) {
System.out.println("isLeader:" + role.name());
this.isLeader = true;
} else {
System.out.println("isLeader:" + role.name());
}
});


Bela Ban

unread,
Aug 5, 2023, 4:16:25 AM8/5/23
to jgroup...@googlegroups.com

Sanjeev Rai

unread,
Aug 5, 2023, 6:17:28 AM8/5/23
to jgroups-raft
thnks Much Bela, Ban. after changing from localhost to IP it did work.

Sanjeev Rai

unread,
Aug 5, 2023, 6:28:26 AM8/5/23
to jgroups-raft
If below version can be used in prod environment :

<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups-raft</artifactId>
<version>1.0.11.Final</version>
</dependency>

Bela Ban

unread,
Aug 5, 2023, 6:44:06 AM8/5/23
to jgroup...@googlegroups.com
Yes, absolutely.

@Jose, we should move the pom.xml's version to 1.0.12.Final-SNAPSHOT
Cheers

On 05.08.23 12:28, Sanjeev Rai wrote:
> If below version can be used in prod environment :
>
> <dependency>
> <groupId>org.jgroups</groupId>
> <artifactId>jgroups-raft</artifactId>
> <version>1.0.11.Final</version>
> </dependency>
>
> On Saturday, 5 August 2023 at 15:47:28 UTC+5:30 Sanjeev Rai wrote:
>
> thnks Much Bela, Ban. after changing from localhost to IP it did work.
>
> On Saturday, 5 August 2023 at 13:46:25 UTC+5:30 Bela Ban wrote:
>
> You cannot use 'localhost' in TCPPING, use 172.24.48.1:7801
> <http://172.24.48.1:7801> etc instead.
> 'localhost' resolves to 127.0.0.1
>
> On 05.08.23 07:12, Sanjeev Rai wrote:
> > I Set bind_addr but still all members are on their Own, xml
> is same as i
> > sent earlier:
> >
> > For MemberA output is:
> > Aug 05, 2023 10:36:16 AM org.jgroups.JChannel setAddress
> > INFO: local_addr: A, name: A
> >
> >
> -------------------------------------------------------------------
> > GMS: address=A, cluster=raft-cluster, physical
> address=172.24.48.1:7800 <http://172.24.48.1:7800>
> >
> -------------------------------------------------------------------
> > Aug 05, 2023 10:36:21 AM
> org.jgroups.protocols.pbcast.ClientGmsImpl
> > joinInternal
> > INFO: A: no members discovered after 2010 ms: creating
> cluster as
> > coordinator
> >
> > for Member B Output is:
> > Aug 05, 2023 10:36:48 AM org.jgroups.JChannel setAddress
> > INFO: local_addr: B, name: B
> >
> >
> -------------------------------------------------------------------
> > GMS: address=B, cluster=raft-cluster, physical
> address=172.24.48.1:7801 <http://172.24.48.1:7801>
> >
> -------------------------------------------------------------------
> > Aug 05, 2023 10:36:53 AM
> org.jgroups.protocols.pbcast.ClientGmsImpl
> > joinInternal
> > INFO: B: no members discovered after 2005 ms: creating
> cluster as
> > coordinator
> >
> > For Member C output is:
> >
> > Aug 05, 2023 10:39:03 AM org.jgroups.JChannel setAddress
> > INFO: local_addr: C, name: C
> >
> >
> -------------------------------------------------------------------
> > GMS: address=C, cluster=raft-cluster, physical
> address=172.24.48.1:7802 <http://172.24.48.1:7802>
> >
> -------------------------------------------------------------------
> > Aug 05, 2023 10:39:11 AM
> org.jgroups.protocols.pbcast.ClientGmsImpl
> > joinInternal
> > INFO: C: no members discovered after 2010 ms: creating
> cluster as
> > coordinator
> >
> >
> > Code which i am using to connect is:
> > System.setProperty("-Djgroups.bind_addr", "localhost[7802]");
> //this
> > property i am seeting to
> localhost[7800],localhost[7801],localhost[7802]
> > for A,B and C
> > JChannel ch = new
> JChannel("src/main/resources/raft-tcp.xml").name("C");
> > // JChannel ch = create("B", 600_000, 1_000_000);
> > ReplicatedStateMachine<String, String> sm = null;
> > RaftHandle handle = new RaftHandle(ch, sm = new
> > ReplicatedStateMachine<String, String>(ch)).raftId("C");
> > ch.connect("raft-cluster");
> > handle.addRoleListener(role -> {
> > if (role == Role.Leader) {
> > System.out.println("isLeader:" + role.name
> <http://role.name>());
> > this.isLeader = true;
> > } else {
> > System.out.println("isLeader:" + role.name
> <http://role.name>());
> > }
> > });
> >
> >
> > On Thursday, 3 August 2023 at 22:34:42 UTC+5:30 Bela Ban wrote:
> >
> > Make sure that initial_hosts (default: localhost) matches
> bind_addr in
> > TCP. So if A binds to 1.2.3.4:7800 <http://1.2.3.4:7800>
> <http://1.2.3.4:7800 <http://1.2.3.4:7800>> and B to
> > 5.6.7.8:7800 <http://5.6.7.8:7800> <http://5.6.7.8:7800
> https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >
> > --
> > Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> >
> > --
> > 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 view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Sanjeev Rai

unread,
Aug 6, 2023, 1:39:23 AM8/6/23
to jgroups-raft
Hi Bela Ban,

Just one thing before i start using in production. I dont find what will be the system requirement for   jgroups-raft-1.0.12.Final, i have done my POC with JDK11. will it run with JDK8 as well or is this require jdk11 and above.
I dont find system requirement page in the Jgroups-raft manual (like jgroups).

Bela Ban

unread,
Aug 6, 2023, 7:59:05 AM8/6/23
to jgroup...@googlegroups.com
Hi Sanjeev

jgroups-raft 1.x uses JGroups 5.x, which requires JDK 11 or higher.

If you have a requirement to use an older JDK (e.g. 8), then you'd have
to pick version 0.5.x or lower, but I don't recommend that as a lot of
work has gone into 1.x.

Cheers,
> > <http://172.24.48.1:7801 <http://172.24.48.1:7801>> etc instead.
> > 'localhost' resolves to 127.0.0.1
> >
> > On 05.08.23 07:12, Sanjeev Rai wrote:
> > > I Set bind_addr but still all members are on their Own, xml
> > is same as i
> > > sent earlier:
> > >
> > > For MemberA output is:
> > > Aug 05, 2023 10:36:16 AM org.jgroups.JChannel setAddress
> > > INFO: local_addr: A, name: A
> > >
> > >
> > -------------------------------------------------------------------
> > > GMS: address=A, cluster=raft-cluster, physical
> > address=172.24.48.1:7800 <http://172.24.48.1:7800>
> <http://172.24.48.1:7800 <http://172.24.48.1:7800>>
> > >
> > -------------------------------------------------------------------
> > > Aug 05, 2023 10:36:21 AM
> > org.jgroups.protocols.pbcast.ClientGmsImpl
> > > joinInternal
> > > INFO: A: no members discovered after 2010 ms: creating
> > cluster as
> > > coordinator
> > >
> > > for Member B Output is:
> > > Aug 05, 2023 10:36:48 AM org.jgroups.JChannel setAddress
> > > INFO: local_addr: B, name: B
> > >
> > >
> > -------------------------------------------------------------------
> > > GMS: address=B, cluster=raft-cluster, physical
> > address=172.24.48.1:7801 <http://172.24.48.1:7801>
> <http://172.24.48.1:7801 <http://172.24.48.1:7801>>
> > >
> > -------------------------------------------------------------------
> > > Aug 05, 2023 10:36:53 AM
> > org.jgroups.protocols.pbcast.ClientGmsImpl
> > > joinInternal
> > > INFO: B: no members discovered after 2005 ms: creating
> > cluster as
> > > coordinator
> > >
> > > For Member C output is:
> > >
> > > Aug 05, 2023 10:39:03 AM org.jgroups.JChannel setAddress
> > > INFO: local_addr: C, name: C
> > >
> > >
> > -------------------------------------------------------------------
> > > GMS: address=C, cluster=raft-cluster, physical
> > address=172.24.48.1:7802 <http://172.24.48.1:7802>
> <http://172.24.48.1:7802 <http://172.24.48.1:7802>>
> > >
> > -------------------------------------------------------------------
> > > Aug 05, 2023 10:39:11 AM
> > org.jgroups.protocols.pbcast.ClientGmsImpl
> > > joinInternal
> > > INFO: C: no members discovered after 2010 ms: creating
> > cluster as
> > > coordinator
> > >
> > >
> > > Code which i am using to connect is:
> > > System.setProperty("-Djgroups.bind_addr", "localhost[7802]");
> > //this
> > > property i am seeting to
> > localhost[7800],localhost[7801],localhost[7802]
> > > for A,B and C
> > > JChannel ch = new
> > JChannel("src/main/resources/raft-tcp.xml").name("C");
> > > // JChannel ch = create("B", 600_000, 1_000_000);
> > > ReplicatedStateMachine<String, String> sm = null;
> > > RaftHandle handle = new RaftHandle(ch, sm = new
> > > ReplicatedStateMachine<String, String>(ch)).raftId("C");
> > > ch.connect("raft-cluster");
> > > handle.addRoleListener(role -> {
> > > if (role == Role.Leader) {
> > > System.out.println("isLeader:" + role.name <http://role.name>
> > <http://role.name <http://role.name>>());
> > > this.isLeader = true;
> > > } else {
> > > System.out.println("isLeader:" + role.name <http://role.name>
> > <http://role.name <http://role.name>>());
> > > }
> > > });
> > >
> > >
> > > On Thursday, 3 August 2023 at 22:34:42 UTC+5:30 Bela Ban wrote:
> > >
> > > Make sure that initial_hosts (default: localhost) matches
> > bind_addr in
> > > TCP. So if A binds to 1.2.3.4:7800 <http://1.2.3.4:7800>
> <http://1.2.3.4:7800 <http://1.2.3.4:7800>>
> > <http://1.2.3.4:7800 <http://1.2.3.4:7800> <http://1.2.3.4:7800
> <http://1.2.3.4:7800>>> and B to
> > > 5.6.7.8:7800 <http://5.6.7.8:7800> <http://5.6.7.8:7800
> <http://5.6.7.8:7800>> <http://5.6.7.8:7800 <http://5.6.7.8:7800>
> https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>>>>.
> > >
> > > --
> > > Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> > <http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>>
> > >
> > > --
> > > 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 view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >
> > --
> > Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> >
> > --
> > 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 view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Sanjeev Rai

unread,
Aug 7, 2023, 1:11:47 AM8/7/23
to jgroups-raft
thnks Much :)

Sanjeev Rai

unread,
Aug 16, 2023, 7:22:21 AM8/16/23
to jgroups-raft
Hi Bela Ban,

if you dont mind could you please clarify below points:

1- is this always necessary to have odd number of nodes for using jgroup raft.
2- Suppose we are starting with only two nodes and one node becoming leader, and then network partition happen. I understand that since no one have majority so no leader will be elected. But what will happen when the network merge, if leader election will again happen and a leader will be selected with majority votes (out of 2 nodes ).

Bela Ban

unread,
Aug 16, 2023, 7:27:45 AM8/16/23
to jgroup...@googlegroups.com


On 16.08.23 13:22, Sanjeev Rai wrote:
> Hi Bela Ban,
>
> if you dont mind could you please clarify below points:
>
> 1- is this always necessary to have odd number of nodes for using jgroup
> raft.


No; for edge unit test cases, we even test a single node (which always
has the majority)!

Usually people deploy 3 or more nodes though...


> 2- Suppose we are starting with only two nodes and one node becoming
> leader, and then network partition happen. I understand that since no
> one have majority so no leader will be elected. But what will happen
> when the network merge, if leader election will again happen and a
> leader will be selected with majority votes (out of 2 nodes ).


Yes: if you have A and B, (say) A becomes leader.

Now the partiton happens. A will step down as leader, as it doesn't have
a majority. B will also not become leader, as it needs 2 votes, but only
gets its own vote.

When there is a merge, a leader election is started. The member with
most votes (2) *and the longest long* will become new leader.
> https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com>>>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/5ab6f46f-77b3-464e-bd12-cc86b110a6aan%40googlegroups.com?utm_medium=email&utm_source=footer>>>>>.
> > > >
> > > > --
> > > > Bela Ban | http://www.jgroups.org
> <http://www.jgroups.org> <http://www.jgroups.org
> <http://www.jgroups.org>>
> > <http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>>
> > > <http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> > <http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>>>
> > > >
> > > > --
> > > > 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 view this discussion on the web visit
> > > >
> > >
> >
> https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com>>> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer>> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/d4acca45-1fa4-4fd4-842d-0ad0347aaef9n%40googlegroups.com?utm_medium=email&utm_source=footer>>>>.
> > >
> > > --
> > > Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> > <http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>>
> > >
> > > --
> > > 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 view this discussion on the web visit
> > >
> >
> https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com>> <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/2992b1a7-4e09-4fdf-99d3-1c4ab803130bn%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >
> > --
> > Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
> <http://www.jgroups.org <http://www.jgroups.org>>
> >
> > --
> > 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 view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com> <https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/jgroups-raft/4fe50b4b-261c-472f-ba88-4827ad737044n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> Bela Ban | http://www.jgroups.org <http://www.jgroups.org>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/jgroups-raft/9c2c66c1-e340-4aec-a07e-ea7e7b878f3cn%40googlegroups.com <https://groups.google.com/d/msgid/jgroups-raft/9c2c66c1-e340-4aec-a07e-ea7e7b878f3cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Sanjeev Rai

unread,
Aug 16, 2023, 7:53:00 AM8/16/23
to jgroups-raft
thnks Much As always very quick response and clarify all doubts.
Reply all
Reply to author
Forward
0 new messages