当前位置: 首页 > 知识库问答 >
问题:

fiware quantumleap插入板条箱数据库不工作(架构缺失)

轩辕亮
2023-03-14

使用qunatumleap将数据移动到板条箱中,以便稍后使用Grafana显示。

  • 按照教程设置Docker图像

订阅新项目时,quantumleap将在crate_db的表中创建一个条目,以存储提供的值

quantumleap没有在板条箱中创建条目,而是抛出一个“schema not existing”错误。所提供的教程并没有讨论我自己设置这些模式,因此我假设quantumleap通常会设置它们。现在我不知道为什么会失败,很可能是我的配置错误

  1. subscription present in contextBroker:
         curl -X GET \
           'http://localhost:1026/v2/subscriptions/' \
           -H 'fiware-service: openiot' \
           -H 'fiware-servicepath: /'
    
     [
    {"id":"60360eae34f0ca493f0fc148",
    "description":"plc_id",
    "status":"active",
    "subject":{"entities":[{"idPattern":"PLC1"}],
    "condition":{"attrs":["main"]}},
    "notification":{"timesSent":1748,
    "lastNotification":"2021-02-24T08:59:45.000Z",
    "attrs":["main"],
    "onlyChangedAttrs":false,
    "attrsFormat":"normalized",
    "http":{"url":"http://quantumleap:8668/v2/notify"},
    "metadata":["dateCreated","dateModified"],
    "lastSuccess":"2021-02-24T08:59:45.000Z",
    "lastSuccessCode":500},
    "throttling":1}
    ]
    
    orion_1        | INFO@09:07:55  logTracing.cpp[130]: Request received: POST /v1/updateContext, request payload (327 bytes): {"contextElements":[{"type":"plc","isPattern":"false","id":"PLC1","attributes":[{"name":"main","type":"Number","value":"12285","metadatas":[{"name":"SourceTimestamp","type":"ISO8601","value":"2021-02-24T09:07:55.033Z"},{"name":"ServerTimestamp","type":"ISO8601","value":"2021-02-24T09:07:55.033Z"}]}]}],"updateAction":"UPDATE"}, response code: 200
    
    quantumleap_1  | time=2021-02-24 09:07:55.125 | level=ERROR | corr=c7df320c-767f-11eb-bbb3-0242ac1b0005; cbnotif=1 | from=172.27.0.5 | srv=openiot | subserv=/ | op=_insert_entity_rows | comp=translators.crate | msg=Failed to insert entities because of below error; translator will still try saving original JSON in "mtopeniot"."etplc".__original_ngsi_entity__ | payload=[{'id': 'PLC1', 'type': 'plc', 'main': {'type': 'Number', 'value': '12285', 'metadata': {'dateCreated': {'type': 'DateTime', 'value': '2021-02-24T08:28:59.917Z'}, 'dateModified': {'type': 'DateTime', 'value': '2021-02-24T09:07:55.115Z'}}}, 'time_index': '2021-02-24T09:07:55.115000+00:00'}] | thread=140262103055136  | process=67
    
    quantumleap_1  | Traceback (most recent call last): quantumleap_1  |   File "/src/ngsi-timeseries-api/src/translators/sql_translator.py", line 365, in _insert_entity_rows 
    quantumleap_1  |     self.cursor.executemany(stmt, rows) quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/cursor.py", line 67, in executemany quantumleap_1  |     self.execute(sql, bulk_parameters=seq_of_parameters) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/cursor.py", line 53, in execute quantumleap_1  |     self._result = self.connection.client.sql(sql, parameters, 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 331, in sql quantumleap_1  |     content = self._json_request('POST', self.path, data=data) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 458, in _json_request quantumleap_1  |     _raise_for_status(response) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 187, in _raise_for_status 
    quantumleap_1  |     raise ProgrammingError(error.get('message', ''), 
    quantumleap_1  | crate.client.exceptions.ProgrammingError: SQLActionException[SchemaUnknownException: Schema 'mtopeniot' unknown] quantumleap_1  |  quantumleap_1  | During handling of the above exception, another exception occurred: quantumleap_1  |  
    quantumleap_1 | Traceback (most recent call last): 
    quantumleap_1  |   File "/src/ngsi-timeseries-api/src/reporter/reporter.py", line 195, in notify quantumleap_1  |     trans.insert(payload, fiware_s, fiware_sp) 
    quantumleap_1  |   File "/src/ngsi-timeseries-api/src/translators/sql_translator.py", line 221, in insert 
    quantumleap_1  |     res = self._insert_entities_of_type(et, 
    quantumleap_1  |   File "/src/ngsi-timeseries-api/src/translators/sql_translator.py", line 354, in _insert_entities_of_type 
    quantumleap_1  |     self._insert_entity_rows(table_name, col_names, entries, entities) quantumleap_1  |   File "/src/ngsi-timeseries-api/src/translators/sql_translator.py", line 381, in _insert_entity_rows 
    quantumleap_1  |     self._insert_original_entities_in_failed_batch( 
    quantumleap_1  |   File "/src/ngsi-timeseries-api/src/translators/sql_translator.py", line 437, in _insert_original_entities_in_failed_batch 
    quantumleap_1  |     self.cursor.executemany(stmt, rows) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/cursor.py", line 67, in executemany 
    quantumleap_1  |     self.execute(sql, bulk_parameters=seq_of_parameters) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/cursor.py", line 53, in execute 
    quantumleap_1  |     self._result = self.connection.client.sql(sql, parameters, 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 331, in sql 
    quantumleap_1  |     content = self._json_request('POST', self.path, data=data) 
    quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 458, in _json_request 
    quantumleap_1  |     _raise_for_status(response) quantumleap_1  |   File "/usr/local/lib/python3.8/site-packages/crate/client/http.py", line 187, in _raise_for_status 
    quantumleap_1  |     raise ProgrammingError(error.get('message', ''), 
    quantumleap_1  | crate.client.exceptions.ProgrammingError: SQLActionException[SchemaUnknownException: Schema 'mtopeniot' unknown]
    

    cratedb表的截图

    version: "3"
    
    services:
      iotage:
        hostname: iotage
        image: iotagent4fiware/iotagent-opcua
        networks:
          - hostnet
          - iotnet
        ports:
          - "4001:4001"
          - "4081:8080"
        extra_hosts:
          - "iotcarsrv:192.168.2.16"
     #     - "PLC1:192.168.2.57"
        depends_on:
          - iotmongo
          - orion
        volumes:
          - ./certificates:/opt/iotagent-opcua/certificates
          - ./AGECONF:/opt/iotagent-opcua/conf
        command: /usr/bin/tail -f /var/log/lastlog
    
      iotmongo:
        hostname: iotmongo
        image: mongo:3.4
        volumes:
          - iotmongo_data:/data/db
          - iotmongo_conf:/data/configdb
           
      crate-db:
        image: crate
        hostname: crate-db
        ports:
            - "4200:4200"
            - "4300:4300"
        command:
            crate -Clicense.enterprise=false -Cauth.host_based.enabled=false  -Ccluster.name=democluster
            -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
        networks:
          - hostnet
            
      quantumleap:
        hostname: quantumleap
        image: smartsdk/quantumleap
        ports:
            - "8668:8668"
        depends_on:
            - crate-db
        environment:
            - CRATE_HOST=crate-db
        networks:
          - hostnet
            
      grafana:
        image: grafana/grafana
        depends_on:
            - crate-db
        ports:
            - "3003:3000"
        networks:
          - hostnet
    
      ################ OCB ################
    
      orion:
        hostname: orion
        image: fiware/orion:latest
        networks:
          - hostnet
          - ocbnet
        ports:
          - "1026:1026"
        depends_on:
          - orion_mongo
        #command: -dbhost mongo
        entrypoint: /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -statCounters -dbhost mongo -logForHumans -logLevel DEBUG -t 255
    
      orion_mongo:
        hostname: orion_mongo
        image: mongo:3.4
        networks:
          ocbnet:
            aliases:
              - mongo
        volumes:
          - orion_mongo_data:/data/db
          - orion_mongo_conf:/data/configdb
        command: --nojournal
    
    volumes:
      iotmongo_data:
      iotmongo_conf:
      orion_mongo_data:
      orion_mongo_conf:
    
    networks:
      hostnet:
      iotnet:
      ocbnet:
    
    • 添加了docker编写文件

共有1个答案

潘涵煦
2023-03-14

将数据库更改为最新版本(例如Clate db:3.1.2)后,数据很好地到达数据库

 类似资料:
  • 我试图一次将多行插入数据库。 用户最多可以添加5个新行,以便将血液结果插入数据库。 有一个添加更多按钮允许他们这样做。 我有一个循环来遍历每个条目,但是当我单击submit时,只会提交一个条目。第一,我不确定我哪里出了问题,任何帮助都将不胜感激。 循环在这个代码块的底部,但我不确定这就是问题所在。

  • 我的PHP代码中的插入数据sql命令不工作。有人能帮帮忙吗? 我有一个注册表,它从输入字段(姓名、姓氏、电子邮件、用户名和密码)中获取值 用户在此字段中输入的值应保存到我的表“users”中,该表有以下列(ID[主键/INT]、name[文本]、lastname[文本]、e-mail[变量字符]、username[变量字符]和password[变量字符])。 这是我目前的代码:

  • 我是javafx的新手,所以请原谅我的愚蠢错误,我使用javafx创建了一个注册fxml,但是当我试图存储数据时,它总是会把它扔到我的modelcontroller的catch块中,在那里我有一个sql的insert查询 这是我的modelcontroller将我的注册数据插入数据库 它总是抛出modelContoller中的catch块,我通过调试器检查过它

  • 问题内容: 我想将数据从ES(1.0.0)迁移到板条箱(当前可用的版本0.26.0)以将其检出,我该怎么办?我该如何处理索引,ES索引适合Crate吗? 人们可能会想到以下几种流程: 平稳过渡,例如,当我使用ES + Crate节点进行混合群集时,至少要复制一个副本,然后一一杀死ES节点。 我们正在通过“ elasticsearch-cloud-aws”插件进行备份,是否可以“还原”快照,但是使用

  • 我正在尝试对数据库执行条件插入操作(假设为SQLite)。我的目标是确保数据一致性。 假设我们正在做一个预约计划。 所以我们有一个这样的约会表: > 编号 个人的 appointment_date 但是我们有一个重要的规则,一个人在同一天的约会不能超过3次。 通常,我们从数据库中查询此人当天有多少约会。然后我们决定是否插入。对吧? 但是,假设我们有一个获得大量流量的API。假设两个类似的交易在同一

  • 我是android新手,这是我第一次在应用程序中使用room。未执行插入操作或未创建数据库或任何其他错误。 我不知道我做错了什么,所以我需要你的帮助。 此程序正在运行,但未显示任何结果。屏幕上什么都没有显示。 这是我的代码-请让我知道此代码中的错误以及我应该如何更正它。 汽车细节。JAVA 卡多。爪哇- CarListDatabase。JAVA CarRepository.java 公共无效get