see on GitHub

Storage : Directory Structure

RavenDB Data

RavenDB keeps all data in a location specified in DataDir setting. The structure of RavenDB data directories are as follows:

  • {DataDir}
    • Databases
      • <database-name>
        • Confguration
          • Journals
          • Temp
        • Indexes
          • <index-name>
            • Journals
            • Temp
          • ...more indexes...
        • Journals
        • Temp
      • ...more databases...
    • System
      • Journals
      • Temp

The main directory has a Databases folder, which contains subdirectories per each database, and a System folder where server-wide data are stored (e.g. database records, cluster data).

The database is composed of such data items as documents, indexes, and configuration. Each of them is a separate Voron storage environment. The data is persisted in a Raven.voron file and .journal files which are located in the Journals directory. In addition, temporary files are put into the Temp folder.

Storing Data in Custom Locations

The structure of RavenDB directories cannot be changed except locations of temporary files for documents and indexes by setting appropriate configuration options.

However, you can store any RavenDB data in different locations by defining junction points (Windows) or mount points (Linux).

Example - Moving Journals

A common practice is to store the journals on a very fast drive to achieve better write performance. The following command will point the Journals directory of Northwind database to path on a different drive.

Windows

C:\RavenDB\Server\RavenData\Databases\Northwind>mklink /J Journals E:\Journals\Northwind

Linux

ln -s ~/RavenDB/Server/RavenData/Databases/Northwind/Journals /mnt/FastDrive/Databases/Northwind/Journals

Example - Moving Indexes

If you want to store the data of all indexes of Northwind database in the custom location, you can use the following command:

Windows

C:\RavenDB\Server\RavenData\Databases\Northwind>mklink /J Indexes D:\Indexes\Northwind

Information

Creation of junction / mount points requires a database to be offline

Information

If data already exists in the directory, you want to define the junction / mount point for you need to backup it first and copy back after executing the command.

Linux

ln -s ~/RavenDB/Server/RavenData/Databases/Northwind/Indexes /mnt/FastDrive/Databases/Northwind/Indexes

Information

Start RavenDB server after creating soft link to a faster drive mount point: