I am using express-Cassandra ORM and DB operation with Cassandra.
Env: version: 2.1.1 nodejs 8.9.1 cassandra : 3.9 Cent OS: 6.0
Facing this issue, when running nodejs while initializing models in Cassandra and I need to restart nodejs multiple time to initialize all the modules.
Getting timeout error: cause: { apollo.model.tablecreation.dbindexcreate: Error while creating index on DB Table -> NoHostAvailableError: All host(s) tried for query failed. First host tried, 127.0.0.1:9042: OperationTimedOutError: The host 127.0.0.1:9042 did not reply before timeout 12000 ms. See innerErrors
So after restart mulitpel time I am able to complete cassandra initialisation.
and How can I resolve this or how can I find where are more logs and what is this inner error?
Thanks, James
You may need to use socketOptions.readTimeout
in your clientOptions like the following:
models.setDirectory( __dirname + '/models').bind({
clientOptions: {
contactPoints: ['127.0.0.1'],
protocolOptions: { port: 9042 },
keyspace: 'mykeyspace',
queryOptions: { consistency: models.consistencies.one },
socketOptions: { readTimeout: 0 }
},
ormOptions: {
defaultReplicationStrategy : {
class: 'SimpleStrategy',
replication_factor: 1
},
migration: 'safe'
}
},
function(err) {
if(err) throw err;
});
You may have a look at this discussion: https://github.com/masumsoft/express-cassandra/issues/156