vscode-cql icon indicating copy to clipboard operation
vscode-cql copied to clipboard

Can't connect to Cassandra cluster from VS Code

Open robertcrowe-zz opened this issue 6 years ago • 0 comments

I can successfully connect to our cluster from a Python REPL, but not from inside VS Code, using the same Python code in both cases. My settings look like this:

"cql.schema": {
        "contactPoints": ["172.31.20.224", "172.31.18.74", "172.31.29.10"],
        "hosts": ["172.31.20.224"]
    },
    "cql.address": "172.31.20.224"

The code looks like this:

import cql
from cassandra.cluster import NoHostAvailable
from cassandra.cluster import Cluster
import requests

def create_session():
    cluster = Cluster(contact_points = ["172.31.20.224", "172.31.18.74", "172.31.29.10"])
    session = cluster.connect()    
    return session

# Creating a Cassandra CQL session
if 'session' in locals():
    session.shutdown()

session = create_session()
print(session)

The error that I'm getting is:

NoHostAvailable: ('Unable to connect to any servers', {'172.31.29.10': OperationTimedOut('errors=None, last_host=None',), '172.31.20.224': OperationTimedOut('errors=None, last_host=None',), '172.31.18.74': OperationTimedOut('errors=None, last_host=None',)})

VS Code is started from the same Conda environment as the REPL, and the interpreter is set to match. The CQL Extension is loaded, and VS Code is allowed through the Windows Firewall. Any ideas why I might be having this problem?

robertcrowe-zz avatar Jul 10 '18 17:07 robertcrowe-zz