import { Code } from '@astrojs/starlight/components';
import dbWithoutCompactor from '/../examples/src/db_without_compactor.rs?raw';
import standaloneCompactor from '/../examples/src/standalone_compactor.rs?raw';
By default, SlateDB starts a background compactor inside each Db instance.
If you want to run compaction as a separate service (for example, on dedicated compute), you can:
- Open the
Dbwith compaction disabled. - Start a standalone compactor in a separate process.
Both processes must use the same ObjectStore and database path (the path is the prefix inside your object store).
Create a Db with no compactor#
To prevent Db from starting the embedded compactor, set Settings::compactor_options to None and use Db::builder:
Run a compactor without a Db#
You can run the standalone compactor using the SlateDB CLI:
slatedb --env-file .env --path <db-path> run-compactor
The compactor runs until interrupted (Ctrl-C), then shuts down gracefully.
Alternatively, you can embed the compactor in your own process using CompactorBuilder and call run: