I want to have in my node information only about the last 300000 ledgers. Should I always manually clean the DB or can I automate it?
I'm especially interested in the autocleaning of the Horizon DB.
I found the answer while carefully reading again the admin guide's "Managing storage for historical data" section:
Over time, the recorded network history will grow unbounded, increasing storage used by the database. Horizon expands the data ingested from stellar-core and needs sufficient disk space. Unless you need to maintain a history archive you may configure Horizon to only retain a certain number of ledgers in the database. This is done using the --history-retention-count flag or the HISTORY_RETENTION_COUNT environment variable. Set the value to the number of recent ledgers you wish to keep around, and every hour the Horizon subsystem will reap expired data. Alternatively, you may execute the command horizon db reap to force a collection.
horizon db reap
does nothing.
Commented
Mar 1, 2021 at 19:51
HISTORY_RETENTION_COUNT
you have set? horizon db reap
- reaps (i.e. removes) any reapable history data, as mentioned in the cli help message (horizon db --help
). For example, if you set HISTORY_RETENTION_COUNT
value to 1000
after execution of horizon db reap
it will remove all blocks in the database and keep only latest 1000 blocks.