Step 4: Startup & Monitoring
Creating the startup script, systemd service, and monitoring sync status.
Step 4: Startup & Monitoring
We do not run the solana-validator binary directly. Instead, we use a shell script to manage the complex flags and a systemd service to ensure the node restarts automatically if it crashes or the server reboots.
1. Create the Startup Script
We will create a script that defines your node's configuration.
⚠️ Initial Mode: Non-Voting (Spy Node) In this script, we include the
--no-votingflag.
Why? Your node needs to sync the ledger before it can vote. Voting before you are synced can lead to delinquencies.
For Validators: You will remove this flag and add your vote account in the [Validator Setup] section later.
A. Create the script file
Bash
nano /home/solana/start-validator.shB. Paste the following configuration (Mainnet Beta)
Bash
#!/bin/bash
exec solana-validator \
--identity /home/solana/keys/validator-identity.json \
--known-validator 5D1fNXzvv5NjV1ysLjirC4WY92RNsVH18vjmcszZd8on \
--known-validator dDzy5SR3AXdYWVqbDEkVFdvSPCtS9ihF5kJkHCtXoFs \
--known-validator Ft5fbkqNa76vnsjYNwjDZUXoTWpP7VYm3mtsaQckQADN \
--known-validator eoKpUABi59aT4rR9HGS3LcMecfut9x7zJyodWWP43YQ \
--known-validator 9QxCLckBiJc783jnMvXZubK4wH86Eqqvashtrwvcsgkv \
--only-known-rpc \
--ledger /mnt/ledger \
--accounts /mnt/accounts \
--rpc-port 8899 \
--dynamic-port-range 8000-8020 \
--entrypoint entrypoint.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint2.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint3.mainnet-beta.solana.com:8001 \
--expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \
--wal-recovery-mode skip_any_corrupted_record \
--limit-ledger-size 50000000 \
--log /home/solana/solana-validator.log \
--no-voting
# --vote-account /home/solana/keys/vote-account.json \C. Make it executable
Bash
chmod +x /home/solana/start-validator.sh🔍 Flag Explanation:
--known-validator: Trusted nodes (Solana Labs, Jito, etc.) we download a snapshot from.--only-known-rpc: Security feature. Only ask trusted nodes for the initial ledger download.--limit-ledger-size: Keeps your ledger disk usage under control (deletes old history).--no-voting: Critical for initial setup. Prevents the node from trying to vote while it is still syncing.
2. Create Systemd Service
This configures Linux to run your script as a background service.
A. Create the service file
Bash
sudo nano /etc/systemd/system/solana.serviceB. Paste the configuration
Ini, TOML
[Unit]
Description=Solana Validator
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=solana
LimitNOFILE=1000000
LogRateLimitIntervalSec=0
ExecStart=/home/solana/start-validator.sh
[Install]
WantedBy=multi-user.targetC. Enable and Start
Bash
# Reload systemd
sudo systemctl daemon-reload
# Enable service on boot
sudo systemctl enable solana
# Start the node
sudo systemctl start solana3. Monitoring & Verification
Your node is now running! It will immediately begin fetching a snapshot and verifying the ledger. This process is CPU intensive.
A. Check the Logs Watch the startup process. You are looking for "Snapshot Download" or "Process slots".
Bash
tail -f /home/solana/solana-validator.logB. Check Sync Status (Catchup) This is the most important command for a Solana operator. It tells you how far behind the network you are.
Bash
solana catchup --our-localhostOutput Guide:
Total: The total number of slots your node needs to verify.
Remaining: How many blocks left to sync.
Speed: Blocks per second (Should be > 1.0 to catch up).
Note: It may take 30-60 minutes before
catchupshows accurate numbers while it downloads the initial snapshot.
Last updated