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