I’m currently working on a backend automation api that is built using node.js. Currently I have couchbase version 4.1.0-5005-enterprise running within GKE/Kubernetes as per https://github.com/couchbase/kubernetes.
Using my api, I am able to ensure that each node in my GKE cluster has a persistent volume disk attached, and now I want to ensure that couchbase saves its data to this persistent volume. As part of the automation process, the disks are formatted and mounted on each VM at /data. The next step is to ensure that this is where couchbase saves its data.
Given the cluster is running within kubernetes, all nodes are initially joined together so my current thought process is that one by one, I must rebalance out each node, change the index path, then add it back to the cluster and rebalance. My current stumbling block is that when I rebalance out a node and then try to change its index path, it doesn’t seem to work.
This is an example of a curl command that I’m currently using, and its result:
curl http://10.124.0.3:8091/nodes/self/controller/settings -X POST -u admin:password -d index_path=/data
[“Could not set the storage path. It must be a directory writable by ‘couchbase’ user.”]
I worked with Matt Ingenthron to try to find a workaround. We tried creating a couchbase user and then running chown and chmod a+rwx to give the couchbase user permissions, but this did not fix the issue.
The code being called for validation is here: https://github.com/couchbase/ns_server/blob/master/src/misc.erl#L1697-L1714. Manually sudo’ing the user running the couchbase service and then doing touch /data/.touch worked fine. Also as another sanity check, doing touch testfile.txt within the /data folder also worked fine.
So this is essentially where things have gotten prior to heading home for the day. I will keep trying to get this to work, and hopefully this will help anybody else who is aiming for persistent couchbase storage using GKE and Kubernetes as well.
Related issue posted here: https://issues.couchbase.com/browse/MB-19196