File Locations

File Locations

By default, Couchbase Server stores data-files (supporting data, views, and secondary indexes) in var/lib/couchbase/data; with the location of var varying on a per-platform basis. The default data-file path should typically be modified before use in a production-deployment.

Default File Paths

The full default path for each supported platform is shown in the following table:

Table 1. Default 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

Note that once it has been specified, the data-file path location should not be used to store any data other than that allocated by Couchbase Server; since all such additional data will be deleted.

Changing the Data-File Path

The data-file path cannot be spontaneously changed on a node that is active within a cluster: therefore, you should ideally apply the correct, permanent data-file path at configuration-time, prior to the node's addition to the cluster. For this purpose, you can use the Configure Server screen of the Couchbase Web Console, the REST API, or the CLI.

If you do need to change the data-file path of a node that is already active within a cluster, select one of the following options:

Substitute a newly configured node:

  1. Configure a new node, with the correct, new data-file path.

  2. Rebalance the new node into the existing cluster, and the old node out.

Reconfigure the existing node:

  1. Rebalance the node out of the cluster.

  2. Use the REST API or the CLI to change the data file-path of the removed node. Note that this permanently deletes all previously stored data. Not also that the REST API allows data-file and index-file path-settings to be individually changed, whereas the CLI does not.

  3. Rebalance the reconfigured node back into the cluster.

You are recommended to use the node-substitution procedure, rather than the node-reconfiguration: since node-substitution ensures that cluster-performance is not temporarily degraded.

To change the data-file path on multiple nodes within a cluster, repeat your chosen procedure for each node.

CLI Data-File Path-Change Example
couchbase-cli node-init -c -u Administrator -p password --node-init-data-path=new_path