如何使用pyorient驱动程序建立与OrientDB分布式数据库的远程连接?

时间:2017-02-10 12:33:13

标签: orientdb orientdb2.2 pyorient

HeJ小鼠, 我正在尝试与数字海洋上的orientdb服务器建立远程连接。

然而,我尝试连接:

client =pyorient.OrientDB(host='remote.host.ip', port=2480)
cluster_info = client.db_open(db_name, db_username, db_password)

我收到以下错误PyOrientConnectionPoolException: Server sent empty string

---------------------------------------------------------------------------
PyOrientConnectionPoolException           Traceback (most recent call last)
<ipython-input-26-f9fe1d9a9205> in <module>()
----> 1 cluster_info = client.db_open(db_name, db_username, db_password)

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/orient.py in db_open(self, db_name, user, password, db_type, client_id)
    376         '''
    377 
--> 378         info, clusters, nodes = self.get_message("DbOpenMessage") \
    379             .prepare((db_name, user, password, db_type, client_id)).send().fetch_response()
    380 

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/orient.py in get_message(self, command)
    487                     token = self._auth_token
    488 
--> 489                 message_instance = _Message(self._connection)\
    490                     .set_session_token(token)
    491                 message_instance._push_callback = self._push_received

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/messages/database.py in __init__(self, _orient_socket)
     45 class DbOpenMessage(BaseMessage):
     46     def __init__(self, _orient_socket):
---> 47         super(DbOpenMessage, self).__init__(_orient_socket)
     48 
     49         self._user = ''

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/messages/base.py in __init__(self, sock)
     22         :type sock: OrientSocket
     23         """
---> 24         sock.get_connection()
     25         self._orientSocket = sock
     26         self._protocol = self._orientSocket.protocol

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/orient.py in get_connection(self)
     50     def get_connection(self):
     51         if not self.connected:
---> 52             self.connect()
     53 
     54         return self._socket

/home/jb/anaconda3/envs/myenv/lib/python3.5/site-packages/pyorient/orient.py in connect(self)
     69 
     70                 raise PyOrientConnectionPoolException(
---> 71                     "Server sent empty string", []
     72                 )
     73 

我正在运行pyorient v 1.5.4和Anaconda3 python 3.5发行版。

任何提示?

1 个答案:

答案 0 :(得分:3)

我发现了我的错误,端口值上的一个愚蠢的错误应该是port:2424而不是属于OrientDB studio的port:2480