Data file location
Couchbase Server stores data files (database and indices) under the var > lib > couchbase > data path.
The disk path for the database and indices 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.
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 |
Changing the data file path
The disk path where the data and index files are stored cannot be changed on a running server. To change the disk path, the node must be removed from the cluster, configured with the new path, and added back to the cluster. The data file path can be changed for each node via the Web UI at setup, REST API, or CLI. Once a node or cluster has already been setup and is storing data, the path cannot be changed while the node is part of a running cluster.
The quickest and easiest method is to provision a new node with the correct disk path configured and then use swap rebalance to add the new node in while taking the old node out. This ensures that cluster performance is not impacted.
To change the disk path by replacing a node (with swap rebalance):
- Setup a new node with a different disk path.
- Swap rebalance the new node for the existing node.
- Repeat the process for every node in the cluster.
To change the disk path of an existing node (without swap rebalance):
- Remove the node from the cluster and rebalance.
- Change the path on the running node either via the REST API or using the Couchbase CLI (commands above).
- Re-add the node back to the cluster and rebalance.
CLI example
couchbase-cli node-init -c 10.5.2.54:8091 \
--node-init-data-path=new_path \
-u user -p password