Linux

Where Does NATS Store JetStream Data?

NATS server config path and JetStream storage folders, including the tmp default that catches new users out.

Last updated

NATS keeps config and stream data in separate places. Config is a .conf file, commonly /etc/nats/nats-server.conf on packages. JetStream file storage goes wherever store_dir points inside that file.

The compiled default is /tmp/nats/jetstream, which works for tests and disappears on reboot. Production packages override it to /var/lib/nats with proper ownership. Check store_dir before assuming persistence. Streams and consumer state all live under that folder. The systemd unit shows the active config path.

Where NATS stores this, by platform

Linux
/var/lib/nats/jetstream

Production override for JetStream streams and consumers. Created with nats user ownership on package installs. Back up with the server stopped for consistency.

Linux
/etc/nats/nats-server.conf

Common package path holding the jetstream block with store_dir. NixOS and Docker pass equivalents through module options or mounted files. Keep with data backups.

Frequently asked questions

why did my JetStream data vanish after reboot

Set store_dir under jetstream in the config to a persistent path like /var/lib/nats/jetstream and restart. The compiled default is /tmp/nats/jetstream, which the OS can wipe on reboot. Package installs override it.

where is the NATS server config file

Run nats-server -c with the config path to test, or check the systemd unit ExecStart line. Common spots are /etc/nats/nats-server.conf and /etc/nats-server.conf. The unit file is the reliable pointer.

Notice an outdated path? Let us know.