File Locations

File Locations

Couchbase Server stores data files (data, views and secondary index) under var > lib > couchbase > data.

The disk path for the database and map reduce index files is set during the initial setup of the server node. The default disk path is typically used for development purposes only.

If the server node is used for production, configure a different disk path.

Table 1. Default disk paths for data files
Platform Default directory
Linux /opt/couchbase/var/lib/couchbase/data
Windows C:\Program Files\couchbase\server\var\lib\couchbase\data
Mac OS X ~/Library/Application Support/Couchbase/var/lib/couchbase/data
Important: Do not store arbitrary data in the data path, and especially not the Couchbase Server backups. Couchbase Server will delete such data under certain conditions.

Changing the Data File Path

The disk path where the data and map reduce index files are stored on nodes running the Data service; it cannot be changed on a running server. To change the disk path, remove the node from the cluster, configure it with the new path, and then add back to the cluster. The data file path can be changed for each node with the Couchbase Web Console during setup, with REST API, or CLI.

Once a node or a cluster has already been set up and is storing data, the path cannot be changed while the node is a part of a running cluster.

The quickest and easiest method is to provision a new node with the configured correct disk path, and then use swap rebalance to add the new node in while taking the old node out. This upgrade process ensures that the cluster performance is not impacted.

To change the disk path by replacing a node (with swap rebalance):

  1. Set up a new node with a different disk path.
  2. Swap rebalance the new node for the existing node.
  3. Repeat the process for each node in the cluster.

To change the disk path of an existing node (without swap rebalance):

  1. Remove the node from the cluster and rebalance.
  2. Change the path on the removed node either via the REST API or using the Couchbase CLI.
  3. Re-add the node back to the cluster and rebalance.

To change the disk path on multiple nodes, swap out each node and change the disk path individually.

Important: Changing the data path for a node that is already a part of a cluster permanently deletes the stored data.
Tip: When using CLI, the data file and index file path settings cannot be changed individually. To change the setting individually, use the REST API.
CLI Example
couchbase-cli node-init -c 192.168.0.1:8091 -u Administrator -p password 
    --node-init-data-path=new_path