I am currently working on a project with a Go api. It communicates with Cassandra which is on a Google Cloud server.
The problem is that when I try to make a request to Cassandra, Go returns me several errors. After many tests I think that the problem comes from the connection between Go and Cassandra which does not work.
Is there a security check to make the connection? Or did I just make a mistake in my code?
I use gocql
to connect to Cassandra. Here is the Go connection script and the request to make call to Cassandra.
type DBConnection struct {
cluster *gocql.ClusterConfig
session *gocql.Session
}
var connection DBConnection
func SetupDBConnection() {
connection.cluster = gocql.NewCluster(google cloud server adress)
connection.cluster.Consistency = gocql.Quorum
connection.cluster.Keyspace = "keyspace name"
connection.session, _ = connection.cluster.CreateSession()
}
func ExecuteQuery(query string, values ...interface{}) {
connection.session.Query(query).Bind(values...).Exec()
}
go cql retrun this error :
gocql : impossible de créer la session : contrôle : impossible de se connecter aux hôtes initiaux : composez tcp xx.xxx.xxx.xxx:9042 : délai d'attente d'e/s