Couchbase-lite and CouchDB - mobile

I'm unclear about the requirements for using Couchbase-lite.
Is it possible to use Couchbase-lite with CouchDB? Or does Couchbase-lite require Couchbase Server and Sync Gateway?
Thanks!

According to the documents it is 100% compatible with both CouchDB and Couchbase.
http://docs.couchbase.com/couchbase-lite/cbl-concepts/#can-couchbase-lite-replicate-with-apache-couchdb-servers
Also I found this blog post on syncing IOS with CouchDB, might be useful! http://blog.lunarlogic.io/2013/synchronization-using-couchdb/
Edit
Official Couchbase link above isn't valid anymore however the following official article from Couchbase lists the other databases that are compatible: (CouchDB,PouchDB,Cloudant)http://developer.couchbase.com/documentation/mobile/current/develop/guides/couchbase-lite/native-api/replication/index.html

Couchbase Lite implements the CouchDB replication protocol and is 100% compatible with CouchDB. However, Couchbase Server does not require certain document metadata that CouchDB documents contain for performance reasons. Sync Gateway is how the necessary meta-data gets added to Couchbase Server.

As of Couchbase Lite 2.0, it is no longer compatible with CouchDB. It now requires a Sync Gateway. You will need to use Couchbase Lite 1.x.
The new protocol is incompatible with CouchDB-based databases. And since Couchbase Lite 2 only supports the new protocol, you will need to run a version of Sync Gateway that supports it.
https://docs.couchbase.com/couchbase-lite/2.1/swift.html#compatibility

I just started using recently using but I hope My answer will be use for some scenario..
coming to your question It all depends on your requirement..
1: If you want to offline and online synchronization you must go with sync gateway.
2: I don't want synchronization means no need of going with syncgateway.

Related

Hybrid Apps: which DB strategy "PouchDB+CouchDB" Or Couchbase Mobile?

