Where Does CockroachDB Store Data?
CockroachDB data directory default in the working dir, and the --store flag that moves it.
Last updated
CockroachDB stores everything in a data directory that defaults to cockroach-data inside the working directory you started the node from. Data ranges, Raft logs and node certificates all live together there, which makes single node development trivially portable and production accidents trivially easy.
The --store flag overrides the location and separates concerns per disk in larger setups. Because the default sits wherever you happened to run the command, stray data directories in random shell folders are the classic surprise. Always start nodes from a deliberate directory or pin --store explicitly.
Where CockroachDB stores this, by platform
./cockroach-data
Created automatically on first start in the current working directory. Back up with enterprise Backup tooling or stop the node and copy the tree. Never copy single files out of a running store.
Frequently asked questions
how do i move cockroachdb data to another drive
Stop the node, move the cockroach-data directory to the new disk, and restart with --store pointing at the new path. Data, Raft logs and certificates travel together inside, so move the whole directory or nothing.
can cockroachdb use multiple disks
Yes, with --store repeated per device.cockroachdb stripes data across them, which suits separating WALs onto fast disks from bulk storage. Single directory stores stay the sane default for development and small clusters.
Notice an outdated path? Let us know.