Python Thrift RPC 不适用于 EC2
我正在尝试使用 Thrift 创建一个简单的客户端/服务器应用程序,该应用程序将在 EC2 上运行。
我创建的示例对于 localhost 来说效果很好,但是当我尝试在 ec2 上的两台不同计算机(两台计算机都单独分配了弹性 IP 地址)之间进行 RPC 调用时,它不起作用并出现以下错误:
raceback (most recent call last):
File "SocialQClient.py", line 25, in <module>
transport.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TTransport.py", line 150, in open
return self.__trans.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TSocket.py", line 90, in open
raise TTransportException(type=TTransportException.NOT_OPEN, message=message)
thrift.transport.TTransport.TTransportException: Could not connect to <MY-ELASTIC-IP>:9090
我有我的安全组在两台机器上的 TCP 端口 9090 设置为 0.0.0.0/0。我也尝试过UDP,但没有解决这个问题。我做错了什么?
更新:
I am trying to create a simple client/server application using Thrift which is going to be run on EC2.
The example I created works awesome for localhost, but when I try to make the RPC call across two different machines on ec2 (both of which have separately allocated elastic IP addresses), it does not work with the following error:
raceback (most recent call last):
File "SocialQClient.py", line 25, in <module>
transport.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TTransport.py", line 150, in open
return self.__trans.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TSocket.py", line 90, in open
raise TTransportException(type=TTransportException.NOT_OPEN, message=message)
thrift.transport.TTransport.TTransportException: Could not connect to <MY-ELASTIC-IP>:9090
I have my security group set up for 0.0.0.0/0 for port 9090 on both machines for TCP. I tried UDP also and it did not fix it. What am I doing wrong?
Update:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我大胆猜测,当您的一个 ec2 实例(“node1”)尝试对另一个 ec2 实例(“node2”)进行 RPC 调用时,node2 会返回其内部 IP 地址。
参考 - http://alestic.com/2009/06/ec2-elastic-ip -内部
引用:
下面的一些示例说明了 dig 如何返回不同的值,比较了您使用 Amazon 外部的计算机来 ping 一个 ec2 实例的场景与使用一个 ec2 实例来 ping 另一个 ec2 实例的场景:-
I am hazarding a guess that when one of your ec2 instance ("node1") attempts the RPC call to the other ec2 instance ("node2"), node2 returns its internal IP address instead.
Reference - http://alestic.com/2009/06/ec2-elastic-ip-internal
Quote:
And here's some examples which illustrates how dig returns different values, comparing the scenario where you use a machine outside of Amazon to ping an ec2 instance, versus when you use an ec2 instance to ping another ec2 instance:-