I want to copy my data from one cluster of Couchbase to another cluster either via curl commands or using SDK libraries. Could someone please let me know if is there any libraries/APIs available by which I can be do this.
We need to copy the data based on some queries from one cluster to another cluster on same bucket(Source and target bucket name is same). We are looking for solution which we can adopt to copy our data based on some complex query that can be copied to another cluster for availability purpose, debug purpose. We want to do it via SDK libraries or some script which we can run in Jenkins pipeline etc.
You could use the cbq tool together with jq
to prepare a json file with an array of documents that can later be exported with cbimport
:
./cbq -u Administrator -p password -e "http://localhost:8091" \
--script="SELECT * FROM \`travel-sample\`.inventory.airline LIMIT 1;" -q | jq '.results' > data.json
You can then import the generated file using cbimport (cbimport json
) with --format=list