简体   繁体   中英

Integrate CouchDB with Erlang to connect to Server

How do to integrate couchDB with Erlang to then make connection to a server.

I have a website running, I would like to make a connection between couchDB (which is running and have made a few 'documents' with values).

Checked http://wiki.apache.org/couchdb/Getting_started_with_Erlang - documentation was outdated and disc-continued

Checked https://cwiki.apache.org/confluence/display/COUCHDB/Introduction - They say that " In addition to the fantastic replication features, CouchDB's reliability and scalability is further enhanced by being implemented in the Erlang programming language. Erlang has built-in support for concurrency, distribution, fault tolerance, and has been used for years to build reliable systems in the telecommunications industry. By design, the Erlang language and runtime are able to take advantage of newer hardware with multiple CPU core"

On a general note, I need explanation on how I can make a connection to the server. How does it all work and look?

I tried couchbeam in one little side-project of mine -- used it along with the cowboy-webserver to make a little restful service (serve timeseries-data by 'GET'-requests). It is actually very easy to integrate, if you have a typical erlang/otp-application-stack.

Do you know how rebar works? If not, you should definitly read about it first. Just put the dependency in the rebar.config -file, and you are almost good to go. Just one additional line in the rebar-config:

{erl_opts, [{d, 'WITH_JIFFY'}]}.

To make sure, the compilation is done with the jiffy--NIFs enabled. Also: make sure, you start it, when initializing your application.

couchbeam:start().

Or, put the couchbeam -reference in the .app -file (under {applications, []} ), when you create a relx-release. The connection and API-details are documented on the Github-Page .

PS: What do you mean by: "How does it all work and look?". It works exactly like it is documented ...

PPS: If you don't know what I am talking about at all, read about the OTP-Architecture first, and about rebar and releases second. I didn't understood this when I was starting with erlang, and got quite a bit confused by these concepts at first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM