I finally found it after looking at the fast track tutorial again.

Mistake #1 -> erlang noob

    Conn = riakc_pb_socket:start("127.0.0.1", 8091)

is wrong, it should be

    {ok, Conn} = ...

And after that I had the port wrong, (8081-3 for the fast track dev db's).

Thanks!


On Thu, Sep 15, 2011 at 2:32 PM, bill robertson
<[email protected]>wrote:

> I have a 0.14.2 dev database set up from the riak fast track tutorial.
>
> I created an Erlang application that creates a new route for webmachine
> upon startup.
>
> configure_webmachine() ->
>     webmachine_router:add_route(
>       {["foo", bar, '*'], myapp_myresource, []}).
>
> I modified vm.args for all three instances to point to the application by
> adding the following lines.
>
> -pa /home/me/my_app/ebin
> -s my_app
>
> I am able to reach the /foo URL from all three instances of Riak
> (localhost:8091-93). So I assume that every instance also has access to my
> map-reduce code too.
>
> Also included in the application is a module with a test map-reduce query
> in it. I have a binary encoded Erlang term stored in the database, and I am
> down to simply trying to just retrieve the one entry and return 'something'
> from a map function.  (i.e. I've been cutting things out until there is
> nothing left to cut out), and I am receiving errors.
>
> Here is the mapred code.
>
>     Conn = riakc_pb_socket:start("127.0.0.1", 8091),
>     A = fun(Value, Key, Arg) -> args(Value, Key, Arg) end,
>     Result = riakc_pb_socket:mapred(Conn, [{<<"bucket">>, <<"key">>}],
>                                     [{map, {qfun, A}, none, true}]),
>
> args(_Value, _Key, _Arg) ->
>     [args].
>
> This code bombs, and then I get the following back from webmachine in the
> browsers (binary goo elided).
>
> Internal Server Error
> The server encountered an error while processing this request:
>
> {error,
>     {exit,
>         {{function_clause,
>              [{gen,call,
>                   [{ok,<0.268.0>},
>                    '$gen_call',
>                    {req,
>                        {rpbmapredreq,
>                            <<131,108, ...,106>>,
>                            <<"application/x-erlang-binary">>},
>                        60100,
>                        {1061003,<0.252.0>}},
>                    60000]},
>               {gen_server,call,3},
>               {riakc_pb_socket,mapred,5},
>               {myapp_mapred,do_mapred,6},
>               {myapp_myresource,to_html,2},
>               {webmachine_resource,resource_call,3},
>               {webmachine_resource,do,3},
>               {webmachine_decision_core,resource_call,1}]},
>          {gen_server,call,
>              [{ok,<0.268.0>},
>               {req,
>                   {rpbmapredreq,
>                       <<131,108, ...,106>>,
>                       <<"application/x-erlang-binary">>},
>                   60100,
>                   {1061003,<0.252.0>}},
>               60000]}},
>         [{gen_server,call,3},
>          {riakc_pb_socket,mapred,5},
>          {myapp_mapred,do_mapred,6},
>          {myapp_myresource,to_html,2},
>          {webmachine_resource,resource_call,3},
>          {webmachine_resource,do,3},
>          {webmachine_decision_core,resource_call,1},
>          {webmachine_decision_core,decision,1}]}}
>
> sasl-error.log and erlang.log has the same error information as from the
> browser on the node that I made the request to. I checked the logs of one of
> the other nodes and found nothing.
>
> I must be doing something wrong, but I have no idea what.
>
> Any suggestions as to what to do?
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to