Connection Refused while connecting to local gremlin console.

944 views
Skip to first unread message

Harshita Jain

unread,
Mar 20, 2018, 2:35:07 PM3/20/18
to Gremlin-users
Hi, 

I am trying to connect to the local gremlin console using python.

Here is the script : 

>>> from gremlin_python import statics

>>> from gremlin_python.structure.graph import Graph

>>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

>>> graph = Graph()

>>> g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))


I am getting a connection refused error. 

Here it is. 


Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 45, in __init__

    password=password)

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/client.py", line 76, in __init__

    self._fill_pool()

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/client.py", line 88, in _fill_pool

    conn = self._get_connection()

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/client.py", line 101, in _get_connection

    self._transport_factory, self._executor, self._pool)

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 40, in __init__

    self.connect()

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/connection.py", line 46, in connect

    self._transport.connect(self._url)

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/tornado/transport.py", line 33, in connect

    lambda: websocket.websocket_connect(url))

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 458, in run_sync

    return future_cell[0].result()

  File "/home/jhrsht/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result

    raise_exc_info(self._exc_info)

  File "<string>", line 4, in raise_exc_info

ConnectionRefusedError: [Errno 111] Connection refused



Any suggestions?

Stephen Mallette

unread,
Mar 20, 2018, 2:50:05 PM3/20/18
to Gremlin-users
can you connect from the Gremlin Console?

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/2aa5ecd4-0626-44fa-9ec7-e4d2c9a0ec13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harshita Jain

unread,
Mar 20, 2018, 2:58:45 PM3/20/18
to Gremlin-users
No. 
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

Stephen Mallette

unread,
Mar 20, 2018, 3:10:56 PM3/20/18
to Gremlin-users
hate to ask an obvious question, but is Gremlin Server running? did you change anything it it's yaml? port perhaps? 

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/5b91a5c7-c37c-40b4-8eca-b328dfb4a9dd%40googlegroups.com.

Harshita Jain

unread,
Mar 20, 2018, 6:40:43 PM3/20/18
to Gremlin-users
Yes. I checked everything. The server is running. I am able to connect to the server using console. But I am still getting the same error using the python script. 

Harshita Jain

unread,
Mar 20, 2018, 7:15:34 PM3/20/18
to Gremlin-users
This is the command i used to start the server. 

$ bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml

Harshita Jain

unread,
Mar 20, 2018, 7:25:09 PM3/20/18
to Gremlin-users

Here are the commands that I used to interact with the server from Gremlin Console. 



apache-tinkerpop-gremlin-console-3.3.1 jhrsht$ bin/gremlin.sh 


         \,,,/

         (o o)

-----oOOo-(3)-oOOo-----

plugin activated: tinkerpop.server

plugin activated: tinkerpop.utilities

plugin activated: tinkerpop.tinkergraph

gremlin> :remote connect tinkerpop.server conf/remote.yaml

==>Configured localhost/127.0.0.1:8182

gremlin> :remote console

==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182] - type ':remote console' to return to local mode

gremlin> 

gremlin> 

gremlin> 

gremlin> :> g.V()

==>v[1]

==>v[2]

==>v[3]

==>v[4]

==>v[5]

==>v[6]

gremlin> 

gremlin> 

gremlin> 

Robert Dale

unread,
Mar 21, 2018, 4:59:42 AM3/21/18
to gremli...@googlegroups.com
Are you running python on the same server (localhost)?



Robert Dale

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/df7f3ef6-7146-4005-9c7f-a17ce15875f1%40googlegroups.com.

Harshita Jain

unread,
Mar 21, 2018, 12:25:43 PM3/21/18
to Gremlin-users
Yes. I followed the instructions from the documentation. http://tinkerpop.apache.org/docs/current/reference/#gremlin-python

Robert Dale

Stephen Mallette

unread,
Mar 23, 2018, 1:40:35 PM3/23/18
to Gremlin-users
I'm not sure what else to ask - "connection refused" is such a low-level sort of error. Even mixing versions of gremlin-python/gremlin server shouldn't give you that kind of trouble that i know of. not sure if anyone else has ideas on this one.

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/b2d09288-0e74-44a9-9d05-beb89f06b654%40googlegroups.com.

Kaushik Pasi

unread,
Jul 13, 2019, 11:14:57 AM7/13/19
to Gremlin-users
You may need to add this line:
>>> from gremlin_python import statics >>> from gremlin_python.structure.graph import Graph >>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection # loading statics enables __.out() to be out() and P.gt() to be gt() >>> statics.load_statics(globals()) #<------------This line. Reference: http://tinkerpop.apache.org/docs/current/tutorials/gremlin-language-variants/#using-python-and-remoteconnection >>> graph = Graph() >>> g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
Reply all
Reply to author
Forward
0 new messages