Error When Creating an Erlang Riak Object
Hi, I am following the README found here: http://www.bitbucket.org/basho/riak/src/tip/README I have gotten the latest version of Erlang (5.7.5), installed Riak, set up the client connection. But, when I try to create a new object following the README guidelines, I receive an error. (riakt...@127.0.0.1)6> O0 = riak_object:new("groceries", "mine", ["bread"]). ** exception error: no function clause matching riak_object:new("groceries", "mine", ["bread"]) Any suggestions much appreciated. ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Error When Creating an Erlang Riak Object
Thanks Abe! That solved the error. The readme should perhaps be updated to reflect this ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Erlang Map Reduce Example and Multiple Objects
Hi, I am following the Erlang Map Reduce example found here: https://wiki.basho.com/display/RIAK/MapReduce#MapReduce-MapReduceviatheErlangAPI I completed the example successfully with the intended result. But, initially, I received an unintended result when creating a separate object for each value: > O0 = riak_object:new(<<"groceries">>, <<"mine">>, ["bread"]). > Client:put(O0, 1). > O1 = riak_object:new(<<"groceries">>, <<"mine">>, ["cheese"]). > Client:put(O1, 1). > O2 = riak_object:new(<<"groceries">>, <<"yours">>, ["bread"]). > Client:put(O2, 1). > O3 = riak_object:new(<<"groceries">>, <<"yours">>, ["butter"]). > Client:put(O3, 1). The result was: > [{"bread", 2}] and not > [{"cheese", 1}, {"bread", 2}, {"butter", 1}] My question is WHY is there a difference? If you enter multiple values via multiple objects for the same bucket and key, do the map reduce functions not operate over all of the values? Any insights much appreciated. ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
FastTrack Slowing Point
I am following the Riak FastTrack tutorial: https://wiki.basho.com/display/RIAK/Building+a+Development+Environment But I am stumbling on one step: > make devrel For which I get the following error message: cp -Rn dev/riak dev/dev1 cp: invalid option -- n Try 'cp --help' for more information. make: *** [dev1] Error 1 Any suggestions much appreciated. Thanks. ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: FastTrack Slowing Point
OS = Ubuntu Hardy On Tue, May 11, 2010 at 7:25 PM, Grant Schofield wrote: > What OS are you running through the FastTrack tutorial on? > > Thanks, > Grant Schofield > Developer Advocate > Basho Technologies > > > On May 11, 2010, at 12:22 PM, Ted Karmel wrote: > >> I am following the Riak FastTrack tutorial: >> >> https://wiki.basho.com/display/RIAK/Building+a+Development+Environment >> >> But I am stumbling on one step: >> >>> make devrel >> >> For which I get the following error message: >> >> cp -Rn dev/riak dev/dev1 >> cp: invalid option -- n >> Try 'cp --help' for more information. >> make: *** [dev1] Error 1 >> >> >> Any suggestions much appreciated. >> >> Thanks. >> >> ___ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: FastTrack Slowing Point
For future reference, the problem was the GNU Coreutils version. My version was relatively old (6.5) and did not have -n as an option. I updated GNU Coreutils to 8.5 via this source: http://ftp.gnu.org/gnu/coreutils/ I no longer get the invalid option error. But I now get the following error when entering make devrel : cp -Rn dev/riak dev/dev1 cp: cannot stat 'dev/riak' : No such file or directory make: *** [dev1] Error 1 On Tue, May 11, 2010 at 7:39 PM, Ted Karmel wrote: > OS = Ubuntu Hardy > > On Tue, May 11, 2010 at 7:25 PM, Grant Schofield wrote: >> What OS are you running through the FastTrack tutorial on? >> >> Thanks, >> Grant Schofield >> Developer Advocate >> Basho Technologies >> >> >> On May 11, 2010, at 12:22 PM, Ted Karmel wrote: >> >>> I am following the Riak FastTrack tutorial: >>> >>> https://wiki.basho.com/display/RIAK/Building+a+Development+Environment >>> >>> But I am stumbling on one step: >>> >>>> make devrel >>> >>> For which I get the following error message: >>> >>> cp -Rn dev/riak dev/dev1 >>> cp: invalid option -- n >>> Try 'cp --help' for more information. >>> make: *** [dev1] Error 1 >>> >>> >>> Any suggestions much appreciated. >>> >>> Thanks. >>> >>> ___ >>> riak-users mailing list >>> riak-users@lists.basho.com >>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> >> > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Running Riak from Webmachine
I am new to Erlang but would like to give running Riak from Webmachine a try. I have been able to run the Erlang client from the shell based on this documentation : http://riak.basho.com/edoc/basic-client.txt But, I haven't found information on running the client from an application like Webmachine. It may be as simple as placing some riak files in a directory, running some commands, and declaring riak from the webmachine resource. But, as I'm still a newbie, not sure exactly how to approach it. Thanks in advance for any assistance. ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Error Installing Erlang Client
I have a similar problem to an earlier mailing list post : http://lists.basho.com/pipermail/riak-users_lists.basho.com/2010-May/001094.html I tried following riak/client_lib/riak-erlang-client/docs/pb-client.txt plus the suggestions in that post all to no avail. But, here is in detail what I attempted: > erl -pa $PATHTORIAKC/ebin I naturally replaced PATHTORIAKC : /home/tedkarmel/riak/client-libs/riak-erlang-client It seems to work but then I get 'non_existing' when I tried to enter > code:which(riak_pb_client). I then tried the suggested alternative installation > cd riak-erlang-client > ./rebar install I get the following error message: Error: One or more modules listed in riackc.app are not present in ebin/*.beam *riackc_obj *riackc_pb *riackc_pb_socket *riackclient_pb I then tried the following which was suggested in the previous mailing post about installation errors: > make clean && make all Then I try again > ./rebar install which works this time But when I try again > code:which(riak_pb_client). I get > non_existing I then tried as suggested in the previous mailing list post about the error > erl -pa ebin/ deps/*/ebin But still get the non_existing error help... :( ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Error Installing Erlang Client
Thanks Jon! That seems to have done the trick and I do get the location of the beam file as a response. But unfortunately, not off to the races yet. Another noob error that I hope list members will bear with. I have set up a Riak cluster based on the Fast Track doc. Then based on the Erlang Client Introduction ( https://wiki.basho.com/display/RIAK/Erlang+Client+PBC ) I set up a client connection > {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8091). {ok, <0.35.0>} But then I get an error when trying a ping: > riakc_pb_socket:ping(Pid). **exception exit: {timeout, {gen_server, call, [<0.35.0>, {req, rpbpingreq}]}} in function gen_server:call/2 Do I need to set up Riak differently (i.e. not in a cluster)? Have I missed some install steps? Do I need to I can almost taste the riak soup... On Mon, Jun 7, 2010 at 3:41 PM, Jon Meredith wrote: > Hi Ted, > > You should just need the riak-erlang-client/ebin and the protobuffs library. > Here's an example on my local machine. I just checked the docs and there's > a mistake in there. The module you can test to see if you have it all set > up correctly is riakc_pb_socket. > > jons-macpro:systest jmeredith$ erl -pa ~/basho/riak-erlang-client/ebin > ~/basho/riak-erlang-client/deps/protobuffs/ebin > Erlang R13B04 (erts-5.7.5) [source] [smp:8:8] [rq:8] [async-threads:0] > [hipe] [kernel-poll:false] > > Eshell V5.7.5 (abort with ^G) > 1> code:which(riakc_pb_socket). > "/Users/jmeredith/basho/riak-erlang-client/ebin/riakc_pb_socket.beam" > > Sorry for any confusion. Hopefully you'll be off to the races, Jon. > > On 6/7/10 7:33 AM, Ted Karmel wrote: >> >> I have a similar problem to an earlier mailing list post : >> >> http://lists.basho.com/pipermail/riak-users_lists.basho.com/2010-May/001094.html >> >> I tried following >> riak/client_lib/riak-erlang-client/docs/pb-client.txt plus the >> suggestions in that post all to no avail. >> >> But, here is in detail what I attempted: >> >> >>> >>> erl -pa $PATHTORIAKC/ebin >>> >> >> I naturally replaced PATHTORIAKC : >> /home/tedkarmel/riak/client-libs/riak-erlang-client >> >> It seems to work but then I get 'non_existing' when I tried to enter >> >> >>> >>> code:which(riak_pb_client). >>> >> >> I then tried the suggested alternative installation >> >> >>> >>> cd riak-erlang-client >>> >> >> >>> >>> ./rebar install >>> >> >> I get the following error message: >> >> Error: One or more modules listed in riackc.app are not present in >> ebin/*.beam >> *riackc_obj >> *riackc_pb >> *riackc_pb_socket >> *riackclient_pb >> >> I then tried the following which was suggested in the previous mailing >> post about installation errors: >> >> >>> >>> make clean&& make all >>> >> >> Then I try again >> >> >>> >>> ./rebar install >>> >> >> which works this time >> >> But when I try again >> >> >>> >>> code:which(riak_pb_client). >>> >> >> I get >> >> >>> >>> non_existing >>> >> >> I then tried as suggested in the previous mailing list post about the >> error >> >> >>> >>> erl -pa ebin/ deps/*/ebin >>> >> >> But still get the non_existing error >> >> help... :( >> >> ___ >> riak-users mailing list >> riak-users@lists.basho.com >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com >> > > > ___ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
HTTP API DOC ?
Does Riak have an HTTP API doc ( similar to the CouchDB one found here: http://wiki.apache.org/couchdb/HTTP_Document_API )? The closest thing I can find is the Riak Fast Track ( https://wiki.basho.com/display/RIAK/The+Riak+Fast+Track ). But that is in curl only rather than explicit HTTP headers. In particular, I have a problem with the PUT request in the following curl command $ curl -v -X PUT -d '{"bar":"baz"}' -H "Content-Type: application/json" -H "X-Riak-Vclock: a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA==" http://127.0.0.1:8091/riak/test/doc?returnbody=true I try to convert the command into HTTP headers but the request fails when the followin is attempted : a) include {"bar":"baz"} in the body and set the Content-Type header to application/json b) same as a) but add another Content-Type header value - this time of application/x-www-form-urlencoded ( inspired by the info on the -d command found in the following curl manual http://curl.haxx.se/docs/manpage.html ) c) same as b) but instead of placing {"bar":"baz"} in the body, add ampersand in the url and bar=baz http://127.0.0.1:8091/riak/test/doc?returnbody=true&bar=baz I tried looking for an equivalent to the Live HTTP Headers extension on Firefox but which would capture activity from curl commands. Then, I could get a better idea of how to formulate the HTTP headers. Please Help... if there is an HTTP API doc with explicity header request info how to formulate this particular PUT request with the HTTP headers good ubuntu linux utility for capturing http activity even if not from browser application ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: HTTP API DOC ?
Hi Dan, Thanks for your reply. The REST API link was exactly what I was looking for. By converting the command to HTTP headers, what I meant was seeing all of the request and response headers. I realize now that the v parameter does the trick in curl. The curl requests were all successful. It was the http client request from within erlang that was the problem. And hence the desire to look at the http headers more closely (as I perhaps misunderstood how to formulate them). Alas, the http client requests still do not work. I use ibrowse. I try the following in ibrowse for the put request: 4> ibrowse:send_req("http://127.0.0.1:8091/riak/test/doc?returnbody=true";, [{"Content-Type", "application/json"}], put, [{'{"vvfe":"fegtg"}'}]). And I get the following error: {error,{'EXIT',{badarg,[{erlang,list_to_binary, [[{'{"vvfe":"fegtg"}'}]]}, {ibrowse,ensure_bin,1}, {ibrowse,do_send_req,7}, {erl_eval,do_apply,5}, {shell,exprs,7}, {shell,eval_exprs,7}, {shell,eval_loop,3}]}}} Any suggestions? On Tue, Jun 22, 2010 at 10:02 PM, Dan Reverri wrote: > Hi Ted, > A few observations about your original message: > The curl command you provided looks correct, however, there are new line > characters after each header (Content-Type, Riak-X-Vclock). I am not sure > whether or not those were added by the email client. The presence of new > line characters in the headers would cause the request to fail. The request > should work without the new line characters: > curl -v -X PUT -d '{"bar":"baz"}' -H "Content-Type: application/json" -H > "X-Riak-Vclock:a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA==" > http://127.0.0.1:8091/riak/test/doc?returnbody=true > > I am not sure what you mean by converting the command to HTTP headers. The > raw request looks as follows: > PUT /riak/test/doc?returnbody=true HTTP/1.1 > Content-Type: application/json > X-Riak-Vclock: a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA== > {"bar":"baz"} > > Regarding your last attempt, option "c", it's important to note that URL > parameters are not included in the body of the request when processed by > Riak. Riak will store the data included in the body of the request and > ignore unrecognized URL parameters. > Thanks, > Dan > Daniel Reverri > Developer Advocate > Basho Technologies, Inc. > d...@basho.com > > > On Tue, Jun 22, 2010 at 2:27 PM, Dan Reverri wrote: >> >> Hi Ted, >> Documentation for the REST API can be found here: >> https://wiki.basho.com/display/RIAK/REST+API >> >> Regarding the failed requests, can you show us the various requests you >> are making via curl along with the responses? >> Thanks, >> Dan >> Daniel Reverri >> Developer Advocate >> Basho Technologies, Inc. >> d...@basho.com >> >> >> On Tue, Jun 22, 2010 at 1:24 PM, Ted Karmel wrote: >>> >>> Does Riak have an HTTP API doc ( similar to the CouchDB one found >>> here: http://wiki.apache.org/couchdb/HTTP_Document_API )? >>> >>> The closest thing I can find is the Riak Fast Track ( >>> https://wiki.basho.com/display/RIAK/The+Riak+Fast+Track ). But that >>> is in curl only rather than explicit HTTP headers. >>> >>> In particular, I have a problem with the PUT request in the following >>> curl command >>> >>> $ curl -v -X PUT -d '{"bar":"baz"}' -H "Content-Type: >>> application/json" -H "X-Riak-Vclock: >>> a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA==" >>> http://127.0.0.1:8091/riak/test/doc?returnbody=true >>> >>> I try to convert the command into HTTP headers but the request fails >>> when the followin is attempted : >>> >>> a) include {"bar":"baz"} in the body and set the Content-Type header >>> to application/json >>> b) same as a) but add another Content-Type header value - this time >>> of application/x-www-form-urlencoded ( inspired by the info on the >>> -d command found in the following curl manual >>> http://curl.haxx.se/docs/manpage.html ) >>> c) same as b) but instead of placing {"bar":"baz"} in the body, add >>> ampersand in the url and bar=baz >>> http://127.0.0.1:8091/riak/test/doc?returnbody=true&bar=baz >>> >>> I tried looking for an equivalent to the
Re: HTTP API DOC ?
Hi Dan, Thanks for your reply. The backward slash worked and was exactly what was needed. I really appreciate your always helpful suggestions, both here and on the webmachine mailing list. Once again thanks, Ted On Tue, Jun 29, 2010 at 8:48 PM, Dan Reverri wrote: > Hi Ted, > The ibrowse application is expecting the body of the request to be a string, > binary or function. > http://wiki.github.com/cmullaparthi/ibrowse/ibrowse-api#type-body > In your code sample you are passing a list which contains a tuple which > contains an atom. In Erlang single quotes signify an atom, > so '{"vvfe":"fegtg"}' is an atom. You should instead pass a string: > ibrowse:send_req("http://127.0.0.1:8098/riak/test/doc?returnbody=true",[{"Content-Type";, > "application/json"}], put, "{\"vvfe\":\"fegtg\""). > Let me know if that works for you. > Thanks, > Dan > Daniel Reverri > Developer Advocate > Basho Technologies, Inc. > d...@basho.com > > > On Tue, Jun 29, 2010 at 1:38 PM, Ted Karmel wrote: >> >> Hi Dan, >> >> Thanks for your reply. >> >> The REST API link was exactly what I was looking for. >> >> By converting the command to HTTP headers, what I meant was seeing all >> of the request and response headers. I realize now that the v >> parameter does the trick in curl. >> >> The curl requests were all successful. It was the http client request >> from within erlang that was the problem. And hence the desire to look >> at the http headers more closely (as I perhaps misunderstood how to >> formulate them). >> >> Alas, the http client requests still do not work. I use ibrowse. I >> try the following in ibrowse for the put request: >> >> 4> ibrowse:send_req("http://127.0.0.1:8091/riak/test/doc?returnbody=true";, >> [{"Content-Type", "application/json"}], put, [{'{"vvfe":"fegtg"}'}]). >> >> >> And I get the following error: >> >> {error,{'EXIT',{badarg,[{erlang,list_to_binary, >> [[{'{"vvfe":"fegtg"}'}]]}, >> {ibrowse,ensure_bin,1}, >> {ibrowse,do_send_req,7}, >> {erl_eval,do_apply,5}, >> {shell,exprs,7}, >> {shell,eval_exprs,7}, >> {shell,eval_loop,3}]}}} >> >> Any suggestions? >> >> >> >> >> On Tue, Jun 22, 2010 at 10:02 PM, Dan Reverri wrote: >> > Hi Ted, >> > A few observations about your original message: >> > The curl command you provided looks correct, however, there are new line >> > characters after each header (Content-Type, Riak-X-Vclock). I am not >> > sure >> > whether or not those were added by the email client. The presence of new >> > line characters in the headers would cause the request to fail. The >> > request >> > should work without the new line characters: >> > curl -v -X PUT -d '{"bar":"baz"}' -H "Content-Type: application/json" -H >> > "X-Riak-Vclock:a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA==" >> > http://127.0.0.1:8091/riak/test/doc?returnbody=true >> > >> > I am not sure what you mean by converting the command to HTTP headers. >> > The >> > raw request looks as follows: >> > PUT /riak/test/doc?returnbody=true HTTP/1.1 >> > Content-Type: application/json >> > X-Riak-Vclock: a85hYGBgzGDKBVIszMk55zKYEhnzWBlKIniO8mUBAA== >> > {"bar":"baz"} >> > >> > Regarding your last attempt, option "c", it's important to note that URL >> > parameters are not included in the body of the request when processed by >> > Riak. Riak will store the data included in the body of the request and >> > ignore unrecognized URL parameters. >> > Thanks, >> > Dan >> > Daniel Reverri >> > Developer Advocate >> > Basho Technologies, Inc. >> > d...@basho.com >> > >> > >> > On Tue, Jun 22, 2010 at 2:27 PM, Dan Reverri wrote: >> >> >> >> Hi Ted, >> >> Documentation for the REST API can be found here: >> >> https://wiki.basho.com/display/RIAK/REST+API >> >> >> >> Regarding the failed requests, can you show us the various requests you >> >> are making via curl along with the responses? >> >> Th