A guide on how to combine your nodes power into one for improved rewards.
IMPORTANT: Backup your store files before committing to this change.
Requirements:
List of IP address of your nodes: you can generate your dataWorkerMultiaddrs here: https://jsfiddle.net/5e4jodxs/
List of cores of your nodes.
gRPC enabled - see the guide here on how to enable gRPC: https://docs.quilibrium.one/quilibrium-node-setup-guide/set-up-the-grpc-calls#how-to-enable-grpc-calls-manually
Configuration
Open your config.yml file in the /node/.config folder
Under Engine category fill the dataWorkerMultiaddrs section with the list of the IPs of your nodes like so:
dataWorkerMultiaddrs: [
"/ip4/192.168.1.112/tcp/40001",
"/ip4/192.168.1.112/tcp/40002",
"/ip4/192.168.1.112/tcp/40003",
"/ip4/192.168.1.121/tcp/40001",
"/ip4/192.168.1.121/tcp/40002",
"/ip4/192.168.1.121/tcp/40003",
"/ip4/192.168.1.121/tcp/40004",
"/ip4/192.168.1.123/tcp/40001",
"/ip4/192.168.1.123/tcp/40002",
"/ip4/192.168.1.123/tcp/40003",
"/ip4/192.168.1.123/tcp/40004"
]
Above is the setup for an 3 x (4 cores) - 12 cores total, 1 core is reserved for task scheduling - machine clusters, note 40001 - 40004, with more cores increment the port 40005... 40006... and so on.
NOTE: 1 core is reserved for scheduling tasks on the first machine. Therefore only 3 data workers are listed on the dataWorkerMultiaddrs configuration for the first node.Apply this configuration to all the nodes in the cluster.
Run
To run nodes in parallel, you need a custom script. Copy the code below and save it as para.sh to the /node folder.
#!/bin/sh
DIR_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
os=$1
architecture=$2
startingCore=$3
maxCores=$4
pid=$$
version=$5
crashed=0
start_process() {
pkill node-*
if [ $startingCore == 0 ]
then
$DIR_PATH/node-$version-$os-$architecture &
pid=$!
if [ $crashed == 0 ]
then
maxCores=$(expr $maxCores - 1)
fi
fi
echo Node parent ID: $pid;
echo Max Cores: $maxCores;
echo Starting Core: $startingCore;
for i in $(seq 1 $maxCores)
do
echo Deploying: $(expr $startingCore + $i) data worker with params: --core=$(expr $startingCore + $i) --parent-process=$pid;
$DIR_PATH/node-$version-$os-$architecture --core=$(expr $startingCore + $i) --parent-process=$pid &
done
}
is_process_running() {
ps -p $pid > /dev/null 2>&1
return $?
}
start_process
while true
do
if ! is_process_running; then
echo "Process crashed or stopped. restarting..."
crashed=$(expr $crashed + 1)
start_process
fi
sleep 440
done
Run the data workers (slaves first, master last):
bash para.sh <os> <architecture> <starting core> <max cores> <version>
# Run node 3 Example - in machine 3 (Slave)
bash para.sh darwin arm64 7 4 1.4.20
# Run node 2 Example - in machine 2 (Slave)
bash para.sh darwin arm64 3 4 1.4.20
# Run node 1 Example - in machine 1 (Master)
bash para.sh darwin arm64 0 4 1.4.20
![highlight](/api/highlight?text=Quil%20Parallel%20Nodes%20Guide&author=Kingcaster&url=%40kingcaster&avatarUrl=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Faec8b9118a334bfc125523e9c0b8632c.jpg&featuredImageUrl=&size=512)
![Kingcaster logo](/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Faec8b9118a334bfc125523e9c0b8632c.jpg&w=384&q=75)