Valentin Brasso
Valentin Brasso

Reputation: 1387

how to process couchbase buckets in batches

I'm trying to migrate a lot of buckets from one production server to another. I'm currently using a script that queries a view and copies the results to the other server. Hovewever, I don't know how can this process be broken down in smaller steps. Specifically, I'm looking to copy all available buckets to the other server(this takes several hours), run some tests, and when the tests are successful, if there are new buckets, use the same script to only migrate the new ones.

Does couchbase support, for its views, any feature that might help ? Like LIMIT and OFFSET for the query or maybe a last modified date on each bucket so I can filter by that?

Upvotes: 0

Views: 102

Answers (1)

user2535425
user2535425

Reputation:

You should really consider using Backup and restore Restore

To answer your question, yes. If you are using an SDK than you need to look into their API but for instance using the console you can check all the filter options available to you. As an example if you use HTTP you have &limit=10&skip=0 as arguments. Check more info here

To filter by modified date you need to create a view specifically for that, which would have the modified date as key in order to be searchable.

Here is a link that shows you how to search by date which implies as I mentioned, creating a map / reduce function with the date as the key and then querying that key: Date and Time Selection

Upvotes: 1

Related Questions