For the complete documentation index, see llms.txt. This page is also available as Markdown.
5. [Advanced] - how to create snapDB on your server
If you running validator and an extra node together, you can use extra node to create a snanDB snaphot - smaller DB(120GB+) with only validator info - neither old state nor old transaction history.
SnapDB snapshots be the core team
Please note, you can still find the snapDB from the core team by the link, but if your own you are welcome to proceed.
Requirements
an extra Harmony node
time -> snapDB creation is taking around 2 days
extra space:
current DB around 200->500 GB
snapDB will be around 120+ GB
Creating a snapDB snapshot
You need to do the following to get the fresh snapDB:
Stop currently running harmony service/container/any other way how you run Harmony node, e.g. systemd service:
sudosystemctlstopharmony.service# we don't want some server reboot to start normal harmony servicesudosystemctldisableharmony.service
Place the following bash script `check-and-run-snapdb.sh` nearby the binary.
Reason : the dumpdb feature may crash, fortunately, at restart of the process the dump willstartwhere it left off
Note: KakashiDB batch writhing and account lines will produce you 90GB of logs without providing you any extra information => so let's just ignore these lines.
Put the check-and-run-snapdb.sh in the cron to rerun every 5 minutes via crontab -e
Note: by default SHELL in crontab is set to /bin/sh and all relative path like ~/ wouldn't work here, use full path
Time to time check the logs:
What will you see in the logs when snapdb creation have been finished:
Note, this process will take around 2 days
Comment the crontab entry from the 3rd step via crontab -e
Move your old DB and name it like backup, and make a :
Start your harmony process again:
Wait till the node is synced with the latest HEAD block, it will take some small amount of time around 5-15 minutes - node needs to fetch 2+ day blocks.
If everything good - remove old DB from the server, check the step 7:
Note: running rm -rf is dangerous, please double check what are you about to delete!
#!/bin/bash
# make sure the folder where the new snapDB is is created
mkdir -p /data/snapdb/new_snapdb_creation
# Specify the name of the program you want to monitor
program_name="harmony"
binary_path="/put_yours_here"
db_path="/put_yours_here" # by default it is the same folder as for binary
snapdb_path="/put_yours_here"
# Use pgrep to get the number of PIDs for the specified program
pid_count=$(pgrep -cx "$program_name")
if [ "$pid_count" -eq 1 ]; then
echo "$program_name is running all good"
else
"$binary_path"/harmony dumpdb \
"$db_path" "$snapdb_path" | \
grep -v "KakashiDB batch writhing\|account" >> "$binary_path"/newsnapdb.log &
fi