Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions devnet/scripts/active-sequencer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ echo "Sequencer successfully activated"
SERVER_COUNT=$(curl -sS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_clusterMembership","params":[],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT | jq '.result.servers | length')
if (( $SERVER_COUNT < 3 )); then
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_addServerAsVoter","params":["conductor-2", "op-conductor2:50050", 0],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_addServerAsVoter","params":["conductor-3", "op-conductor3:50050", 0],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_addServerAsNonvoter","params":["conductor-3", "op-conductor3:50050", 0],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT
SERVER_COUNT=$(curl -sS -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_clusterMembership","params":[],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT | jq '.result.servers | length')
if (( $SERVER_COUNT != 3 )); then
echo "unexpected server count, expected: 3, real: $SERVER_COUNT"
exit 1
fi

echo "add 2 new voters to raft consensus cluster successfully!"
echo "add 1 voter and 1 nonvoter to raft consensus cluster successfully!"
fi
34 changes: 34 additions & 0 deletions devnet/scripts/promote-nonvoter-to-voter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Function to detect leader conductor and set ports
detect_leader() {
echo "Detecting leader conductor..."

# Check all three conductors to find the leader
for i in 1 2 3; do
CONDUCTOR_PORT=$((8546 + i)) # 8547, 8548, 8549
SEQUENCER_PORT=$((9544 + i)) # 9545, 9546, 9547

IS_LEADER=$(curl -sS -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"conductor_leader","params":[],"id":1}' \
http://localhost:$CONDUCTOR_PORT 2>/dev/null | jq -r '.result' 2>/dev/null)

if [ "$IS_LEADER" = "true" ]; then
LEADER_CONDUCTOR_PORT=$CONDUCTOR_PORT
LEADER_SEQUENCER_PORT=$SEQUENCER_PORT
echo "Found leader: Conductor $i (conductor port: $LEADER_CONDUCTOR_PORT, sequencer port: $LEADER_SEQUENCER_PORT)"
return 0
else
echo "Conductor $i (port $CONDUCTOR_PORT): not leader (result: $IS_LEADER)"
fi
done

echo "Error: No leader conductor found!"
exit 1
}

# Detect leader conductor and set ports
detect_leader


curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"conductor_addServerAsVoter","params":["conductor-3", "op-conductor3:50050", 0],"id":1}' http://localhost:$LEADER_CONDUCTOR_PORT