Ubuntu(或Windows)上的python和phoenixdb。怎么样?

时间:2017-02-24 09:17:35

标签: python windows ubuntu phoenix

我创建了一个连接Phoenix HBase的python脚本来分析一些数据。我想在我运行的ubuntu服务器上的crontab上设置这个脚本。

该脚本完全能够在我的Windows 10计算机上运行。但是当我尝试在Ubuntu上使用phoenixdb连接器时,我在RunTime上收到错误。

>>> import phoenixdb
>>> url = '<some-url>'
>>> conn = phoenixdb.connect(url, autocommit=True)
Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.5/site-packages/phoenixdb/avatica.py", line 156, in connect
self.connection.connect()
  File "/usr/lib/python3.5/http/client.py", line 849, in connect
(self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.5/socket.py", line 711, in create_connection
raise err
  File "/usr/lib/python3.5/socket.py", line 702, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.5/site-packages/phoenixdb/__init__.py", line 63, in connect
client.connect()
  File "/home/ubuntu/.local/lib/python3.5/site-packages/phoenixdb/avatica.py", line 158, in connect
    raise errors.InterfaceError('Unable to connect to the specified service', e)
phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service', TimeoutError(110, 'Connection timed out'), None, None)

我希望有人知道解决这个问题的方法吗?

我在Windows上运行Python 3.6,在Ubuntu上运行Python 3.5.2,但我怀疑这是问题所在。

编辑: 我现在已经启动了Windows 2012 Server,并尝试在此处设置我的脚本,并且它似乎不仅仅是Ubuntu的问题。我在Windows上收到完全相同的错误。

>>> import phoenixdb
>>> url = '<some-url>'
>>> conn = phoenixdb.connect(url, autocommit=True)
Traceback (most recent call last):
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\phoenixdb\avatica.py", line 156, in connect
self.connection.connect()
  File "C:\Users\Administrator\Anaconda3\lib\http\client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
  File "C:\Users\Administrator\Anaconda3\lib\socket.py", line 722, in create_connection raise err
  File "C:\Users\Administrator\Anaconda3\lib\socket.py", line 713, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\phoenixdb\__init__.py", line 63, in connect
client.connect()
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\phoenixdb\avatica.py", line 158, in connect
raise errors.InterfaceError('Unable to connect to the specified service', e)

phoenixdb.errors.InterfaceError: ('Unable to connect to the specified service',
TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None), None, None)

我最近对我开发脚本的PC进行了格式化。使用这个phoenixdb连接器,我没有遇到类似的问题。

我也尝试在Windows机器上安装Python 3.6(类似于我在普通PC上安装的相同python版本 - 我开发脚本的那个)。

我真的迷失了找到解决方案..

1 个答案:

答案 0 :(得分:0)

我终于找到了问题。它与我设置脚本的机器无关。它与UTSntu和Windows Server上的AWS机器上的安全设置有关。