【问题标题】:Connecting to cassandra using java without passing credentials在不传递凭据的情况下使用 java 连接到 cassandra
【发布时间】:2017-08-05 04:46:27
【问题描述】:

我正在使用 datastax cassandra 我有一些与使用 JAVA 的 cassandra 连接相关的查询,下面是我目前用于连接到 cassandra 的代码。

cluster = Cluster.builder().addContactPoint("127.0.0.1").withCredentials("cassandra", "cassandra").withPort(9042).build();

但是由于这有一些安全问题,例如用户名和密码可见,我不能采用这种方法。 有什么方法可以在不传递用户名和密码的情况下安全连接

我看了一些文章,发现我们可以通过Using SSL connections但无法确切知道如何做,如果有人能详细说明SSL方法,那就太好了

我也想知道有没有其他方法可以做到这一点

【问题讨论】:

  • 您可以将用户名和密码移动到配置文件中..
  • 检查 this(withSsl()) 是否适合您,是的,当然,您应该单独存储您的凭据。 Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withCredentials("username", "password").withSSL().build();
  • @redflar3 我同意你的观点,但如果有的话,我正在寻找更安全的方法
  • @PratikAmbani 我需要在集群节点中创建 ssl 证书才能使用它吗?
  • @ShabarinathVolam 显然!您需要在集群节点中使用 SSL 证书。如果您遇到任何代码连接问题,请告诉我。

标签: java security ssl cassandra datastax


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2019-07-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多