Unable to connect to any servers

1,520 views
Skip to first unread message

Eduardo Alfaia

unread,
Oct 29, 2015, 12:04:13 PM10/29/15
to DataStax Python Driver for Apache Cassandra User Mailing List

Hi guys,

I’ve having the error bellow, Does anyone have any idea?

Thanks

python example_core.py
2015-10-29 17:02:21,750 [DEBUG] cassandra.cluster: Connecting to cluster, contact points: ['10.20.255.191']; protocol version: 3
2015-10-29 17:02:21,751 [DEBUG] cassandra.pool: Host 10.20.255.191 is now marked up
2015-10-29 17:02:21,752 [DEBUG] cassandra.cluster: [control connection] Opening new connection to 10.20.255.191
2015-10-29 17:02:21,754 [DEBUG] cassandra.connection: Not sending options message for new connection(28408336) to 10.20.255.191 because compression is disabled and a cql version was not specified
2015-10-29 17:02:21,755 [DEBUG] cassandra.connection: Sending StartupMessage on <LibevConnection(28408336) 10.20.255.191:9042>
2015-10-29 17:02:21,756 [DEBUG] cassandra.connection: Sent StartupMessage on <LibevConnection(28408336) 10.20.255.191:9042>
2015-10-29 17:02:21,756 [DEBUG] cassandra.io.libevreactor: Starting libev event loop
2015-10-29 17:02:21,759 [DEBUG] cassandra.connection: Got ReadyMessage on new connection (28408336) from 10.20.255.191
2015-10-29 17:02:21,761 [DEBUG] cassandra.cluster: [control connection] Established new connection <LibevConnection(28408336) 10.20.255.191:9042>, registering watchers and refreshing schema and topology
2015-10-29 17:02:21,805 [DEBUG] cassandra.cluster: [control connection] Refreshing node list and token map using preloaded results
2015-10-29 17:02:21,806 [INFO] cassandra.policies: Using datacenter 'datacenter1' for DCAwareRoundRobinPolicy (via host '10.20.255.191'); if incorrect, please specify a local_dc to the constructor, or limit contact points to local cluster nodes
2015-10-29 17:02:21,806 [DEBUG] cassandra.cluster: [control connection] Finished fetching ring info
2015-10-29 17:02:21,807 [DEBUG] cassandra.cluster: [control connection] Rebuilding token map due to topology changes
2015-10-29 17:02:31,816 [DEBUG] cassandra.io.libevreactor: Closing connection (28408336) to 10.20.255.191
2015-10-29 17:02:31,817 [DEBUG] cassandra.io.libevreactor: Closed socket to 10.20.255.191
2015-10-29 17:02:31,818 [DEBUG] cassandra.io.libevreactor: All Connections currently closed, event loop ended
2015-10-29 17:02:31,819 [WARNING] cassandra.cluster: [control connection] Error connecting to 10.20.255.191:
Traceback (most recent call last):
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2117, in _reconnect_internal
    return self._try_connect(host)
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2164, in _try_connect
    self._refresh_schema(connection, preloaded_results=shared_results, schema_agreement_wait=-1)
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2343, in _refresh_schema
    responses = connection.wait_for_responses(*queries, timeout=self._timeout, fail_on_error=False)
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/connection.py", line 438, in wait_for_responses
    return waiter.deliver(timeout)
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/connection.py", line 839, in deliver
    raise OperationTimedOut()
OperationTimedOut: errors=None, last_host=None
2015-10-29 17:02:31,827 [ERROR] cassandra.cluster: Control connection failed to connect, shutting down Cluster:
Traceback (most recent call last):
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 840, in connect
    self.control_connection.connect()
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2091, in connect
    self._set_new_connection(self._reconnect_internal())
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2126, in _reconnect_internal
    raise NoHostAvailable("Unable to connect to any servers", errors)
NoHostAvailable: ('Unable to connect to any servers', {'10.20.255.191': OperationTimedOut('errors=None, last_host=None',)})
2015-10-29 17:02:31,828 [DEBUG] cassandra.cluster: Shutting down Cluster Scheduler
2015-10-29 17:02:31,829 [DEBUG] cassandra.cluster: Shutting down control connection
Traceback (most recent call last):
2015-10-29 17:02:31,829 [DEBUG] cassandra.cluster: Not executing scheduled task due to Scheduler shutdown
  File "example_core.py", line 129, in <module>
    main()
  File "example_core.py", line 76, in main
    session = get_session()
  File "example_core.py", line 41, in get_session
    session = cluster.connect()
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 840, in connect
    self.control_connection.connect()
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2091, in connect
    self._set_new_connection(self._reconnect_internal())
  File "/home/ealfaia/workspace_patrizio/python-driver/cassandra/cluster.py", line 2126, in _reconnect_internal
    raise NoHostAvailable("Unable to connect to any servers", errors)
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'10.20.255.191': OperationTimedOut('errors=None, last_host=None',)})
2015-10-29 17:02:31,836 [DEBUG] cassandra.io.libevreactor: Waiting for event loop thread to join...
2015-10-29 17:02:31,837 [DEBUG] cassandra.io.libevreactor: Event loop thread was joined

Adam Holmberg

unread,
Oct 29, 2015, 12:13:22 PM10/29/15
to python-dr...@lists.datastax.com
The control connection is failing to query the schema within the specified timeout. It looks like you've got it set to ten seconds, which would be a very generous timeout under most circumstances.

Can you tell us anything about the cluster? Relevant things would include Cassandra version, cluster size, and schema description.

Are you able to connect using cqlsh? If so, you might try enabling tracing (TRACING ON) and running the queries that are timing out for the driver at this call site:

Adam

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Eduardo Alfaia

unread,
Oct 29, 2015, 1:07:44 PM10/29/15
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi Adam, I am using cassandra standalone the version is 2.1.11 and I am using the file example_core.py for tests. I used cqlsh without problems 
with this:
_SELECT_KEYSPACES = "SELECT * FROM system.schema_keyspaces"
_SELECT_COLUMN_FAMILIES = "SELECT * FROM system.schema_columnfamilies"
_SELECT_COLUMNS = "SELECT * FROM system.schema_columns"
_SELECT_USERTYPES = "SELECT * FROM system.schema_usertypes"
_SELECT_FUNCTIONS = "SELECT * FROM system.schema_functions"
_SELECT_AGGREGATES = "SELECT * FROM system.schema_aggregates"
_SELECT_TRIGGERS = "SELECT * FROM system.schema_triggers"
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.

Anal Nadgouda

unread,
Dec 26, 2019, 11:29:46 AM12/26/19
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi 

I am also facing the exact same problem, however it happens only with specific Cassandra cluster IP. It works with a different cluster IP.
I am using protocol_version = 3, I also tried setting control_connection_timeout=10.0, but no use.

any help here would be much appreciated.

Regards
Anal N 

Anal Nadgouda

unread,
Dec 26, 2019, 11:53:19 AM12/26/19
to python-dr...@lists.datastax.com
actually setting load_balancing_policy=DCAwareRoundRobinPolicy(host_ip) in Cluster() api has resolved the above problem...
but I am still facing following error....
Exception : ("Unable to connect to any servers using keyspace 'xxxxx'", ['y.y.y.y'])

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

--
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.


--
Anal A Nadgouda
Executive Director @
HumanMirror Tech Pvt Ltd

Reply all
Reply to author
Forward
0 new messages