简体   繁体   English

如何使用SSL使用NodeJS连接到Cassandra?

[英]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. 我一直在尝试使用SSL选项连接到我的Cassandra节点,但似乎无法正常工作。 I have all the keystore/truststores setup correctly. 我已经正确设置了所有密钥库/信任库。 Node-to-node encryption works, and client-to-node encryption works through OpsCenter and cqlsh --ssl . 节点到节点的加密有效,客户机到节点的加密通过OpsCenter和cqlsh --ssl The question I have, how do I get the proper cert/key/ca files for cassandra-driver on node? 我有一个问题,如何在节点上为cassandra-driver获取正确的cert / key / ca文件? 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. 通过阅读其他Java连接教程,我可以只包含我的密钥库,并且在Ruby连接器上,它说它只需要服务器证书。

Any help is greatly appreciated! 任何帮助是极大的赞赏!

Oh man...it's those types of days... 噢,天啊,那是那种日子

I had it trying to connect to the wrong IP. 我尝试连接到错误的IP。 I think we all need to take a step back from the keyboard every once in a while! 我认为我们每个人都需要不时退一步!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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