Context
I'm developing a hybrid/mobile app using Cordova. This app displays content, such as news, magazine articles and weather info that is dynamically generated and delivered via a Web App (self-hosted developed with PHP). In order to decide which mobile devices "get" which content, I need to constantly keep track of the history of displays on each device, and gather information such as : article name, display date/time, location(lat/lon), etc.
The BIG problem I have is...
Now, because the data that I'm gathering is unstructured, I first tried with Firebase (Google), which allowed me to easily gather all the data, in real-time using a key:value schema and then retrieve my data on the webapp running another JS script. The problems with this solution are:
Querying possibilities are too limited.
I'm not comfortable leaving all my data handled by Google (Nothing against Google, butI'd prefer to own my data).
The Question
What are the storage strategies that I could use ? I've been reading a lot about Redis, Parse-server, PouchDB+CouchDB, and MongoDB, but I got lost in a world of information about NoSql databases, and now I really do not know what to do :'(
I've always used relational databases for my projects (Mysql, MariaDB), but I'm not afraid in getting my hands dirty with NoSQL databases, however I'd appreciate if anyone can point me to the easiest-to-implement solution.
EDIT (17/04/18)
I think I narrowed down my question to 2 options
PouchDB + CouchDB, or
Couchbase Mobile = Couchbase Lite + Sync Gateway
Can anyone, please give me some feedback with regards to these two options? Ease of implementation, Querying, maintenance, etc ?
Thanks!
Figured, I should probably explain my earlier comment better.
Couchbase Mobile = Couchbase Lite (runs on mobile device) + Sync Gateway + Couchbase Server (hosted in backend)
W.r.t your first concern
Querying possibilities are too limited.
Couchbase Server supports N1QL - which is a superset of SQL for NoSQL. So you should be able to do the kind of extensive querying that you want w/ Couchbase Server.This link discusses how you can do geospatial queries (since you mentioned that as a use case)
W.r.t your second concern
I'm not comfortable leaving all my data handled by Google (Nothing
against Google, butI'd prefer to own my data).
With Couchbase Mobile, you have control over where the data is hosted - you have the option of persisting the data in Couchbase servers that you can host in private/public cloud (AWS, Azure, GCP).
Note on Cordova support in Couchbase Lite:
It is supported as a community project in Couchbase Lite 1.4. However, in the latest 2.0 release, you will have to develop your Cordova plugin on top of the native API .

How to Use couchDB as local storage in android application

I am developing an app, which is in android.
In my app I want to use couchdb database for storing and sync purpose.
which will work offline too.
so, how to create couchDB database first and then insert data in that database, so that my application will use the couchDB database as local storage like SQLite.
I have aleready went through many links but they are not satisfying my need.
So Please provide some guide line or an help or comment or sample code to performed that operation.
CouchDb and Couchbase Lite are very close in terms of usage. If you are looking for an easy way to sync and store data locally on your android device I would recommend looking at Couchbase Lite for Android.
https://github.com/couchbase/couchbase-lite-android

how to use Couchbase as a database in the cloud?

I need to make a database stored in the cloud for an application. i just need to store and retrieve images from that database to the application. i found Couchbase and i think that's the way to go for me, but im not really sure of how to start.
I suppose that if i want to use Couchbase as a database i need to install it in my computer and it will use my computer as the server. but i need to do that on the cloud, because i don't have a computer that i could use 24/7 as a server. so im not really sure of how i could install Couchbase in the cloud.
I have the vague idea (from reading the AWS page) that some hosting servers out there have the option of using them as a computer where i can install linux or any other operative system, and then install couchbase there, but im not really sure if that's true.
So, if that's the case, is there any cloud (or web) hosting service that you recomend that could do what i need? it would be better if its free, because its a class project, but i don't mind if its paid if it has a 30/60/90 days of free trial. could amazon's AWS or HP's Helion Eucalyptus do the job?
How do i install the Couchbase database in that hosting service?
If using Couchbase in the cloud doesn't work like i think it works, how can i do what i need?
I'm really confused, thank you in advance.
You are correct that you need a server (somewhere) and just install Couchbase server on it by following the Couchbase instructions.
Or you could use the AWS prebuilt version.
Using a database to store images (or any large binary data) is usually a terrible idea. They already invented a database for storing files - it's called a filesystem.
Glib replies aside, you really should consider using the built-in mechanisms you get from cloud providers for storing binary objects; if you're using AWS, then S3 would be my first choice. You get all the benefits of a distributed database: reliability, scalability, etc., but without the unnecessary complexity of using a database for something as simple as storing binary blobs. Some further reading on using S3 for object storage: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingObjects.html
Now, there are some use-cases where it might make sense to use Couchbase for storing images, mostly if you need the high performance that you get from the built-in cache in Couchbase to retrieve the images very quickly. In such a case, here is a short list of steps to get you started:
Sign up for the AWS free tier: https://aws.amazon.com/free/
Get set up for AWS EC2: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html
Follow the getting started guide to create an AWS VM instance: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
Install Couchbase: http://developer.couchbase.com/documentation/server/4.0/getting-started/installing.html

Real-time web application using Redis key-value store

I'm a web developer and used to using FireBase for a lot of my projects. Much of the work is already done out-of-the box there regarding realtime synchronization etc. In my next project, however, I'm not allowed to use an external provider for storing data, and as there's no way to host Firebase on a local server, it's out of the question.
For that project, currently a Redis key-value store is used. I know Redis also supports a pub-sub model, and I'm searching for a good way to use this Redis key-value store in a realtime web application. I've found a Meteor library (https://github.com/meteor/redis-livedata), which looks promising. I'm used to using AngularJS, however. And the majority of the solutions I found only use Redis for the pub-sub model, and not for the datastore (maybe for good reason). I've found an alternative which uses Django as the datastore (https://github.com/mburst/django-realtime-tutorial). I've also come across Firehose (http://firehose.io), but this doesn't use the Redis key-value store either.
Does anyone know a good way to emulate the same functionality Firebase provides, using a Redis key-value store, preferably compatible with AngularJS?
Correction - Django is a python based web framework, not a datastore .
For your requirement , tools like deployd and loopback suit alot.
They are opensource versions of services like Firebase or Parsed.
Both of them work with javascript(nodejs) and hence would support AngularJS or any other framework you would want to use.
For datastore backend, most preferred pluggable backend is mongodb as it supports fast writes, rich querying, and persistence of data.

To what extent is Couchbase a drop in replacement for Memcached

Official couchbase documentation says.
"If you already have an application that uses the Memcached protocol
then you can start using your Couchbase Server immediately. If so, you
can simply point your application to this server like you would any
other memcached server. No code changes or special libraries are
needed, and the application will behave exactly as it would against a
standard memcached server. Without the client knowing anything about
it, the data is being replicated, persisted, and the cluster can be
expanded or contracted completely transparently."
We already have a C based application which was working with memcached by using libmemcached C APIs.
We wanted to move to couchbase since we wanted persistence (mainly).
We saw the aforementioned Couchbase quote and tried this (with Couchbase bucket) and it was a pleasant surprise. It worked , just like that. +1 for that.
We found that there also exists a Couchbase C api, Now following are the questions,
If libmemcached API is enough to use Couchbase, what does the Couchbase C API offer ?
What are the disadvantages of ( continuing ) to use (existing ) libmemached API to talk to Couchbase type bucket of Couchbase server ?
What are the advantages of upgrading our application to use Couchbase C api to talk to Couchbase server ?
1) If libmemcached API is enough to use Couchbase, what does the
Couchbase C API offer ?
Of course couchbase extends memcached protocol with new operations, like touch, observe, get with lock, unlock, read from replica etc. Some of them although can be implemented in libmemcached (I've done patch for touch command a while ago), not supported by the vanilla memcached server, therefore it will be harder to test and maintain in libmemcached. Other commands like observe, read from replica, cannot be implemented in terms of libmemcached at all. Another group of APIs of Couchbase is view queries to database indexes, which built with map/reduce, libcouchbase is able to do it.
2) What are the disadvantages of ( continuing ) to use (existing )
libmemached API to talk to Couchbase type bucket of Couchbase server ?
Libmemcached, like any other memcached client you can find, considered as "dumb" or "legacy" client, as opposed to "smart" clients. The difference is whether or not the client aware of cluster topology. Legacy clients have to go through single entry point in the cluster or do some kind of balancing (like round-robin). And by default it will use server-side proxy for that, which aware of topology and can re-route in case that this node doesn't own the key. Therefore you will likely hit the limit of this proxy, when network/CPU/memory capacity actually enough to serve requests (although it is possible to setup this proxy on client side). The smart clients aware of the cluster topology and follow its change, so that it can eliminate re-routing of the keys.
3) What are the advantages of upgrading our application to use
Couchbase C api to talk to Couchbase server ?
You will be able to access other APIs and extended API of memcached. Also Couchbase clients can optimize network usage.

Resources