I'm trying to create an offline client application with PouchDB local document storage which will be syncing its data to a couchbase server. I maintain three instances of couchbase to form a cluster. For the sync I want to use the sync gateway that couchbase provides
Questions
- I will be running the sync_gateway on all instances of my cluster and I should be connecting to them in a round robin fashion? Is pouchdb capable of doing that, like adding more servers to replicate, and how?
I set up a pouchdb simple example and a couchbase and while pouchdb managed to replicate a document to couchbase I constantly get the following error, what does this means and how I can correct it:
GET http://localhost:4984/mybucket/_local/4jm_8Z70bAx9pah9QrJraw%3D%3D?&_nonce=1448874432705 404 (Not Found) explainError-browser.js:7 The above 404 is totally normal. PouchDB is just checking if a remote checkpoint exists.
I connect with the following snippet of code
const localDB = new PouchDB('localdb');
const remoteDB = new PouchDB('http://localhost:4984/mybucket');
localDB.replicate.to(remoteDB, {
live: true,
retry: true
}).on('complete', function () {
console.log('DONE');
// yay, we're done!
}).on('error', function (err) {
// boo, something went wrong!
});
Is there any good example, or a simple github repo example of how to perform a simple sync as a proof of concept between pouchdb and coucbase managing authentication and replication? So far I have been reading the following resources: