我有一个亚马逊ec-2实例,公共IP 52.62.132.33。
尝试启动名称服务器会弹出以下错误消息。
(venv)[ec2-user@ip-172-31-6-10 ~]$ pyro4-ns -n 52.62.132.33
Traceback (most recent call last):
File "/home/ec2-user/venv/bin/pyro4-ns", line 11, in <module>
sys.exit(main())
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/naming.py", line 561, in main
hmac=options.key)
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/naming.py", line 369, in startNSloop
daemon = NameServerDaemon(host, port, unixsocket, nathost=nathost, natport=natport, storage=storage)
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/naming.py", line 251, in __init__
super(NameServerDaemon, self).__init__(host, port, unixsocket, nathost=nathost, natport=natport)
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/core.py", line 901, in __init__
self.transportServer.init(self, host, port, unixsocket)
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/socketserver/threadpoolserver.py", line 103, in init
self.sock = socketutil.createSocket(bind=bind_location, reuseaddr=Pyro4.config.SOCK_REUSE, timeout=Pyro4.config.COMMTIMEOUT, noinherit=True, nodelay=Pyro4.config.SOCK_NODELAY)
File "/home/ec2-user/venv/local/lib/python2.7/site-packages/Pyro4/socketutil.py", line 285, in createSocket
sock.bind(bind)
File "/usr/lib64/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address
使用私有IP地址启动名称服务器很好,但是我无法从网络外部访问服务器。
如何使Pyro可以从外部网络访问?