有没有人想出一种方法来保护 Cassandra 和 Astyanax 客户端之间的通信?
SSL 最好能够进行客户端证书身份验证 + 加密...

最佳答案

我将假设您已在 cassandra 中启用 SSL 并拥有 keystore 文件,如果不是关于 enabling SSL in Astyanax here. 的完整博客

在构建 Keyspace 上下文时,您需要将 keystore 文件及其密码传递给 Astyanax:

AstyanaxContext<Keyspace> ctx = new AstyanaxContext.Builder()
    .forKeyspace("MyKeyspace")
    // Config parameters
    .withConnectionPoolConfiguration(
         new com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl("MyConnectionPool")
        .setSeeds("127.0.0.1")
        .setSSLConnectionContext(
             new SSLConnectionContext(
             "/path/to/certificate/cassandra_external_trust.jks", // tell Astyanax the fully qualified path to the keystore file C* is using
             "somePassword")))                                    // supply the keystore file's password too
    .buildKeyspace(ThriftFamilyFactory.getInstance());
ctx.start();

关于ssl - Astyanax 和 Cassandra 之间的安全通信,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10998846/

10-11 06:23