Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

I have try to connect python jupyter notebook with amazon neptune DB Instance, but I got an error like this, what should I do?

This code, I got from the Amazon Neptune Tutorial https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-python.html But, I got an error like this when I try to run the code in Jupyter Notebook (internal in my laptop). This is my code

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-1-fae80b27d2c6> in <module>
     12 g = graph.traversal().withRemote(remoteConn)
     13 
---> 14 print(g.V().limit(2).toList())
     15 
     16 remoteConn.close()

C:ProgramDataAnaconda3libsite-packagesgremlin_pythonprocessraversal.py in toList(self)
     56 
     57     def toList(self):
---> 58         return list(iter(self))
     59 
     60     def toSet(self):

C:ProgramDataAnaconda3libsite-packagesgremlin_pythonprocessraversal.py in __next__(self)
     46     def __next__(self):
     47         if self.traversers is None:
---> 48             self.traversal_strategies.apply_strategies(self)
     49         if self.last_traverser is None:
     50             self.last_traverser = next(self.traversers)

C:ProgramDataAnaconda3libsite-packagesgremlin_pythonprocessraversal.py in apply_strategies(self, traversal)
    571     def apply_strategies(self, traversal):
    572         for traversal_strategy in self.traversal_strategies:
--> 573             traversal_strategy.apply(traversal)
    574 
    575     def apply_async_strategies(self, traversal):

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriver
emote_connection.py in apply(self, traversal)
    147     def apply(self, traversal):
    148         if traversal.traversers is None:
--> 149             remote_traversal = self.remote_connection.submit(traversal.bytecode)
    150             traversal.remote_results = remote_traversal
    151             traversal.side_effects = remote_traversal.side_effects

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverdriver_remote_connection.py in submit(self, bytecode)
     54 
     55     def submit(self, bytecode):
---> 56         result_set = self._client.submit(bytecode, request_options=self._extract_request_options(bytecode))
     57         results = result_set.all().result()
     58         side_effects = RemoteTraversalSideEffects(result_set.request_id, self._client,

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverclient.py in submit(self, message, bindings, request_options)
    125 
    126     def submit(self, message, bindings=None, request_options=None):
--> 127         return self.submitAsync(message, bindings=bindings, request_options=request_options).result()
    128 
    129     def submitAsync(self, message, bindings=None, request_options=None):

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverclient.py in submitAsync(self, message, bindings, request_options)
    146         if request_options:
    147             message.args.update(request_options)
--> 148         return conn.write(message)

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverconnection.py in write(self, request_message)
     53     def write(self, request_message):
     54         if not self._inited:
---> 55             self.connect()
     56         request_id = str(uuid.uuid4())
     57         result_set = resultset.ResultSet(queue.Queue(), request_id)

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverconnection.py in connect(self)
     43             self._transport.close()
     44         self._transport = self._transport_factory()
---> 45         self._transport.connect(self._url, self._headers)
     46         self._protocol.connection_made(self._transport)
     47         self._inited = True

C:ProgramDataAnaconda3libsite-packagesgremlin_pythondriverornadoransport.py in connect(self, url, headers)
     38         if headers:
     39             url = httpclient.HTTPRequest(url, headers=headers)
---> 40         self._ws = self._loop.run_sync(
     41             lambda: websocket.websocket_connect(url, compression_options=self._compression_options))
     42 

~AppDataRoamingPythonPython38site-packagesornadoioloop.py in run_sync(self, func, timeout)
    456         if not future_cell[0].done():
    457             raise TimeoutError('Operation timed out after %s seconds' % timeout)
--> 458         return future_cell[0].result()
    459 
    460     def time(self):

~AppDataRoamingPythonPython38site-packagesornadoconcurrent.py in result(self, timeout)
    236         if self._exc_info is not None:
    237             try:
--> 238                 raise_exc_info(self._exc_info)
    239             finally:
    240                 self = None

~AppDataRoamingPythonPython38site-packagesornadoutil.py in raise_exc_info(exc_info)

~AppDataRoamingPythonPython38site-packagesornadostack_context.py in wrapped(*args, **kwargs)
    314             if top is None:
    315                 try:
--> 316                     ret = fn(*args, **kwargs)
    317                 except:
    318                     exc = sys.exc_info()

~AppDataRoamingPythonPython38site-packagesornadosimple_httpclient.py in _on_timeout(self, info)
    305         error_message = "Timeout {0}".format(info) if info else "Timeout"
    306         if self.final_callback is not None:
--> 307             raise HTTPError(599, error_message)
    308 
    309     def _remove_timeout(self):

HTTPError: HTTP 599: Timeout while connecting

This is the error that I got. What should I do?

question from:https://stackoverflow.com/questions/65913001/i-have-try-to-connect-python-jupyter-notebook-with-amazon-neptune-db-instance-b

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Amazon Neptune runs inside a private VPC. This means that you will not be able to connect to it from your laptop unless you have setup a method to connect into the VPC. This can be done via setting up an ssh tunnel through a bastion host, ssh port forwarding, or another way such as a client VPN. Here is an example of how to do this for Document DB which is basically the same as for Neptune except that Neptune uses port 8182.

https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...