我能够通过更改来包含该库:
{mimetypes, ".*", {git, "git://github.com/spawngrid/mimetypes", {branch, master}}},
%% Uncomment the following lines and comment the bottom lines with specific
%% tags to always pull the latest versions
{nitrogen_core, ".*", {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},
至:
{mimetypes, ".*", {git, "git://github.com/spawngrid/mimetypes", {branch, master}}},
{riakc, "1.4.1",
{git, "git://github.com/basho/riak-erlang-client",
{tag, "1.4.1"}}},
%% Uncomment the following lines and comment the bottom lines with specific
%% tags to always pull the latest versions
{nitrogen_core, ".*", {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},
使用rel/nitrogen/rebar.config
make 重新编译
现在我已经在lib
文件夹下安装了那些,我不确定应该按照文档中的建议在riakc_pb_socket
哪里实施lib
我试过把
{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087),
进入nitrogen_sup:init()
,但我收到此错误消息:
application: nitrogen
exited: {{{badmatch,{error,{tcp,econnrefused}}},
[{nitrogen_sup,init,1,
[{file,"/home/neil/proj/nitrogen/rel/nitrogen/site/src/nitrogen_sup.erl"},
{line,43}]},
{supervisor,init,1,[{file,"supervisor.erl"},{line,239}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]},
{nitrogen_app,start,[normal,[]]}}
type: temporary
我应该在应用程序初始化期间建立一次与 riak 数据库的连接,还是经常在处理新请求时建立这个连接。我看到一些关于连接池的讨论,这是我在应用程序初始化期间设置一次,然后链接到新进程的东西。
我是 erlang/OTP 和这个框架的新手,所以任何方向都将不胜感激。
添加:
当我通过运行氮气应用程序时bin/nitrogen console
,我能够运行{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1",8087).
并且我确实设法pong
从riakc_pb_socket:ping(Pid).
我想现在的问题是:通常在哪些文件中设置/管理关于查询/读取/写入的 riak 连接?