简体   繁体   中英

How to connect to Cassandra with NodeJS using SSL?

I've been trying to connect to my Cassandra nodes using SSL option but I can't seem to get it to work. I have all the keystore/truststores setup correctly. Node-to-node encryption works, and client-to-node encryption works through OpsCenter and cqlsh --ssl . The question I have, how do I get the proper cert/key/ca files for cassandra-driver on node? I've tried exporting based on feeds I've found, but there's no good tutorials anywhere.

var fs = require('fs');
var sslOptions = {
    key : fs.readFileSync('node.key'),
    cert : fs.readFileSync('node.cert')
    ca : [fs.readFileSync('clusterCA.pem')]
};

var authProvider = new cassandra.auth.PlainTextAuthProvider('cassandra', 'cassandra');
var client = new cassandra.Client({
  contactPoints: ['x.x.x.x'],
  authProvider: authProvider,
  sslOptions : sslOptions
});

Reading through other Java connection tutorials, I could just include my keystore, and on the Ruby connector, it says it only needs the server certificate.

Any help is greatly appreciated!

Oh man...it's those types of days...

I had it trying to connect to the wrong IP. I think we all need to take a step back from the keyboard every once in a while!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM