Couchbase is a popular NoSQL database. In this article, I will be explaining about changing the data directory of couchbase.

By default, couchbase stores its data under the directory /opt/couchbase/var/lib/couchbase/data . But in some cases, this directory will not have enough space to store the data. So we might have to configure the data directory to a different location. This can be performed by following simple steps.

The configuration file to make the change is given below

/opt/couchbase/etc/couchdb/default.d/capi.ini

Edit the above configuration file and modify the database_dir and view_index_dir properties in the couchdb section. An example is given below.

[couchdb]
max_dbs_open = 10000
database_dir = /apps/couchbase/data
view_index_dir = /apps/couchbase/data

Ensure this directory exists in the system and has enough permissions for the couchbase to write. Maintain the same permissions as that of the default data directory permissions. If you are making changes to an existing installation of couchbase, copy the data from the default location to the new location before doing the couchbase restart.

Save the configuration file and restart couchbase server to reflect the changes.

sudo service couchbase-server restart

I hope this is helpful.

Advertisement