views:

79

answers:

1

I have setup Riak on a Ubuntu machine, and it seam to work if I do riak ping.

Now I would like to use the Riak Java client to store an object, but it doesn't work. I get com.basho.riak.client.response.RiakIORuntimeException when I try to store an object. What am I doing wrong? Is there a way to test if I can access riak from my java client? Do I have to create a Bucket first? how?

import com.basho.riak.client.RiakClient;
import com.basho.riak.client.RiakObject;
import com.basho.riak.client.response.FetchResponse;

public class RiakTest {

    public static void main(String[] args) {

        // connect
        RiakClient riak = new RiakClient("http://192.168.1.107:8098/riak");

        // create object
        RiakObject o = new RiakObject("mybucket", "mykey", "myvalue");

        // store
        riak.store(o);  
    }
}
+2  A: 

Jonas, by default Riak's HTTP server binds only to the local interface (127.0.0.1). To change this, shutdown your instance and edit the app.config file. Change the setting "riak_web_ip" to "0.0.0.0", which will bind to all interfaces.

For more information, see http://wiki.basho.com/display/RIAK