简体   繁体   English

将CouchDB与Erlang集成以连接到服务器

[英]Integrate CouchDB with Erlang to connect to Server

How do to integrate couchDB with Erlang to then make connection to a server. 如何将ouchDB与Erlang集成,然后建立与服务器的连接。

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 已检查http://wiki.apache.org/couchdb/Getting_started_with_Erlang-文档已过时且可以继续使用光盘

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" 已检查https://cwiki.apache.org/confluence/display/COUCHDB/Introduction-他们说:“除了出色的复制功能外,CouchDB的可靠性和可扩展性还通过在Erlang编程语言中实现得到了进一步增强。 -支持并发,分发,容错,并且已经在电信行业中用于构建可靠的系统多年。通过设计,Erlang语言和运行时能够利用具有多个CPU内核的更新硬件。

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). 我在我的一个小副项目中尝试过沙发床 -将它与牛仔网络服务器一起使用以提供一些轻松的服务(通过“ GET”请求提供时间序列数据)。 It is actually very easy to integrate, if you have a typical erlang/otp-application-stack. 如果您有典型的erlang / otp-application-stack,它实际上很容易集成。

Do you know how rebar works? 您知道rebar工作原理吗? 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. 只需将依赖项放在rebar.config -file中,就可以了。 Just one additional line in the rebar-config: 在rebar-config中仅增加了一行:

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

To make sure, the compilation is done with the jiffy--NIFs enabled. 为了确保这一点,编译是在启用了jiffy-NIF的情况下完成的。 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. 或者,把couchbeam引用的.app -file(下{applications, []}当你创建一个RELX释放。 The connection and API-details are documented on the Github-Page . 连接和API详细信息记录在Github-Page上

PS: What do you mean by: "How does it all work and look?". PS:您的意思是:“它们如何运作和看起来?”。 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. PPS:如果您根本不了解我在说什么,请先阅读OTP架构 ,然后再阅读钢筋发布 I didn't understood this when I was starting with erlang, and got quite a bit confused by these concepts at first. 当我开始使用erlang时,我并不理解这一点,一开始对这些概念感到相当困惑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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