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.