Are you running your node with riakc_pb_socket
in your path? If you look into repo's readme you have to start your VM with compiled erlang binary files added to erl
path
$ erl -pa $PATH_TO_RIAKC/ebin $PATH_TO_RIAKC/deps/*/ebin
If you are in you Erlang shell you can verify that you are able to load module with l(ModuleName).
function. And you could check your path (where to look for binaries) with code:get_path().
. You also could modify it (add new directories) but as general rule you should have correct VM starting script/command.
And finally, if you developing your own application (which i think you are) you could look into tools like rebar. There you could describe all your dependencies, like you erlang-riak client, and he will help you with downloading and compiling them. With this you could strart your VM with simple
erl -pa ebin -pa deps/*/ebin
EDIT after comments
Riak is just another application, and with Erlang you actually can connect wright into it. Just inside working production stuff. But this is quite dangerous, or it could be. You should leave Riak be. At least it internals. Especially that Riak gives you good stable interface to connect to it form outside.
So lets do just that that. We will live your Riaks nodes running, and write yet another application that will "speak" to it. And to do speaking we will use riak-erlang client from basho itself.
First step is creating development environment with use of rebar build tool. Fallowing getting started guide
$ mkdir myapp
$ cd myapp
$ wget https://raw.github.com/wiki/rebar/rebar/rebar && chmod u+x rebar
$ rebar create-app appid=myapp
Other then few other files you now have src
folder where you can (and will) put your custom modules. You can check if it compiles with ./rebar compile
command. All compiled files will be in bin
folder (same level as src
) and will have .beam
extension (just like java have .java
).
Next thing we need is accual library. We need riakc_pb_socket.beam
to run anything from riakc_pb_socket
module. Easiest way to do that is download sources and compile them. And it is quite easy since we use rebar for building stuff.
We gonna create rebar.config
file and populate it with dependency
{deps, [{ riakc, ".*" ,
{git, "https://github.com/basho/riak-erlang-client.git", {branch, "1."}}}
]}.
and download and compile those with
$ ./rebar get-deps compile
And now you should be able to start new Erlang VM, give it a name, add path to your bineries (from custom modules, and dependencies) and from shell run your code.
$ erl -sname myapp -pa ebin -pa deps/*/ebin
(myapp@localhost) 1> custom_module:riakConnect().
and it should just pass.
If you would like to just run some code straight from system console look into erl -run
or escript.
And that should get you going.