Couchbase deployment to new location and porting data,indexes

For Couchbase version 4.6.3, I have to deploy couchbase to a new disk location as the default location “/opt/couchbase” doesn’t have enough disk space. The platform is Red Hat (RHEL) 6.

Questions :-

  1. How to install couchbase rpm to a new location ? Is below command correct?
    rpm -i couchbase-server-4.6.3-4136.x86_64 --relocate /opt/couchbase=/new/location
  2. How to migrate the existing data to the new couchbase instance deployed ? The existing couchbase layout consists of 2 couchbase nodes in the same cluster and data is replicated across regions to 2 clusters across different datacentres in different region using XDCR.
    The process needs to be automated using scripts(RestAPI) if possible instead of manually removing nodes from cluster and re-adding them.
    Please advise on the correct approach to do so that no data is lost and the couchbase runs from a new location writing logs and data to a new directory.

Hi @amarjeet1.singh,

The rpm command might work, I’m not familiar with the --relocate option. Alternatively, I believe you can specify storage location when you are configuring a new cluster.

As far as migrating existing data, since you’re already using XDCR, why not use XDCR to replicate data to the new cluster? XDCR has a REST API available:

Thanks Matthew. The “–relocate” option works and installs the couchbase to new file system. However it is not a recommended approach as per couchbase team . The suggestion is to install couchbase at its default location and change the index and data path to the new file system. For active nodes, it can be accomplished by removing a node from cluster, reconfigure it and add it back to the cluster. I am want to get it automated using a shell script with REST API end points instead of the admin GUI.
I tried the REST API and the data/index path gets updated but the index and XDCR setup disappears.
May be I am missing something or is it a bug?


Can you post what part of the REST API you’re using that’s not working how you expect? (Also are you using Enterprise or Community)

Couchbase Enterprise version : couchbase-server-4.6.3-4136.x86_64

I am using below REST API endpoints to reconfigure the data and index path of active nodes . There are two active nodes in a cluster and data is replicated to two other clusters using XDCR.

After executing the below steps 1-5 , the existing buckets along with data is available but the existing indexes are lost and are not available in indexes tab of couchbase.admin GUI .

Please note few of indexes are static which were created during initial setup. There are indexes which are created dynamically based on application logic which should not be lost during the reconfiguration.


1.Remove ipnode2 from Cluster
curl -v -X POST -u ‘Administrator:Password’ ‘http://ipnode1:8091/controller/rebalance’ -d ‘ejectedNodes=ns_1@ipnode2’ -d 'knownNodes=ns_1@ipnode1,ns_1@ipnode2’
2.Reconfigure the index and data path for ipnode2
curl -X POST -u ‘Administrator:Password’ http://ipnode2:8091/nodes/self/controller/settings -d ‘index_path=newpath/index’ -d ‘path=newpath/data’

3.Add ipnode2 back to cluster enabling services for data,index,query
curl -v -X POST -u ‘Administrator:Password’ -d ‘hostname=ipnode2&user=Administrator&password=Password$4&services=kv%2Cn1ql%2Cindex’ http://ipnode1:8091/controller/addNode

4.Remove ipnode1 from Cluster
curl -v -X POST -u ‘Administrator:Password’ ‘http://ipnode1:8091/controller/rebalance’ -d ‘ejectedNodes=ns_1@ipnode1’ -d ‘knownNodes=ns_1@ipnode1,ns_1@ipnode2’

5.Update ipnode1 index and data path
curl -X POST -u ‘Administrator:Password’ http://ipnode1:8091/nodes/self/controller/settings -d ‘index_path=newpath/index’ -d ‘path=newpath/data’

6.Add ipnode1 back to the cluster
curl -v -X POST -u ‘Administrator:Password’ -d ‘hostname=ipnode1&user=Administrator&password=Password$4&services=kv%2Cn1ql%2Cindex’ http://ipnode2:8091/controller/addNode

curl -v -X POST -u ‘Administrator:Password’ -d ‘knownNodes=ns_1@ipnode1,ns_1ipnode2’ http://ipnode2:8091/controller/rebalance

Also when I try to recreate the index after Step 3, there is an error

  • Connection #0 to host left intact
  • Closing connection #0
  • About to connect() to port 8093 (#0)
  • Trying… Connection refused
  • couldn’t connect to host

Any updates pls to restore the index post updating the index and data path?

Hi @amarjeet1.singh,

I’ve asked @venkat to take a look when he can. If you actually have an Enterprise license at this point (and you’re not just evaluating), I’d recommend you put in a support request.