Couchbase APIs, libraries or curl commands to copy data from one cluster to another

53
November 24, 2021, at 09:50 AM

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.

Answer 1

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

READ ALSO
Returning a array of objects by reducing and array

Returning a array of objects by reducing and array

I'm trying to return an array of objects from an arraySo for example

31
Android java foreground service

Android java foreground service

foreground service keeps particular activity in background or whole app , Like am making an app which gets values from sensorand fetch location

33
Linker Errors When Attempting to Run Example Program for MySQL Connector/C++ 8.0.27 (Windows)

Linker Errors When Attempting to Run Example Program for MySQL Connector/C++ 8.0.27 (Windows)

I have been trying to successfully build and run a test of the MySQL Connector/C++ 80

55
How to properly select document via populate from another document with mongoose?

How to properly select document via populate from another document with mongoose?

I did a select with populate and it works, but feel like there is a better way

41