Add replicator support to net/ (#4494)
This commit is contained in:
parent
1c1d83bd56
commit
ce04d2bfc2
|
@ -36,6 +36,9 @@ clientIpListZone=()
|
|||
blockstreamerIpList=()
|
||||
blockstreamerIpListPrivate=()
|
||||
blockstreamerIpListZone=()
|
||||
replicatorIpList=()
|
||||
replicatorIpListPrivate=()
|
||||
replicatorIpListZone=()
|
||||
|
||||
buildSshOptions() {
|
||||
sshOptions=(
|
||||
|
|
36
net/gce.sh
36
net/gce.sh
|
@ -18,6 +18,7 @@ gce)
|
|||
fullNodeMachineType=$cpuBootstrapLeaderMachineType
|
||||
clientMachineType="--custom-cpu 16 --custom-memory 20GB"
|
||||
blockstreamerMachineType="--machine-type n1-standard-8"
|
||||
replicatorMachineType="--custom-cpu 4 --custom-memory 16GB"
|
||||
;;
|
||||
ec2)
|
||||
# shellcheck source=net/scripts/ec2-provider.sh
|
||||
|
@ -33,6 +34,7 @@ ec2)
|
|||
fullNodeMachineType=$cpuBootstrapLeaderMachineType
|
||||
clientMachineType=c5.2xlarge
|
||||
blockstreamerMachineType=c5.2xlarge
|
||||
replicatorMachineType=c5.xlarge
|
||||
;;
|
||||
azure)
|
||||
# shellcheck source=net/scripts/azure-provider.sh
|
||||
|
@ -45,6 +47,7 @@ azure)
|
|||
fullNodeMachineType=$cpuBootstrapLeaderMachineType
|
||||
clientMachineType=Standard_D16s_v3
|
||||
blockstreamerMachineType=Standard_D16s_v3
|
||||
replicatorMachineType=Standard_D4s_v3
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown cloud provider: $cloudProvider"
|
||||
|
@ -55,9 +58,11 @@ esac
|
|||
prefix=testnet-dev-${USER//[^A-Za-z0-9]/}
|
||||
additionalFullNodeCount=5
|
||||
clientNodeCount=1
|
||||
replicatorNodeCount=0
|
||||
blockstreamer=false
|
||||
fullNodeBootDiskSizeInGb=1000
|
||||
clientBootDiskSizeInGb=75
|
||||
replicatorBootDiskSizeInGb=1000
|
||||
externalNodes=false
|
||||
failOnValidatorBootupFailure=true
|
||||
|
||||
|
@ -104,6 +109,7 @@ Manage testnet instances
|
|||
create-specific options:
|
||||
-n [number] - Number of additional fullnodes (default: $additionalFullNodeCount)
|
||||
-c [number] - Number of client nodes (default: $clientNodeCount)
|
||||
-r [number] - Number of replicator nodes (default: $replicatorNodeCount)
|
||||
-u - Include a Blockstreamer (default: $blockstreamer)
|
||||
-P - Use public network IP addresses (default: $publicNetwork)
|
||||
-g - Enable GPU (default: $enableGpu)
|
||||
|
@ -137,7 +143,7 @@ shift
|
|||
[[ $command = create || $command = config || $command = info || $command = delete ]] ||
|
||||
usage "Invalid command: $command"
|
||||
|
||||
while getopts "h?p:Pn:c:z:gG:a:d:uxf" opt; do
|
||||
while getopts "h?p:Pn:c:r:z:gG:a:d:uxf" opt; do
|
||||
case $opt in
|
||||
h | \?)
|
||||
usage
|
||||
|
@ -155,6 +161,9 @@ while getopts "h?p:Pn:c:z:gG:a:d:uxf" opt; do
|
|||
c)
|
||||
clientNodeCount=$OPTARG
|
||||
;;
|
||||
r)
|
||||
replicatorNodeCount=$OPTARG
|
||||
;;
|
||||
z)
|
||||
containsZone "$OPTARG" "${zones[@]}" || zones+=("$OPTARG")
|
||||
;;
|
||||
|
@ -449,9 +458,7 @@ EOF
|
|||
done
|
||||
fi
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Let's not reset the current client configuration"
|
||||
else
|
||||
if ! $externalNodes; then
|
||||
echo "clientIpList=()" >> "$configFile"
|
||||
echo "clientIpListPrivate=()" >> "$configFile"
|
||||
fi
|
||||
|
@ -461,9 +468,7 @@ EOF
|
|||
cloud_ForEachInstance recordInstanceIp true clientIpList
|
||||
}
|
||||
|
||||
if $externalNodes; then
|
||||
echo "Let's not reset the current blockstream configuration"
|
||||
else
|
||||
if ! $externalNodes; then
|
||||
echo "blockstreamerIpList=()" >> "$configFile"
|
||||
echo "blockstreamerIpListPrivate=()" >> "$configFile"
|
||||
fi
|
||||
|
@ -473,6 +478,16 @@ EOF
|
|||
cloud_ForEachInstance recordInstanceIp true blockstreamerIpList
|
||||
}
|
||||
|
||||
if ! $externalNodes; then
|
||||
echo "replicatorIpList=()" >> "$configFile"
|
||||
echo "replicatorIpListPrivate=()" >> "$configFile"
|
||||
fi
|
||||
echo "Looking for replicator instances..."
|
||||
cloud_FindInstances "$prefix-replicator"
|
||||
[[ ${#instances[@]} -eq 0 ]] || {
|
||||
cloud_ForEachInstance recordInstanceIp true replicatorIpList
|
||||
}
|
||||
|
||||
echo "Wrote $configFile"
|
||||
$metricsWriteDatapoint "testnet-deploy net-config-complete=1"
|
||||
}
|
||||
|
@ -526,6 +541,7 @@ create)
|
|||
Bootstrap leader = $bootstrapLeaderMachineType (GPU=$enableGpu)
|
||||
Additional fullnodes = $additionalFullNodeCount x $fullNodeMachineType
|
||||
Client(s) = $clientNodeCount x $clientMachineType
|
||||
Replicators(s) = $replicatorNodeCount x $replicatorMachineType
|
||||
Blockstreamer = $blockstreamer
|
||||
========================================================================================
|
||||
|
||||
|
@ -659,6 +675,12 @@ EOF
|
|||
"$startupScript" "$blockstreamerAddress" "$bootDiskType"
|
||||
fi
|
||||
|
||||
if [[ $replicatorNodeCount -gt 0 ]]; then
|
||||
cloud_CreateInstances "$prefix" "$prefix-replicator" "$replicatorNodeCount" \
|
||||
false "$replicatorMachineType" "${zones[0]}" "$replicatorBootDiskSizeInGb" \
|
||||
"$startupScript" "" ""
|
||||
fi
|
||||
|
||||
$metricsWriteDatapoint "testnet-deploy net-create-complete=1"
|
||||
|
||||
prepareInstancesAndWriteConfigFile
|
||||
|
|
14
net/net.sh
14
net/net.sh
|
@ -476,10 +476,13 @@ start() {
|
|||
declare bootstrapLeader=true
|
||||
declare nodeType=validator
|
||||
declare loopCount=0
|
||||
for ipAddress in "${fullnodeIpList[@]}" - "${blockstreamerIpList[@]}"; do
|
||||
if [[ $ipAddress = - ]]; then
|
||||
for ipAddress in "${fullnodeIpList[@]}" b "${blockstreamerIpList[@]}" r "${replicatorIpList[@]}"; do
|
||||
if [[ $ipAddress = b ]]; then
|
||||
nodeType=blockstreamer
|
||||
continue
|
||||
elif [[ $ipAddress = r ]]; then
|
||||
nodeType=replicator
|
||||
continue
|
||||
fi
|
||||
if $updateNodes; then
|
||||
stopNode "$ipAddress" true
|
||||
|
@ -570,7 +573,7 @@ start() {
|
|||
echo
|
||||
echo "+++ Deployment Successful"
|
||||
echo "Bootstrap leader deployment took $bootstrapNodeDeployTime seconds"
|
||||
echo "Additional fullnode deployment (${#fullnodeIpList[@]} full nodes, ${#blockstreamerIpList[@]} blockstreamer nodes) took $additionalNodeDeployTime seconds"
|
||||
echo "Additional fullnode deployment (${#fullnodeIpList[@]} full nodes, ${#blockstreamerIpList[@]} blockstreamer nodes, ${#replicatorIpList[@]} replicators) took $additionalNodeDeployTime seconds"
|
||||
echo "Client deployment (${#clientIpList[@]} instances) took $clientDeployTime seconds"
|
||||
echo "Network start logs in $netLogDir"
|
||||
}
|
||||
|
@ -614,7 +617,7 @@ stop() {
|
|||
|
||||
declare loopCount=0
|
||||
pids=()
|
||||
for ipAddress in "${fullnodeIpList[@]}" "${blockstreamerIpList[@]}" "${clientIpList[@]}"; do
|
||||
for ipAddress in "${fullnodeIpList[@]}" "${blockstreamerIpList[@]}" "${replicatorIpList[@]}" "${clientIpList[@]}"; do
|
||||
stopNode "$ipAddress" false
|
||||
|
||||
# Stagger additional node stop time to avoid too many concurrent ssh
|
||||
|
@ -673,6 +676,9 @@ logs)
|
|||
for ipAddress in "${blockstreamerIpList[@]}"; do
|
||||
fetchRemoteLog "$ipAddress" fullnode
|
||||
done
|
||||
for ipAddress in "${replicatorIpList[@]}"; do
|
||||
fetchRemoteLog "$ipAddress" fullnode
|
||||
done
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
@ -148,6 +148,16 @@ local|tar)
|
|||
nohup ./multinode-demo/validator.sh "${args[@]}" > fullnode.log 2>&1 &
|
||||
sleep 1
|
||||
;;
|
||||
replicator)
|
||||
args=(
|
||||
"$entrypointIp":~/solana "$entrypointIp:8001"
|
||||
)
|
||||
if [[ $skipSetup != true ]]; then
|
||||
./multinode-demo/clear-config.sh
|
||||
fi
|
||||
nohup ./multinode-demo/replicator.sh "${args[@]}" > fullnode.log 2>&1 &
|
||||
sleep 1
|
||||
;;
|
||||
*)
|
||||
echo "Error: unknown node type: $nodeType"
|
||||
exit 1
|
||||
|
|
|
@ -72,6 +72,15 @@ else
|
|||
done
|
||||
fi
|
||||
echo
|
||||
echo Replicators:
|
||||
if [[ ${#replicatorIpList[@]} -eq 0 ]]; then
|
||||
echo " None"
|
||||
else
|
||||
for ipAddress in "${replicatorIpList[@]}"; do
|
||||
printNode replicator "$ipAddress"
|
||||
done
|
||||
fi
|
||||
echo
|
||||
echo "Use |scp.sh| to transfer files to and from nodes"
|
||||
echo
|
||||
|
||||
|
|
Loading…
Reference in New Issue