apache / cassandra-gocql-driver

GoCQL Driver for Apache Cassandra®
https://cassandra.apache.org/
Apache License 2.0
2.57k stars 616 forks source link

create the session but output `no connections were made when creating the session` #1020

Open imxyb opened 6 years ago

imxyb commented 6 years ago

Please answer these questions before submitting your issue. Thanks!

What version of Cassandra are you using?

i use the scylladb 2.0 that is run on docker

What version of Gocql are you using?

latest

What did you do?

` cluster := gocql.NewCluster("47.100.xxx.xx") cluster.Keyspace = "test" cluster.Consistency = gocql.Quorum session, err := cluster.CreateSession()

if err != nil {
    log.Fatal(err)
}

`

What did you expect to see?

the sesssion created

What did you see instead?

but session is nil, the err is output no connections were made when creating the session

Describe your Cassandra cluster

i only has one node in the cluster

my scylladb can execute cqlsh and run normally

how to solve this problem?thanks

iamanarchist commented 6 years ago

I had the same issue with Cassandra 3.11.1. The server is single node in GCE, and I have configured the config as follows:

listen_address = localhost
rpc_address = 0.0.0.0
broadcast_rpc_address = <public_ip>

When using cqlsh to connect to the server remotely (via its public IP), everything works fine. However gocql will always report "no connections were made when creating the session".

I later found out it was trying to connect to my local development Cassandra server because it complains about missing keyspace even though I give the remote server IP...

Please advise. Thanks!

thiagomorales commented 6 years ago

I have same issue using last gocql version using:

const CqlHost = "34.xxx.xxx.xxx" // public IP - cqlsh connection works

cluster := gocql.NewCluster(CqlHost)
cluster.Keyspace = CqlClusterKeyspace
Session, err = cluster.CreateSession()

Using an older version of gocql (from backup) it works like a charm.. I didn't received any error about missing keyspace, but even passing Cassandra host server to NewCluster, looks like gocql ignores it completely..

Zariel commented 6 years ago

Build your application with gocql_debug and share the logs from what is going on with host discovery. Can you share the network setup? What the output of nodetool status is, what the output of SELECT peer, rpc_address FROM system.peers is, what addressed you expect to be able to connect to the cluster via.

On Mon, 27 Nov 2017 at 14:47 Thiago Morales notifications@github.com wrote:

I have same issue using last gocql version using:

const CqlHost = "34.xxx.xxx.xxx" // public IP - cqlsh connection works cluster := gocql.NewCluster(CqlHost) cluster.Keyspace = CqlClusterKeyspace Session, err = cluster.CreateSession()

Using an older version of gocql (from backup) it works like a charm.. I didn't received any error about missing keyspace, but even passing Cassandra host server to NewCluster, looks like gocql ignores it completely..

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gocql/gocql/issues/1020#issuecomment-347203791, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAIpZM0nTB6LCwhfHg3z_zbuWe3EGAcks5s6strgaJpZM4QhYOs .

abhirockzz commented 6 years ago

Facing the same issue.. Any resolution yet ? nodetool status returns the internal IP of the VM where Cassandra is running. gocql fails but I am able to connect successfully using the Cassandra Java driver. gocql_debug gives me unable to dial "<internal VM IP>": dial tcp <internal VM IP>:9042: i/o timeout

abhirockzz commented 6 years ago

ok.. finally resolved this by setting DisableInitialHostLookup to true

evildecay commented 5 years ago

This option has an impact on cluster performance, so this option should not be used in a production environment.

        // If DisableInitialHostLookup then the driver will not attempt to get host info
    // from the system.peers table, this will mean that the driver will connect to
    // hosts supplied and will not attempt to lookup the hosts information, this will
    // mean that data_centre, rack and token information will not be available and as
    // such host filtering and token aware query routing will not be available.
    DisableInitialHostLookup bool
Emixam23 commented 4 years ago

Same issue.. Any workaround? I've just install Cassandra with brew and tried to connect from official doc with golang.. So I don't see at all right now what can be the issue

martin-sucha commented 2 years ago

I don't have enough information to reproduce the issue. At the first look it seems that this could be related to configuration of the cluster. Note that cqlsh connects to a single node directly by default, while gocql discovers all the nodes it should connect to.

Please provide contents of system.local and system.peers tables and output when you compile gocql with gocql_debug tag.