我正在尝试使用带有cassandra数据库的loopback 3框架从模型自动创建表,并且在连接datasource和cassandra datasource.json时遇到了一些问题
"cassandraConn": {
"host": "192.168.4.21",
"port": 9042,
"database": "emsv2_testing",
"password": "",
"name": "cassandraConn",
"user": "",
"connectTimeout": 30000,
"readTimeout": 30000,
"connector": "cassandra"
}
json模型file:-
{
"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
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
自动迁移创建数据库名称“未定义”,在“未定义”数据库中创建表。尝试发布数据获取以下错误,
{
"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
帮我解决这个问题,谢谢。
1条答案
按热度按时间e1xvtsh31#
您发布的错误表明您的应用程序正试图在您关闭会话或断开与集群的连接后运行查询。
如果您共享应用程序代码的一些相关部分,这里的贡献者将能够更好地帮助您。干杯!