2

It is possible to sync data saved by server application into mobile apps? Now i have got sync between couchbaselite -> sync_gateway -> couchbase_server

and now i wanna sync in that way:

java application -> couchbase_server -> sync_gateway -> couchbaselite

is that possible to do ?

Łukasz Woźniczka
  • 1,625
  • 3
  • 28
  • 51

1 Answers1

4

It is technically possible to do this with bucket shadowing as mentioned by @combinatorial. However, it is no longer recommended, and is in fact highly discouraged by Couchbase. There are a number of serious bugs that you can encounter if you do not have full awareness of how it works and there are severe limitations associated with its use.

Bucket shadowing has not been worked on for a significant amount of time and has never been officially supported and could be removed in the future.

The current recommendation for dealing with such issues is to modify the documents only via sync gateway. You can either do this via the simple to use REST API, or via a Couchbase Lite client. There is additionally the option to use a CouchDB client with Sync Gateway (They use near-enough the same API) which will allow for slightly more direct interaction.

Chippiewill
  • 333
  • 1
  • 11
  • 3
    I don't think this is correct, see this recent thread... https://forums.couchbase.com/t/cannot-retrieve-document-from-couchbase-lite-when-adding-documents-to-couchbase-server-using-admin-ui/8100 and the comment from Jens... "It's still supported. The statement in that SO thread is incorrect; it must've been miscommunicated to our support engineers. Sorry about that." – combinatorial Jun 14 '16 at 04:23
  • Really "Bucket Shadowing" is not supported, any source? – Łukasz Woźniczka Jun 14 '16 at 07:06
  • @Chippiewill if you need to have got two way synchronisation maybe the better option is using couchbase lite with couchDB then couchbase lite with couchbase server ? – Łukasz Woźniczka Jun 14 '16 at 07:34
  • 2
    @combinatorial The official recommendation that I have a received from the Sync Gateway team anytime the topic "bucket shadowing" comes up is "don't use bucket shadowing". Bucket shadowing is not a supported feature by virtue of the fact that it is not documented in the actual official documentation (any documentation on the repo itself is not supported for production use) which means it is either an experimental or non-public API. – Chippiewill Jun 14 '16 at 08:18
  • @ŁukaszWoźniczka That is certainly a possibility and if it scales to your workload then there's no harm in doing that except a few minor features don't work when replicating to a CouchDB database since it doesn't have a few of the endpoints used. You can always transition over to a Couchbase Server + Sync Gateway setup later on if you find CouchDB isn't scaling well enough. – Chippiewill Jun 14 '16 at 08:22
  • 1
    @Chippiewill it would be good if the couchbase team could get on the same page on this and update the wiki as appropriate. – combinatorial Jun 14 '16 at 15:42
  • 3
    By the power of Grayskull, I mean by the power invested in me as a Mobile Architect at Couchbase (and original author of Sync Gateway) I decree that Bucket Shadowing is supported. It's only recommended in certain use cases (if you have an existing bucket being written to by CB 'smart client' APIs, and need to sync it to mobile apps) but it works for that. I will be in touch with our support engineers to get everyone in sync [haha]. – Jens Alfke Jun 14 '16 at 16:11
  • 1
    @JensAlfke could you please use that power to ensure the official mobile documentation actually includes shadow buckets then as that is a far more effective indicator about whether or not a feature is actually supported. – Chippiewill Jun 14 '16 at 16:18
  • @JensAlfke It's really confusing that you guys at couchbase have conflicting versions of what is going to happen with shadow buckets... As far as 2017, the issue of whether shadow buckets will be supported or not is still ongoing. Here, the official documentation states that shadow buckets wont be supported in couchbase lite 2.0, and it is deprecated in Couchbase Mobile 1.4. https://developer.couchbase.com/documentation/mobile/1.4/whatsnew.html . I guess chippiewill is right, use the power of grayskull to clarify the issue please. Remember that with great power comes great responsability – 1vand1ng0 Mar 24 '17 at 23:42
  • 1
    Sorry about the confusion. The situation seems to be that shadow buckets work, but are tricky enough to use that they're officially not supported anymore. The good news is that the Sync Gateway and Server teams are working hard on tighter integration that will make them unnecessary — you'll be able to make changes directly to Sync Gateway's bucket without messing anything up. That should be coming out "later this year". – Jens Alfke Mar 26 '17 at 04:05