multinode-demo/ grooming (#4226)
* Rename leader to entrypoint * The fullnode identity keypair can now be provided * Rename _id to _keypair
This commit is contained in:
parent
d486d2b8ce
commit
da4c37beec
|
@ -114,25 +114,31 @@ $ solana-gossip --entrypoint testnet.solana.com:8001 spy
|
|||
# Press ^C to exit
|
||||
```
|
||||
|
||||
Then the following command will start a new validator node.
|
||||
Now configure a key pair for your validator by running:
|
||||
```bash
|
||||
$ solana-keygen -o fullnode-keypair.json
|
||||
```
|
||||
|
||||
Then use one of the following commands, depending on your installation
|
||||
choice, to start the node:
|
||||
|
||||
If this is a `solana-install`-installation:
|
||||
```bash
|
||||
$ clear-fullnode-config.sh
|
||||
$ fullnode.sh --poll-for-new-genesis-block testnet.solana.com
|
||||
$ fullnode.sh --identity fullnode-keypair.json --poll-for-new-genesis-block testnet.solana.com
|
||||
```
|
||||
|
||||
Alternatively, the `solana-install run` command can be used to run the validator
|
||||
node while periodically checking for and applying software updates:
|
||||
```bash
|
||||
$ clear-fullnode-config.sh
|
||||
$ solana-install run fullnode.sh -- --poll-for-new-genesis-block testnet.solana.com
|
||||
$ solana-install run fullnode.sh -- --identity fullnode-keypair.json --poll-for-new-genesis-block testnet.solana.com
|
||||
```
|
||||
|
||||
If you built from source:
|
||||
```bash
|
||||
$ USE_INSTALL=1 ./multinode-demo/clear-fullnode-config.sh
|
||||
$ USE_INSTALL=1 ./multinode-demo/fullnode.sh --poll-for-new-genesis-block testnet.solana.com
|
||||
$ USE_INSTALL=1 ./multinode-demo/fullnode.sh --identity fullnode-keypair.json --poll-for-new-genesis-block testnet.solana.com
|
||||
```
|
||||
|
||||
#### Controlling local network port allocation
|
||||
|
@ -142,35 +148,40 @@ example, `fullnode.sh --dynamic-port-range 11000-11010 ...` will restrict the
|
|||
validator to ports 11000-11011.
|
||||
|
||||
### Validator Monitoring
|
||||
From another console, confirm the IP address of your validator is visible in the
|
||||
gossip network by running:
|
||||
```bash
|
||||
$ solana-gossip --entrypoint testnet.solana.com:8001 spy
|
||||
```
|
||||
|
||||
When `fullnode.sh` starts, it will output a fullnode configuration that looks
|
||||
similar to:
|
||||
```bash
|
||||
======================[ Fullnode configuration ]======================
|
||||
node id: 4ceWXsL3UJvn7NYZiRkw7NsryMpviaKBDYr8GK7J61Dm
|
||||
vote id: 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G
|
||||
node pubkey: 4ceWXsL3UJvn7NYZiRkw7NsryMpviaKBDYr8GK7J61Dm
|
||||
vote pubkey: 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G
|
||||
ledger: ...
|
||||
accounts: ...
|
||||
======================================================================
|
||||
```
|
||||
|
||||
Provide the **vote id** pubkey to the `solana-wallet show-vote-account` command to view
|
||||
The **node pubkey** for your validator can also be found by running:
|
||||
```bash
|
||||
$ solana-keygen pubkey fullnode-keypair.json
|
||||
```
|
||||
|
||||
From another console, confirm the IP address and **node pubkey** of your validator is visible in the
|
||||
gossip network by running:
|
||||
```bash
|
||||
$ solana-gossip --entrypoint testnet.solana.com:8001 spy
|
||||
```
|
||||
|
||||
Provide the **vote pubkey** to the `solana-wallet show-vote-account` command to view
|
||||
the recent voting activity from your validator:
|
||||
```bash
|
||||
$ solana-wallet -n testnet.solana.com show-vote-account 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G
|
||||
```
|
||||
|
||||
The vote id for the validator can also be found by running:
|
||||
The vote pubkey for the validator can also be found by running:
|
||||
```bash
|
||||
# If this is a `solana-install`-installation run:
|
||||
$ solana-keygen pubkey ~/.local/share/solana/install/active_release/config-local/fullnode-vote-id.json
|
||||
$ solana-keygen pubkey ~/.local/share/solana/install/active_release/config-local/fullnode-vote-keypair.json
|
||||
# Otherwise run:
|
||||
$ solana-keygen pubkey ./config-local/fullnode-vote-id.json
|
||||
$ solana-keygen pubkey ./config-local/fullnode-vote-keypair.json
|
||||
```
|
||||
|
||||
### Sharing Metrics From Your Validator
|
||||
|
|
|
@ -7,8 +7,8 @@ here=$(dirname "$0")
|
|||
# shellcheck source=multinode-demo/common.sh
|
||||
source "$here"/common.sh
|
||||
|
||||
[[ -f "$SOLANA_CONFIG_DIR"/mint-id.json ]] || {
|
||||
echo "$SOLANA_CONFIG_DIR/mint-id.json not found, create it by running:"
|
||||
[[ -f "$SOLANA_CONFIG_DIR"/mint-keypair.json ]] || {
|
||||
echo "$SOLANA_CONFIG_DIR/mint-keypair.json not found, create it by running:"
|
||||
echo
|
||||
echo " ${here}/setup.sh"
|
||||
exit 1
|
||||
|
@ -18,7 +18,7 @@ set -ex
|
|||
|
||||
trap 'kill "$pid" && wait "$pid"' INT TERM ERR
|
||||
$solana_drone \
|
||||
--keypair "$SOLANA_CONFIG_DIR"/mint-id.json \
|
||||
--keypair "$SOLANA_CONFIG_DIR"/mint-keypair.json \
|
||||
"$@" \
|
||||
> >($drone_logger) 2>&1 &
|
||||
pid=$!
|
||||
|
|
|
@ -31,24 +31,24 @@ EOF
|
|||
exit 1
|
||||
}
|
||||
|
||||
find_leader() {
|
||||
declare leader leader_address
|
||||
find_entrypoint() {
|
||||
declare entrypoint entrypoint_address
|
||||
declare shift=0
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
leader=$PWD # Default to local tree for rsync
|
||||
leader_address=127.0.0.1:8001 # Default to local leader
|
||||
entrypoint=$PWD # Default to local tree for rsync
|
||||
entrypoint_address=127.0.0.1:8001 # Default to local entrypoint
|
||||
elif [[ -z $2 ]]; then
|
||||
leader=$1
|
||||
leader_address=$leader:8001
|
||||
entrypoint=$1
|
||||
entrypoint_address=$entrypoint:8001
|
||||
shift=1
|
||||
else
|
||||
leader=$1
|
||||
leader_address=$2
|
||||
entrypoint=$1
|
||||
entrypoint_address=$2
|
||||
shift=2
|
||||
fi
|
||||
|
||||
echo "$leader" "$leader_address" "$shift"
|
||||
echo "$entrypoint" "$entrypoint_address" "$shift"
|
||||
}
|
||||
|
||||
rsync_url() { # adds the 'rsync://` prefix to URLs that need it
|
||||
|
@ -101,30 +101,30 @@ airdrop() {
|
|||
|
||||
setup_vote_account() {
|
||||
declare entrypoint_ip=$1
|
||||
declare node_id_path=$2
|
||||
declare vote_id_path=$3
|
||||
declare node_keypair_path=$2
|
||||
declare vote_keypair_path=$3
|
||||
declare stake=$4
|
||||
|
||||
declare node_id
|
||||
node_id=$($solana_wallet --keypair "$node_id_path" address)
|
||||
declare node_keypair
|
||||
node_keypair=$($solana_wallet --keypair "$node_keypair_path" address)
|
||||
|
||||
declare vote_id
|
||||
vote_id=$($solana_wallet --keypair "$vote_id_path" address)
|
||||
declare vote_keypair
|
||||
vote_keypair=$($solana_wallet --keypair "$vote_keypair_path" address)
|
||||
|
||||
if [[ -f "$vote_id_path".configured ]]; then
|
||||
if [[ -f "$vote_keypair_path".configured ]]; then
|
||||
echo "Vote account has already been configured"
|
||||
else
|
||||
airdrop "$node_id_path" "$entrypoint_ip" "$stake" || return $?
|
||||
airdrop "$node_keypair_path" "$entrypoint_ip" "$stake" || return $?
|
||||
|
||||
# Fund the vote account from the node, with the node as the node_id
|
||||
$solana_wallet --keypair "$node_id_path" --url "http://$entrypoint_ip:8899" \
|
||||
create-vote-account "$vote_id" "$node_id" $((stake - 1)) || return $?
|
||||
# Fund the vote account from the node, with the node as the node_keypair
|
||||
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
|
||||
create-vote-account "$vote_keypair" "$node_keypair" $((stake - 1)) || return $?
|
||||
|
||||
touch "$vote_id_path".configured
|
||||
touch "$vote_keypair_path".configured
|
||||
fi
|
||||
|
||||
$solana_wallet --keypair "$node_id_path" --url "http://$entrypoint_ip:8899" \
|
||||
show-vote-account "$vote_id"
|
||||
$solana_wallet --keypair "$node_keypair_path" --url "http://$entrypoint_ip:8899" \
|
||||
show-vote-account "$vote_keypair"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,10 @@ ledger_not_setup() {
|
|||
|
||||
args=()
|
||||
bootstrap_leader=false
|
||||
stake=42 # number of lamports to assign as stake
|
||||
stake=42 # number of lamports to assign as stake by default
|
||||
poll_for_new_genesis_block=0
|
||||
label=
|
||||
fullnode_keypair_path=
|
||||
|
||||
positional_args=()
|
||||
while [[ -n $1 ]]; do
|
||||
|
@ -157,6 +158,10 @@ while [[ -n $1 ]]; do
|
|||
stake=0
|
||||
args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --identity ]]; then
|
||||
fullnode_keypair_path=$2
|
||||
args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||
args+=("$1")
|
||||
shift
|
||||
|
@ -198,13 +203,13 @@ if $bootstrap_leader; then
|
|||
fullnode_usage "Unknown argument: ${positional_args[0]}"
|
||||
fi
|
||||
|
||||
[[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json ]] ||
|
||||
ledger_not_setup "$SOLANA_CONFIG_DIR/bootstrap-leader-id.json not found"
|
||||
[[ -f "$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json ]] ||
|
||||
ledger_not_setup "$SOLANA_CONFIG_DIR/bootstrap-leader-keypair.json not found"
|
||||
|
||||
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify
|
||||
|
||||
fullnode_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
fullnode_vote_id_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
|
||||
: "${fullnode_keypair_path:="$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json}"
|
||||
fullnode_vote_keypair_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
||||
ledger_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
|
||||
accounts_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts
|
||||
|
||||
|
@ -212,34 +217,33 @@ if $bootstrap_leader; then
|
|||
default_arg --rpc-drone-address 127.0.0.1:9900
|
||||
default_arg --gossip-port 8001
|
||||
else
|
||||
|
||||
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
read -r leader leader_address shift < <(find_leader "${positional_args[@]}")
|
||||
read -r entrypoint entrypoint_address shift < <(find_entrypoint "${positional_args[@]}")
|
||||
shift "$shift"
|
||||
|
||||
fullnode_id_path=$SOLANA_CONFIG_DIR/fullnode-id$label.json
|
||||
fullnode_vote_id_path=$SOLANA_CONFIG_DIR/fullnode-vote-id$label.json
|
||||
: "${fullnode_keypair_path:=$SOLANA_CONFIG_DIR/fullnode-id$label.json}"
|
||||
fullnode_vote_keypair_path=$SOLANA_CONFIG_DIR/fullnode-vote-id$label.json
|
||||
ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger$label
|
||||
accounts_config_dir=$SOLANA_CONFIG_DIR/fullnode-accounts$label
|
||||
|
||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||
[[ -r "$fullnode_id_path" ]] || $solana_keygen -o "$fullnode_id_path"
|
||||
[[ -r "$fullnode_vote_id_path" ]] || $solana_keygen -o "$fullnode_vote_id_path"
|
||||
[[ -r "$fullnode_keypair_path" ]] || $solana_keygen -o "$fullnode_keypair_path"
|
||||
[[ -r "$fullnode_vote_keypair_path" ]] || $solana_keygen -o "$fullnode_vote_keypair_path"
|
||||
|
||||
default_arg --entrypoint "$leader_address"
|
||||
default_arg --rpc-drone-address "${leader_address%:*}:9900"
|
||||
default_arg --entrypoint "$entrypoint_address"
|
||||
default_arg --rpc-drone-address "${entrypoint_address%:*}:9900"
|
||||
fi
|
||||
|
||||
fullnode_id=$($solana_keygen pubkey "$fullnode_id_path")
|
||||
fullnode_vote_id=$($solana_keygen pubkey "$fullnode_vote_id_path")
|
||||
fullnode_keypair=$($solana_keygen pubkey "$fullnode_keypair_path")
|
||||
fullnode_vote_keypair=$($solana_keygen pubkey "$fullnode_vote_keypair_path")
|
||||
|
||||
cat <<EOF
|
||||
======================[ Fullnode configuration ]======================
|
||||
node id: $fullnode_id
|
||||
vote id: $fullnode_vote_id
|
||||
node pubkey: $fullnode_keypair
|
||||
vote pubkey: $fullnode_vote_keypair
|
||||
ledger: $ledger_config_dir
|
||||
accounts: $accounts_config_dir
|
||||
======================================================================
|
||||
|
@ -250,9 +254,9 @@ if [[ -z $CI ]]; then # Skip in CI
|
|||
source "$here"/../scripts/tune-system.sh
|
||||
fi
|
||||
|
||||
default_arg --identity "$fullnode_id_path"
|
||||
default_arg --voting-keypair "$fullnode_vote_id_path"
|
||||
default_arg --vote-account "$fullnode_vote_id"
|
||||
default_arg --identity "$fullnode_keypair_path"
|
||||
default_arg --voting-keypair "$fullnode_vote_keypair_path"
|
||||
default_arg --vote-account "$fullnode_vote_keypair"
|
||||
default_arg --ledger "$ledger_config_dir"
|
||||
default_arg --accounts "$accounts_config_dir"
|
||||
|
||||
|
@ -270,8 +274,8 @@ while true; do
|
|||
if $bootstrap_leader; then
|
||||
ledger_not_setup "$SOLANA_RSYNC_CONFIG_DIR/ledger does not exist"
|
||||
fi
|
||||
rsync_leader_url=$(rsync_url "$leader")
|
||||
$rsync -vPr "$rsync_leader_url"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR"
|
||||
rsync_entrypoint_url=$(rsync_url "$entrypoint")
|
||||
$rsync -vPr "$rsync_entrypoint_url"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$ledger_config_dir" ]]; then
|
||||
|
@ -282,7 +286,7 @@ while true; do
|
|||
trap '[[ -n $pid ]] && kill "$pid" >/dev/null 2>&1 && wait "$pid"' INT TERM ERR
|
||||
|
||||
if ! $bootstrap_leader && ((stake)); then
|
||||
setup_vote_account "${leader_address%:*}" "$fullnode_id_path" "$fullnode_vote_id_path" "$stake"
|
||||
setup_vote_account "${entrypoint_address%:*}" "$fullnode_keypair_path" "$fullnode_vote_keypair_path" "$stake"
|
||||
fi
|
||||
|
||||
echo "$PS4$program ${args[*]}"
|
||||
|
@ -305,7 +309,7 @@ while true; do
|
|||
((poll_for_new_genesis_block)) || continue
|
||||
((secs_to_next_genesis_poll--)) && continue
|
||||
|
||||
$rsync -r "$rsync_leader_url"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR" || true
|
||||
$rsync -r "$rsync_entrypoint_url"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR" || true
|
||||
diff -q "$SOLANA_RSYNC_CONFIG_DIR"/ledger/genesis.json "$ledger_config_dir"/genesis.json >/dev/null 2>&1 || break
|
||||
secs_to_next_genesis_poll=60
|
||||
|
||||
|
@ -314,7 +318,7 @@ while true; do
|
|||
echo "############## New genesis detected, restarting fullnode ##############"
|
||||
kill "$pid" || true
|
||||
wait "$pid" || true
|
||||
rm -rf "$ledger_config_dir" "$accounts_config_dir" "$fullnode_vote_id_path".configured
|
||||
rm -rf "$ledger_config_dir" "$accounts_config_dir" "$fullnode_vote_keypair_path".configured
|
||||
sleep 60 # give the network time to come back up
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@ set -e
|
|||
"$here"/clear-fullnode-config.sh
|
||||
|
||||
# Create genesis ledger
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/mint-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-id.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
||||
$solana_keygen -o "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-keypair.json
|
||||
|
||||
args=("$@")
|
||||
default_arg --bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-id.json
|
||||
default_arg --bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-id.json
|
||||
default_arg --bootstrap-stake-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-id.json
|
||||
default_arg --bootstrap-leader-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json
|
||||
default_arg --bootstrap-vote-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
||||
default_arg --bootstrap-stake-keypair "$SOLANA_CONFIG_DIR"/bootstrap-leader-stake-keypair.json
|
||||
default_arg --ledger "$SOLANA_RSYNC_CONFIG_DIR"/ledger
|
||||
default_arg --mint "$SOLANA_CONFIG_DIR"/mint-id.json
|
||||
default_arg --mint "$SOLANA_CONFIG_DIR"/mint-keypair.json
|
||||
default_arg --lamports 100000000000000
|
||||
|
||||
$solana_genesis "${args[@]}"
|
||||
|
|
Loading…
Reference in New Issue