Closed satheshramasamy closed 4 years ago
@satheshramasamy, could you please provide a sample of your model that can help reproducing the problem? Thanks.
{ "name": "data_rt_raw_t1", "plural": "data_rt_raw_t1s", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "properties": { "c_id": { "type": "string", "required": true, "default": null }, "slave_id": { "type": "string", "required": false, "default": null }, "dcu_id": { "type": "string", "required": false, "default": null }, "mfm_read_time": { "type": "date", "required": true, "default": null }, "data_store_time": { "type": "date", "required": false, "default": null }, "p1": { "type": "number", "required": false, "default": null }, "p2": { "type": "number", "required": false, "default": null }, "p3": { "type": "number", "required": false, "default": null }, "p4": { "type": "number", "required": false, "default": null }, "p5": { "type": "number", "required": false, "default": null }, "p6": { "type": "number", "required": false, "default": null }, "p7": { "type": "number", "required": false, "default": null }, "p8": { "type": "number", "required": false, "default": null }, "p9": { "type": "number", "required": false, "default": null }, "p10": { "type": "number", "required": false, "default": null }, "p11": { "type": "number", "required": false, "default": null }, "p12": { "type": "number", "required": false, "default": null }, "p13": { "type": "number", "required": false, "default": null }, "p14": { "type": "number", "required": false, "default": null }, "p15": { "type": "number", "required": false, "default": null }, "p16": { "type": "number", "required": false, "default": null }, "p17": { "type": "number", "required": false, "default": null }, "p18": { "type": "number", "required": false, "default": null }, "p19": { "type": "number", "required": false, "default": null }, "p20": { "type": "number", "required": false, "default": null }, "p21": { "type": "number", "required": false, "default": null }, "p22": { "type": "number", "required": false, "default": null }, "p23": { "type": "number", "required": false, "default": null }, "p24": { "type": "number", "required": false, "default": null }, "p25": { "type": "number", "required": false, "default": null }, "p30": { "type": "number", "required": false, "default": null }, "p31": { "type": "number", "required": false, "default": null }, "p32": { "type": "number", "required": false, "default": null }, "p33": { "type": "number", "required": false, "default": null }, "p34": { "type": "number", "required": false, "default": null }, "p35": { "type": "number", "required": false, "default": null }, "p37": { "type": "number", "required": false, "default": null }, "p38": { "type": "number", "required": false, "default": null }, "p39": { "type": "number", "required": false, "default": null }, "p40": { "type": "date", "required": false, "default": null }, "p41": { "type": "number", "required": false, "default": null }, "p42": { "type": "number", "required": false, "default": null }, "p43": { "type": "number", "required": false, "default": null }, "p44": { "type": "number", "required": false, "default": null }, "p45": { "type": "number", "required": false, "default": null }, "p46": { "type": "number", "required": false, "default": null }, "p47": { "type": "number", "required": false, "default": null } }, "validations": [], "relations": {}, "acls": [], "methods": {} }
I chnaged my datasource.json like this,
"cassandraConn": { "createKeyspace":"enms_test_db1", "keyspace":"enms_test_db1", "hostname": "127.0.0.1", "port": 9042, "database": "enms_test_db1", "password": "", "name": "cassandraConn", "user": "", "connectTimeout": 30000, "readTimeout": 30000, "connector": "cassandra" }
its successfully creates Database as i mentioned.. and tables are migrated successfully , but the time of inserting the data the same issue occurs,
{ "error": { "statusCode": 500, "name": "NoHostAvailableError", "message": "Connecting after shutdown is not supported", "info": "Represents an error when a query cannot be performed because no host is available or could be reached by the driver.", "innerErrors": null, "stack": "NoHostAvailableError: Connecting after shutdown is not supported\n at Client._connectCb (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:397:21)\n at Client.promiseWrapper
sorry, i have mistakenly disconnect the database connection inside auto-autoupdate script. 'NoHostAvailableError' is resolved.
ds.autoupdate(lbTables, function (er) {
if (er) throw er;
console.log('Loopback tables [' + lbTables + '] created in ', ds.adapter.name);
ds.disconnect(); // here i made a mistake
});
datasource.json
"cassandraConn": { "host": "192.168.4.21", "port": 9042, "database": "emsv2_testing", "password": "", "name": "cassandraConn", "user": "", "connectTimeout": 30000, "readTimeout": 30000, "connector": "cassandra" }
automigration create database name 'undefined', create tables within 'undefined' database. when posting data showing error,
{ "error": { "statusCode": 500, "name": "NoHostAvailableError", "message": "Connecting after shutdown is not supported", "info": "Represents an error when a query cannot be performed because no host is available or could be reached by the driver.", "innerErrors": null, "stack": "NoHostAvailableError: Connecting after shutdown is not supported\n at Client._connectCb (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:397:21)\n at Client.promiseWrapper (/home/rd/enms/node_modules/cassandra-driver/lib/utils.js:410:13)\n at Client.connect (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:384:31)\n at Array.utils.series.next (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:854:18)\n at next (/home/rd/enms/node_modules/cassandra-driver/lib/utils.js:714:17)\n at Object.series (/home/rd/enms/node_modules/cassandra-driver/lib/utils.js:698:3)\n at Client._innerExecute (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:853:9)\n at Client.handler (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:487:10)\n at Client.promiseWrapper (/home/rd/enms/node_modules/cassandra-driver/lib/utils.js:410:13)\n at Client.execute (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:485:31)\n at Cassandra.executeSQL (/home/rd/enms/node_modules/loopback-connector-cassandra/lib/cassandra.js:238:15)\n at /home/rd/enms/node_modules/loopback-connector/lib/sql.js:651:10\n at /home/rd/enms/node_modules/loopback-datasource-juggler/lib/observer.js:259:9\n at doNotify (/home/rd/enms/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at Cassandra.ObserverMixin._notifyBaseObservers (/home/rd/enms/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n at Cassandra.ObserverMixin.notifyObserversOf (/home/rd/enms/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)" } } my cassandra database is alive..