https://github.com/mvines/sosh
Solana validator operations shell scripts
https://github.com/mvines/sosh
Last synced: 8 months ago
JSON representation
Solana validator operations shell scripts
- Host: GitHub
- URL: https://github.com/mvines/sosh
- Owner: mvines
- License: wtfpl
- Created: 2022-08-27T15:49:28.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-04T04:56:50.000Z (9 months ago)
- Last Synced: 2025-03-18T23:52:02.410Z (8 months ago)
- Language: Shell
- Size: 61.5 KB
- Stars: 28
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-svm - GitHub
README
# Solana Validator Shell Scripts
This project contains useful scripts for easily running a Solana validator on a fresh Ubuntu 20.04 machine. It uses my ([mvines](https://github.com/mvines)) preferred Solana mainnet settings and best practices. The command names are slightly quirky, and currently not too well documented
## Approximate Clean Machine Setup
### Rust
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
### Solana Cli
```
sh -c "$(curl -sSfL https://release.anza.xyz/beta/install)"
```
then restart shell to apply new PATH
### Tuning
View all `journalctl -f` with:
```
sudo adduser sol adm
sudo adduser sol sudo
```
```
sudo bash -c "cat >/etc/sysctl.d/20-solana.conf </etc/security/limits.d/90-solana-nofiles.conf </etc/logrotate.d/sol <> ~/.bashrc
echo '[ -f $HOME/sosh/sosh.profile ] && source $HOME/sosh/sosh.profile' >> ~/.profile
```
then restart shell
### Sosh Configuration
If you wish to customize the Sosh configuration
```
cat > ~/sosh-config.sh <` from your primary to transfer voting to the
secondary.
#### Other keypairs...
Any string other than `primary` and `secondary` may be used to configure other keypairs for dev and testing.
For example to configure a `dev` keypair:
```
mkdir -p ~/keys/dev && \
solana-keygen new -o ~/keys/dev/validator-identity.json --no-bip39-passphrase -s && \
solana-keygen new -o ~/keys/dev/validator-vote-account.json --no-bip39-passphrase -s
```
If you wish to activate the dev keypair,
```
sosh-set-config dev
```
#### Maybe Adjust FileSystem Usage
##### rocksdb filesystem
Assuming `/mnt/ledger-rocksdb` is the desired location for rocksdb, such as a
separate nvme:
```
mkdir -p ~/ledger/
ln -sf /mnt/ledger-rocksdb/level ~/ledger/rocksdb
ln -sf /mnt/ledger-rocksdb/fifo ~/ledger/rocksdb_fifo
```
##### accounts filesystem(s)
If present the `/mnt/accounts1`, `/mnt/accounts2`, and `/mnt/accounts3`
locations will be added as an `--account` arg to validator startup.
If none are present, accounts will be placed in the default location of
`~/ledger/accounts`
Example of accounts evenly disributed across two drives:
```
sudo ln -s /mnt/nvme1 /mnt/account1
sudo ln -s /mnt/nvme2 /mnt/account2
```
##### snapshot filesystems
If not present, snapshots will be placed in the default location of `~/ledger`
Example of putting all snapshots in a seperate drive:
```
sudo ln -s /mnt/nvme3 /mnt/snapshots
```
Example of putting incremental snapshots in a separate drive, full snapshots in default
location:
```
sudo ln -s /mnt/nvme4 /mnt/incremental-snapshots
```
### Start the node manually to initialize the ledger
```
validator.sh init
```
then monitor logs with `t`. This will prepare ~/ledger and download the correct
genesis config for the cluster.
### Fetch a current snapshot
Use `fetch_snapshot.sh` to get a snapshot from a specific node.
* Mainnet NA-based nodes, try `fetch_snapshot.sh bv1` or `fetch_snapshot.sh bv2`.
* Mainnet EU-based nodes, try `fetch_snapshot.sh bv3`
* Mainnet Asia-based nodes, try `fetch_snapshot.sh bv4`
* Testnet, try `fetch_snapshot.sh tv`
### Start the sol service
```
sudo bash -c "cat >/etc/systemd/system/sol.service </etc/systemd/system/sol-hc.service < ":
```
p beta v1.13.5
```
### Revert to previous validator binaries
So you updated your validator binaries and something bad happened. Quickly
revert to the previous binaries with:
```
lkg
```
then use `svem` to restart the sol service