Change data directory for single-node cluster


#1

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?


#2

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

Thanks

Fred


#3

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:


#4

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:


#5

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.


#6

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.


#7

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


#8

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.