masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
228 stars 67 forks source link

Can't connect to cassandra running in docker #241

Closed MOSMekawy closed 2 years ago

MOSMekawy commented 2 years ago

As the title says I can't connect to cassandra running in docker container. The container exposes 9042 port. I used the docs code here

`var ExpressCassandra = require('express-cassandra'); var models = ExpressCassandra.createClient({ clientOptions: { contactPoints: ['127.0.0.1'], localDataCenter: 'dc1', protocolOptions: { port: 9042 }, keyspace: 'mykeyspace', queryOptions: {consistency: ExpressCassandra.consistencies.one} }, ormOptions: { defaultReplicationStrategy : { class: 'SimpleStrategy', replication_factor: 1 }, migration: 'safe', } });

var MyModel = models.loadSchema('Person', { fields:{ name : "text", surname : "text", age : "int", created : "timestamp" }, key:["name"] });

// MyModel or models.instance.Person can now be used as the model instance console.log(models.instance.Person === MyModel);

// sync the schema definition with the cassandra database table // if the schema has not changed, the callback will fire immediately // otherwise express-cassandra will try to migrate the schema and fire the callback afterwards MyModel.syncDB(function(err, result) { if (err) throw err; // result == true if any database schema was updated // result == false if no schema change was detected in your models });`

masumsoft commented 2 years ago

What's the error you are getting?

masumsoft commented 2 years ago

Closing due to inactivity