Hi Mahesh, Thanks for exploring Ratis! Unfortunately the arithmetic example does not support role changes currently ;(
For membership change examples, please refer to example/membership in latest 3.0 version. You can find the relevant code here https://github.com/apache/ratis/blob/53831534c69309688ce379006363e645bf42b654/ratis-examples/src/main/java/org/apache/ratis/examples/membership/server/RaftCluster.java#L68 When changing from (n0, n1, n2) to (n0, n1, n3), you can follow these steps 1. Start n3 with an EMPTY group configuration. 2. Send a setConfiguration([n0, n1, n3]) request to the existing group. 3. Once 2 is executed successfully, you can now safely shutdown n2 and clean up the data. In arithmetic example, n3 is started with the intended new group(n0, n1, n3) but Step 2 is not executed. Without this, the original group (n0, n1, n2) remains unaware of the new configuration and continues to operate under the assumption that the group consists of (n0, n1, n2). This lead to n3 being rejected and shutdown. Best Regards, William > 2023年12月12日 04:54,Mahesh Garlapati <[email protected]> > 写道: > > Hello team, > > I initiated three nodes, namely n0, n1, and n2, using the following commands: > > ID=n0; ${BIN}/server.sh arithmetic server --id ${ID} --storage > /tmp/ratis/${ID} --peers ${PEERS} > ID=n1; ${BIN}/server.sh arithmetic server --id ${ID} --storage > /tmp/ratis/${ID} --peers ${PEERS} > ID=n2; ${BIN}/server.sh arithmetic server --id ${ID} --storage > /tmp/ratis/${ID} --peers ${PEERS} > > Based on the logs, it appears that n2 is the leader: > > INFO StateMachine:166 - LEADER:n2-1: a = 10 = 10 > > However, when I attempted to stop the n2 node (leader) and start a new node, > n3, with peers n0, n1, and n3, the n3 server failed to start. Attached are > the log files for review. > > I am seeking assistance in understanding the reason for this error preventing > the successful start of the n3 node. > > In another scenario: > > I started three nodes, n0, n1, and n2, using similar commands, and logs > indicated that n1 was the leader: > > INFO StateMachine:166 - LEADER:n1-1: a = 10 = 10 > > Upon stopping the non-leader node, n2, I attempted to start a new node, n3, > with peers n0, n1, and n3. The n3 server started but generated errors such as: > > 2023-12-11 12:43:13 INFO RaftServer$Division:377 - n3@group-6F7570313233: > changes role from CANDIDATE to FOLLOWER at term 1 for REJECTED > > These errors were resolved by running the append command using the admin > client. > > I appreciate your assistance in resolving this issues. > > Thanks, > Mahesh Reddy > > CONFIDENTIALITY NOTICE This e-mail message and any attachments are only for > the use of the intended recipient and may contain information that is > privileged, confidential or exempt from disclosure under applicable law. If > you are not the intended recipient, any disclosure, distribution or other use > of this e-mail message or attachments is prohibited. If you have received > this e-mail message in error, please delete and notify the sender > immediately. Thank you. <log.txt>
