In my Cassandra config I have enabled user authentication and connect with
cqlsh over ssl. I'm having trouble implementing the same with gocql,
following is my code:

cluster := gocql.NewCluster("")
cluster.Authenticator = gocql.PasswordAuthenticator{
     Username: "myuser",
     Password: "mypassword",
cluster.SslOpts = &gocql.SslOptions {
     CertPath: "/path/to/cert.pem",
When I try to connect I get following error:

  gocql: unable to create session: connectionpool: unable to load X509 key
pair: open : no such file or directory

In python I can do this with something like:

from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
USER = 'username'
PASS = 'password'
ssl_opts = {'ca_certs': '/path/to/cert.pem',
         'ssl_version': PROTOCOL_TLSv1
credentials = PlainTextAuthProvider(username = USER, password = PASS)
# define host, port, cqlsh protocaol version
cluster = Cluster(contact_points= HOST, protocol_version=
CQLSH_PROTOCOL_VERSION, auth_provider = credentials, port = CASSANDRA_PORT)

I checked the gocql and TLS documentation here and here but I'm unsure
about how to set ssl options.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupgolang-nuts @
postedMar 14, '16 at 2:26p
activeMar 14, '16 at 2:26p

1 user in discussion

Fmt: 1 post



site design / logo © 2021 Grokbase