From 3747d8caadb09f1a0a59139baad87d7d3e352cac Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 22 Jun 2018 11:37:42 -0700 Subject: [PATCH 1/2] Run multiple instances from same workspace * Support running leader and validators from multiple machines using the same NFS mounted workspace. * Changes to setup, leader and validator scripts --- multinode-demo/leader.sh | 8 ++++++++ multinode-demo/setup.sh | 10 ++++++++-- multinode-demo/validator.sh | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/multinode-demo/leader.sh b/multinode-demo/leader.sh index 6a9f72b48999b6..b489b4fbfe9f3a 100755 --- a/multinode-demo/leader.sh +++ b/multinode-demo/leader.sh @@ -6,5 +6,13 @@ export RUST_LOG=${RUST_LOG:-solana=info} set -x [[ $(uname) = Linux ]] && sudo sysctl -w net.core.rmem_max=26214400 +IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" + +if [ -z "$IPADDR" ]; then + IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" +fi + +cp leader-$IPADDR.json leader.json + cargo run --release --bin solana-fullnode -- \ -l leader.json < genesis.log tx-*.log > tx-"$(date -u +%Y%m%d%k%M%S%N)".log diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index c2f5fa1da999f4..f2a704bd293616 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -5,5 +5,11 @@ TOKENS=${1:-1000000000} cargo run --release --bin solana-mint-demo <<<"${TOKENS}" > mint-demo.json cargo run --release --bin solana-genesis-demo < mint-demo.json > genesis.log -cargo run --release --bin solana-fullnode-config -- -d > leader.json -cargo run --release --bin solana-fullnode-config -- -b 9000 -d > validator.json +IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" + +if [ -z "$IPADDR" ]; then + IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" +fi + +cargo run --release --bin solana-fullnode-config -- -d > leader-$IPADDR.json +cargo run --release --bin solana-fullnode-config -- -b 9000 -d > validator-$IPADDR.json diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index be854970d246d4..64961ed4f864ab 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -16,5 +16,11 @@ rsync -v "$LEADER"/{mint-demo.json,leader.json,genesis.log,tx-*.log} . || exit $ # if RUST_LOG is unset, default to info export RUST_LOG=${RUST_LOG:-solana=info} +IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" + +if [ -z "$IPADDR" ]; then + IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" +fi + cargo run --release --bin solana-fullnode -- \ - -l validator.json -v leader.json < genesis.log tx-*.log + -l validator-$IPADDR.json -v leader.json < genesis.log tx-*.log From 1a22a0467ed3752ff81dbf9373735c1ed0c31351 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 22 Jun 2018 14:10:50 -0700 Subject: [PATCH 2/2] Address review comments --- multinode-demo/leader.sh | 8 ++------ multinode-demo/setup.sh | 10 +++------- multinode-demo/validator.sh | 8 ++------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/multinode-demo/leader.sh b/multinode-demo/leader.sh index b489b4fbfe9f3a..70a2bee2170779 100755 --- a/multinode-demo/leader.sh +++ b/multinode-demo/leader.sh @@ -6,13 +6,9 @@ export RUST_LOG=${RUST_LOG:-solana=info} set -x [[ $(uname) = Linux ]] && sudo sysctl -w net.core.rmem_max=26214400 -IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" +IPADDR="$(ifconfig | awk '/inet (addr)?/ {print $2}' | cut -d: -f2 | grep -v '127.0.0.1')" -if [ -z "$IPADDR" ]; then - IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" -fi - -cp leader-$IPADDR.json leader.json +cp leader-"$IPADDR".json leader.json cargo run --release --bin solana-fullnode -- \ -l leader.json < genesis.log tx-*.log > tx-"$(date -u +%Y%m%d%k%M%S%N)".log diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index f2a704bd293616..61b61ab27b4d2d 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -5,11 +5,7 @@ TOKENS=${1:-1000000000} cargo run --release --bin solana-mint-demo <<<"${TOKENS}" > mint-demo.json cargo run --release --bin solana-genesis-demo < mint-demo.json > genesis.log -IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" +IPADDR="$(ifconfig | awk '/inet (addr)?/ {print $2}' | cut -d: -f2 | grep -v '127.0.0.1')" -if [ -z "$IPADDR" ]; then - IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" -fi - -cargo run --release --bin solana-fullnode-config -- -d > leader-$IPADDR.json -cargo run --release --bin solana-fullnode-config -- -b 9000 -d > validator-$IPADDR.json +cargo run --release --bin solana-fullnode-config -- -d > leader-"$IPADDR".json +cargo run --release --bin solana-fullnode-config -- -b 9000 -d > validator-"$IPADDR".json diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index 64961ed4f864ab..298f0c98255444 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -16,11 +16,7 @@ rsync -v "$LEADER"/{mint-demo.json,leader.json,genesis.log,tx-*.log} . || exit $ # if RUST_LOG is unset, default to info export RUST_LOG=${RUST_LOG:-solana=info} -IPADDR="$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')" - -if [ -z "$IPADDR" ]; then - IPADDR="$(ifconfig | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}')" -fi +IPADDR="$(ifconfig | awk '/inet (addr)?/ {print $2}' | cut -d: -f2 | grep -v '127.0.0.1')" cargo run --release --bin solana-fullnode -- \ - -l validator-$IPADDR.json -v leader.json < genesis.log tx-*.log + -l validator-"$IPADDR".json -v leader.json < genesis.log tx-*.log