Change data directory for single-node cluster

I need to move my data files to another drive because I’m running out of space. The instructions for changing data directory do not work in this case because it is a single-node cluster and cannot be removed from the cluster. Can I just change the directories in runtime.ini and copy the files to the new location?

1 Like

I’m also interested in this issue, can somebody of couchbase answer this?

Thanks

Fred

If you only have one cluster node then you’ll need to offline the node (and hence the cluster) to change it’s data directory. Steps for this are documented in the <a href= http://docs.couchbase.com/couchbase-manual-2.2/#couchbase-data-files">Couchbase Data Files section

Note with any such operation I suggest you backup your data first :slight_smile:

If you only have one cluster node then you’ll need to offline the node (and hence the cluster) to change it’s data directory. Steps for this are documented in the Couchbase Data Files section of the manual - see http://docs.couchbase.com/couchbase-manual-2.2/#couchbase-data-files

Note with any such operation I suggest you backup your data first :slight_smile:

By offline the node do you mean stopping couchbase from running, or using the cli command:

curl -u admin:password -d otpNode=ns_1@192.168.0.107 \
http://192.168.0.106:8091/controller/ejectNode

I tried that command and replaced 192.168.0.107 with my node’s IP address and 192.168.0.106 with localhost (though they’re the same host since it’s the only node in the cluster) and it just says “Cannot remove active server”. This is the only node in the cluster though, so if I stop it so it won’t be active then I won’t be able to reach the couchbase endpoints. I’m using couchbase server 3.0.2.

I mean shutdown the node (couchbase-server stop).

Basically with just one node your online maintenance options are limited - and in fact for production deployment three nodes is the minimum recommended. In general you make use of the ability to add/remove nodes and rebalance to perform maintence operations while keeping the data online.

If you only have one node (and no ability to add a second one) your options are basically:

A) Backup shutdown the service, re-init and Restore

B) Use LLVM or similar to expand the partition size.

I can’t do the re-init though because that command relies on the couchbase service being running. If I shutdown the couchbase-server service and then run:

couchbase-cli node-init -c localhost:8091 --node-init-data-path="new data path" -u <user name> -p <password>

I get the error:
ERROR: command: node-init:localhost:8091, [Errno 111] Connection refused

I just did that on CB 4.5.0-1308.
Maybe not the prettiest method, but it worked.

  • I took CB server down (single node).
  • I edited /opt/couchbase/etc/couchdb/local.ini and changed database_dir and view_index_dir with a new path.
  • I moved files to the new path
  • I started CB server
    Everything works.

I just did that on CB 4.5.0-1308.
Maybe not the prettiest method, but it worked.

  • I took CB server down (single node).
  • I edited /opt/couchbase/etc/couchdb/local.ini and changed database_dir and view_index_dir with a new path.
  • I moved files to the new path
  • I started CB server
    Everything works.

@bartek the steps might have worked but they’re not supported and are not the correct way of changing the data path.

The steps online by @drigby is the correct and supported way to do it