我在测试 riak 时遇到了curl错误
我是 Riak 和网络服务的新手
,我遵循 riak 快速通道 ,在服务器端输入
riak start
并在客户端运行 curl -H "Accept: text/plain" http://markson.hk:8093/stats
我收到一个错误:
curl: (7) 无法连接到主机
更新
在服务器端
curl -v http://127.0.0.1:8098/ping
response: OK
它实际上有效:但是在我的客户端计算机上
curl -v http://116.255.139.151:8098/ping
它不起作用并返回:
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
Nginx 欢迎页面起作用!
I'm newbie to Riak and web service
I follow the riak fast track,In server side I type
riak start
and in a client side, I run curl -H "Accept: text/plain" http://markson.hk:8093/stats
I got an error:
curl: (7) couldn't connect to host
update
on the server side it actually 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 doesn't 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 works!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在虚拟机中设置 riak 1.4.2 然后尝试通过端口转发从主机访问 API 时遇到了类似的问题。
解决方案是编辑 riak app.config 文件并更改
http
设置。默认/初始设置是:
...仅绑定到环回接口。如果您希望 riak 在其他接口上响应,您必须将它们添加到设置中,例如:
其中
XXXX
是绑定到您要使用的其他接口的地址。对于我的虚拟机来说,这是一个 10.0.XX 地址。
Protocol buffers API 还有一个类似格式的
pb
设置,如果您想从客户端计算机使用 protocol buffers API 访问服务器,您可能也需要更新该设置。I encountered a similar problem setting up riak 1.4.2 in a virtual machine and then trying to access the API from the host machine via port forwarding.
The solution was to edit the riak app.config file and change the
http
setting.The default/initial setting was:
...which only binds to the loopback interface. If you want riak to respond on other interfaces you have to add them to the setting like:
where
X.X.X.X
is the address bound to the other interface you would like to use.In the case of my VM this was a 10.0.X.X address.
There is also a similarly formatted
pb
setting for the protocol buffers API which you may want to update as well if you want to access the server using the protocol buffers API from a client machine.2016 年 Riask 2.1.4 的答案(早期版本有所不同)
打开配置文件:
将此行从:更改
为:
然后重新启动:(
来源:https://gist.github.com/wavell/7979851)
Riak 中对此的记录确实很少2.1.4,我的评价瞬间扣分。
2016 answer for Riask 2.1.4 (earlier versions are different)
Open the config file:
Change this line from:
to:
Then restart:
(Credits: https://gist.github.com/wavell/7979851)
This is really poorly documented in Riak 2.1.4, an instant point deduction in my evaluation.
我想这是一个网络问题,您可以尝试代理或远程 VPS 服务器
,我在服务器上运行您正在使用的相同命令,我得到了正确的结果。
希望这对您的故障排除有用。
I guess this is a network issue, you can try a proxy or a remote VPS server
And I run that on the server same command you are using, I got correct result.
Hope that is useful for your troubleshooting.