0

我正在尝试使用带有 cassandra 数据库的 loopback 3 框架从模型自动创建表,并且在将数据源与 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 文件:-

{
"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

帮我解决这个问题,谢谢。

4

1 回答 1

0

您发布的错误表明您的应用程序在您关闭会话或与集群断开连接后尝试运行查询。

如果您共享应用程序代码的一些相关部分,这里的贡献者将能够更好地为您提供帮助。干杯!

于 2019-12-19T08:35:47.407 回答