I got an error from curl when testing riak

I am new to Riak and web service

I follow fast speed , server side I print

riak start

and on the client side I run curl -H "Accept: text/plain" http://markson.hk:8093/stats

There was an error:

curl: (7) couldn't connect to host

Update

on the server side it really works:

 curl -v http://127.0.0.1:8098/ping response: OK 

But on my client machine

curl -v http://116.255.139.151:8098/ping

it does not work and returns:

 bogon:~ yozloy$ curl -v http://116.255.139.151:8098/ping * About to connect() to 116.255.139.151 port 8098 (#0) * Trying 116.255.139.151... Connection refused * couldn't connect to host * Closing connection #0 curl: (7) couldn't connect to host 

And Nginx welcome pages work!

+4
source share
3 answers

I assume this is a network problem, you can try a proxy or a remote VPS server

 ping 116.255.139.151 PING 116.255.139.151 (116.255.139.151) 56(84) bytes of data. 64 bytes from 116.255.139.151: icmp_seq=1 ttl=46 time=222 ms 64 bytes from 116.255.139.151: icmp_seq=2 ttl=46 time=223 ms 

And I launched the same command on the server that you are using, I got the correct result.

  curl -v http://116.255.139.151:8098/ping * About to connect() to 116.255.139.151 port 8098 (#0) * Trying 116.255.139.151... connected * Connected to 116.255.139.151 (116.255.139.151) port 8098 (#0) > GET /ping HTTP/1.1 > User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15 > Host: 116.255.139.151:8098 > Accept: */* > < HTTP/1.1 200 OK < Server: MochiWeb/1.1 WebMachine/1.9.0 (participate in the frantic) < Date: Tue, 22 Nov 2011 07:00:46 GMT < Content-Type: text/html < Content-Length: 2 < * Connection #0 to host 116.255.139.151 left intact * Closing connection #0 

Hope this is helpful for troubleshooting.

0
source

I ran into a similar problem by installing riak 1.4.2 on a virtual machine, and then try to access the API from the host machine through port forwarding.

The solution was to edit the riak app.config file and change the http parameter. Default / initial setting:

 {http, [ {"127.0.0.1", 8098} ]} 

... which only binds to the loopback interface. If you want riak to respond on other interfaces, you must add them to the setting, for example:

 {http, [ {"XXXX", 8098}, {"127.0.0.1", 8098} ]} 

where XXXX is the address bound to another interface that you would like to use. In the case of my virtual machine, it was a 10.0.XX address.

There is also a similarly formatted pb parameter for the protocol buffer API, which may also need to be updated if you want to access the server using the protocol buffer API from the client machine.

+2
source

2016 response to Riask 2.1.4 (earlier versions differ)

Open the configuration file:

 sudo vi /etc/riak/riak.conf +/http.internal 

Change this line:

 listener.http.internal = 127.0.0.1:8098 

in

 listener.http.internal = 0.0.0.0:8098 

Then restart:

 sudo riak restart 

(Credits: https://gist.github.com/wavell/7979851 )

This is really poorly documented in Riak 2.1.4, an instant output in my assessment.

+2
source

Source: https://habr.com/ru/post/1380925/


All Articles