1

Am trying to connect from Datastax java driver to cassandra secure cluster with kerberos enabled.

Sample connection code:

    cluster = Cluster.builder().addContactPoint(node).withCredentials("username","password").build();
    Metadata metadata = cluster.getMetadata();
    System.out.printf("Connected to cluster: %s\n",
            metadata.getClusterName());
    for (Host host : metadata.getAllHosts()) {
        System.out.printf("Datatacenter: %s; Host: %s; Rack: %s\n",
                host.getDatacenter(), host.getAddress(), host.getRack());

    }
    session = cluster.connect();

Am getting the below error:

Exception in thread "main" com.datastax.driver.core.exceptions.AuthenticationException: Authentication error on host /x.x.x.x: java.lang.RuntimeException: javax.security.auth.login.LoginException: Unable to obtain password from user

at com.datastax.driver.core.Connection.waitForSaslCompletion(Connection.java:204)
at com.datastax.driver.core.Connection.initializeTransport(Connection.java:170)
at com.datastax.driver.core.Connection.<init>(Connection.java:132)
at com.datastax.driver.core.Connection.<init>(Connection.java:59)
at com.datastax.driver.core.Connection$Factory.open(Connection.java:442)
at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:205)
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:168)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:81)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:662)
at com.datastax.driver.core.Cluster$Manager.access$100(Cluster.java:604)
at com.datastax.driver.core.Cluster.<init>(Cluster.java:69)
at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:96)
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:585)
at com.datastax.training.SimpleClient.connect(SimpleClient.java:32)
at com.datastax.training.SimpleClient.main(SimpleClient.java:148)

Am using DSE version 3.1.3. Java driver 1.0.3-dse.

4

1 回答 1

1

在您的代码示例中,您使用用户名/密码凭据进行身份验证,这不适用于 Kerberos。这篇博文包含有关在安全 DSE 集群中使用 java 驱动程序的详细信息:http ://www.datastax.com/dev/blog/accessing-secure-dse-clusters-with-cql-native-protocol

于 2013-10-17T08:43:30.467 回答