0
votes

I am using Cassandra 1.2.3 and I made following change in cassandra config to enable user/password - authenticator: org.apache.cassandra.auth.PasswordAuthenticator

I am able to access the existing keyspace using cassandra-cli. But having issues with querying using hector - (adding credentials at HFactory.getOrCreateCluster did help in moving forward but now i get same error while running queries against the keyspace)

    Map<String, String> AccessMap = new HashMap<String, String>();
    AccessMap.put("username", "cassandra");
    AccessMap.put("password", "cassandra");

    cluster = HFactory.getOrCreateCluster(clusterName,
    new CassandraHostConfigurator(hostport), AccessMap);
    ConfigurableConsistencyLevel ccl = new ConfigurableConsistencyLevel();
    ccl.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);

    keyspace = HFactory.createKeyspace(keyspaceName, cluster, new AllOneConsistencyLevelPolicy(), FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE, AccessMap);

exception thrown when running QueryResult> result = sliceQuery .execute(); -

Caused by: me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:You have not logged in)

Without credentials being added SliceQuery was working fine.

1
I don't have an answer except to recommend using the native Java driver instead of Hector: github.com/datastax/java-driver - jbellis

1 Answers

0
votes

I was using hector 1.1.4 but it is taken care in hector 1.1.5.