Helenus cannot connect
I am developing an app in nodejs using the cassandra driver using helenus . helenus version 0.6.10 .
It app.js .
var helenus = require('helenus');
var pool = new helenus.ConnectionPool({
hosts: ['localhost:9160'],
keyspace: 'test_dev',
user: '',
password: ''
});
pool.connect(function(err, keyspace) {
if (err) throw err;
console.log('Listening on port 3000....');
});
pool.on('error', function(err) {
if (err) throw err;
});
When we call pool.connect it throws the following error in the callback.
error name : "HelenusNoAvailableNodesException"
error message : "Failed to connect to any nodes"
When I figure out the problem fix the problem. I found that the onDescribe method in the Connection.prototype.use method throws an error that is "NotFoundException" .
What am I doing wrong? Any help.
source to share
Check your Cassandra version first. If you are using Cassandra 1.2 or higher you should really use the Datastax NodeJS driver . There is really no reason to use Thrift in version 1.2 or higher, as the performance and CQL features far outweigh Thrift. In addition, while the Thrift server is still available for use, no effort has been put into it.
If you are absolutely sure you need to use Thrift, make sure the keyspace exists first. Helenus requires a connection to keys, so if there is no key space, it will not be able to connect to any nodes. If the keyspace exists, run:
nodetool statusthrift
if it says anything other than running
then run nodetool enablethrift
and try again.
If thrift works, I would check the interface configured in your cassandra.yaml
. rpc_address
must match the interface you are connecting to from the client. If you are not sure about the interface, just install it on 0.0.0.0
. rpc_port
should be 9160
. After changing any parameters in cassandra.yaml
you need to restart the cassandra service on each of the nodes in the cluster.
source to share