Hi Stefan,

You need to configure Riak to listen on the right interface. You are trying
to hit it from 127.0.0.1 which is only available from the local machine.

If you set web_ip to 0.0.0.0 in app.config for riak_core it will listen on
all interfaces. Then you can try to hit it with a curl remotely using
myhost.com from your browser.

-Andrew

On Wed, Dec 1, 2010 at 9:27 PM, Stefan Scott Alexander <
stefanscottal...@gmail.com> wrote:

> Hi -
>
> SUMMARY:
> This may be a silly question but... after installing Riak via ssh, can I
> (or should I) test *remotely* it from a browser?
>
> I'm very excited about being able to learn how to use MapReduce with Riak.
>
> I installed Riak on my remote VPS server (running Debian 5.0 Lenny) - via
> Putty & SSH on my Windows laptop.
>
> So... if I PUT some data into Riak using curl, it seems to show up.
>
> But I can't see it in my browser if I go to my server, eg:
>
> http://myhost.com/riak/images/img001.jpg
>
> returns "Error 101" - webpage not available.
>
> Of course, since my 3 nodes are all at 127.0.0.1, then maybe I *shouldn't*
> be able to access them remotely from a browser.
>
> (By the way, I did open up my firewall on ports 8091, 8092, and 8093 -
> incoming and outgoing).
>
> Anyways... I was just wondering if anyone had any pointers.
>
> +++++
>
> DETAILS:
>
> (0) I followed the steps here:
>
> https://wiki.basho.com/display/RIAK/Building+a+Development+Environment
>
> and everything worked fine.
>
>
> (1) I ran a test:
>
> curl -H "Accept: text/plain" http://127.0.0.1:8091/stats
>
> and got the output:
>
> curl -H "Accept: text/plain" http://127.0.0.1:8091/stats
> {
>     "vnode_gets": 0,
>     "vnode_puts": 0,
>     "read_repairs": 0,
>     "vnode_gets_total": 2,
>     "vnode_puts_total": 1,
>     "node_gets": 0,
>     "node_gets_total": 2,
>     "node_get_fsm_time_mean": "undefined",
>     "node_get_fsm_time_median": "undefined",
>     "node_get_fsm_time_95": "undefined",
>     "node_get_fsm_time_99": "undefined",
>     "node_get_fsm_time_100": "undefined",
>     "node_puts": 0,
>     "node_puts_total": 1,
>     "node_put_fsm_time_mean": "undefined",
>     "node_put_fsm_time_median": "undefined",
>     "node_put_fsm_time_95": "undefined",
>     "node_put_fsm_time_99": "undefined",
>     "node_put_fsm_time_100": "undefined",
>     "read_repairs_total": 0,
>     "cpu_nprocs": 291,
>     "cpu_avg1": 0,
>     "cpu_avg5": 0,
>     "cpu_avg15": 0,
>     "mem_total": 537100288,
>     "mem_allocated": 520372224,
>     "nodename": "d...@127.0.0.1",
>     "connected_nodes": [
>         "d...@127.0.0.1",
>         "d...@127.0.0.1"
>     ],
>     "sys_driver_version": "1.5",
>     "sys_global_heaps_size": 0,
>     "sys_heap_type": "private",
>     "sys_logical_processors": 2,
>     "sys_otp_release": "R14B",
>     "sys_process_count": 155,
>     "sys_smp_support": true,
>     "sys_system_version": "Erlang R14B (erts-5.8.1) [source] [smp:2:2]
> [rq:2] [async-threads:64] [kernel-poll:true]",
>     "sys_system_architecture": "i686-pc-linux-gnu",
>     "sys_threads_enabled": true,
>     "sys_thread_pool_size": 64,
>     "sys_wordsize": 4,
>     "ring_members": [
>         "d...@127.0.0.1",
>         "d...@127.0.0.1",
>         "d...@127.0.0.1"
>     ],
>     "ring_num_partitions": 64,
>     "ring_ownership": "[{'d...@127.0.0.1',21},{'d...@127.0.0.1',21},{'
> d...@127.0.0.1',22}]",
>     "ring_creation_size": 64,
>     "storage_backend": "riak_kv_bitcask_backend",
>     "pbc_connects_total": 0,
>     "pbc_connects": 0,
>     "pbc_active": 0,
>     "riak_err_version": "0.1.0",
>     "runtime_tools_version": "1.8.4.1",
>     "luwak_version": "1.0",
>     "skerl_version": "0.1",
>     "riak_kv_version": "0.13.0",
>     "riak_core_version": "0.13.0",
>     "luke_version": "0.2.2",
>     "erlang_js_version": "0.4.1",
>     "bitcask_version": "1.1.4",
>     "mochiweb_version": "1.7.1",
>     "webmachine_version": "1.7.3",
>     "crypto_version": "2.0.1",
>     "os_mon_version": "2.2.5",
>     "sasl_version": "2.1.9.2",
>     "stdlib_version": "1.17.1",
>     "kernel_version": "2.14.1"
>
> So that looked good.
>
>
> (2) To do a test involving an image, I copied an image (myimg.jpg) into my
> current directory, and then PUT the image into Riak (at
> riak/images/img001.jpg) using curl:
>
> curl -X PUT HTTP://127.0.0.1:8091/riak/images/img001.jpg -H "Content-type:
> image/jpeg" --data-binary @myimg.jpg
>
> Now the image seems to be stored properly in Riak, because it seems that I
> can GET it with curl:
>
> curl -v http://127.0.0.1:8091/riak/images/img001.jpg
>
> (This sends a bunch of garbled text to my Putty/SSH window. I assume this
> means "success" because it's just the binary data of the jpg file.)
>
>
> (3) I also PUT some text, and it seems to work:
>
> curl -v -d 'this is a test' -H "Content-Type: text/plain"
> http://127.0.0.1:8091/riak/test
>
> * About to connect() to 127.0.0.1 port 8091 (#0)
> *   Trying 127.0.0.1... connected
> * Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
> > POST /riak/test HTTP/1.1
> > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g
> zlib/1.2.3.3 libidn/1.8 libssh2/0.18
> > Host: 127.0.0.1:8091
> > Accept: */*
> > Content-Type: text/plain
> > Content-Length: 14
> >
> < HTTP/1.1 201 Created
> < Vary: Accept-Encoding
> < Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
> < Location: /riak/test/QTPs0B1zeu9I1WXtJnaAJpQyOee
> < Date: Thu, 02 Dec 2010 02:12:27 GMT
> < Content-Type: application/json
> < Content-Length: 0
> <
> * Connection #0 to host 127.0.0.1 left intact
> * Closing connection #0
>
> Then I GET the test (using the location key generated above):
>
> curl -v http://127.0.0.1:8091/riak/test/QTPs0B1zeu9I1WXtJnaAJpQyOee
>
> * About to connect() to 127.0.0.1 port 8091 (#0)
> *   Trying 127.0.0.1... connected
> * Connected to 127.0.0.1 (127.0.0.1) port 8091 (#0)
> > GET /riak/test/QTPs0B1zeu9I1WXtJnaAJpQyOee HTTP/1.1
> > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g
> zlib/1.2.3.3 libidn/1.8 libssh2/0.18
> > Host: 127.0.0.1:8091
> > Accept: */*
> >
> < HTTP/1.1 200 OK
> < X-Riak-Vclock: a85hYGBgzGDKBVIsbGvXVWcwJTLmsTJ012Qf48sCAA==
> < Vary: Accept-Encoding
> < Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
> < Link: </riak/test>; rel="up"
> < Last-Modified: Thu, 02 Dec 2010 02:12:27 GMT
> < ETag: 35XAETNjfRGZJESsKwuMvB
> < Date: Thu, 02 Dec 2010 02:12:47 GMT
> < Content-Type: text/plain
> < Content-Length: 14
> <
> * Connection #0 to host 127.0.0.1 left intact
> * Closing connection #0
> this is a test
>
>
> OK, so that's the silly question I have: If I'm connecting to this server
> remotely, is there any point in trying to see that data from a browser?
>
> If I do the following:
>
> http://myhost.com:8091/riak/images/img001.jpg
> http://myhost.com:8091/riak/test/QTPs0B1zeu9I1WXtJnaAJpQyOee
>
> the browser just says "web page unavailable".
>
> +++++
>
> Anyways, everything probably *is* working fine - and I probably just
> shouldn't be trying to test it from a remote browser - because normally I
> wouldn't access "raw" Riak data directly from a browser, right? Eventually
> I'll have some sort of web application framework set up (eg, Nitrogen), and
> in the source of a web page I'll be using a Riak URL as a datasource - say,
> to send out some JSON to populate a control on the web page, right?
>
> Sorry about this newbie question! Thanks for any pointers.
>
> - Scott
>
>
> _______________________________________________
> 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

Reply via email to