简体   繁体   English

Orion-LD 的订阅失败并出现 Mongo-DB 错误

[英]Subscription at Orion-LD fails with Mongo-DB error

I try to get a subscription from Orion-LD to Quantum Leap and CrateDB running.我尝试从 Orion-LD 订阅 Quantum Leap 和 CrateDB 运行。 Unfortunately it seems that MongDB throws an error Error (string field 'csf' is missing in BSONObj or Error (string field 'name' is missing in BSONObj' when it tries to access the subscription. The result is that the data can't be passed to Quantum Leap for further processing.不幸的是,似乎 MongDB 在尝试访问订阅时抛出错误Error (string field 'csf' is missing in BSONObj or Error (string field 'name' is missing in BSONObj' 。结果是数据不能传递给 Quantum Leap 进行进一步处理。

...
time=Friday 24 Jun 11:03:59 2022.081Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[145]:getStringField | msg=Runtime Error (string field 'name' is missing in BSONObj <{ _id: "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e", expiration: 2147483647.0, reference: "http://172.18.1.5:8668/v2/notify", custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [ { id: "", isPattern: "", type: "https://uri.fiware.org/ns/data-models#WeatherObserved", isTypePattern: false } ], attrs: [ "https://uri.fiware.org/ns/data-models#temperature" ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld", createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature" ], expression: { q: "https://uri=fiware=org/ns/data-models#temperature<100", mq: "", geometry: "", coords: "", georel: "", geoproperty: "" }, format: "normalized" }> from caller setName:280)
time=Friday 24 Jun 11:03:59 2022.081Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[145]:getStringField | msg=Runtime Error (string field 'csf' is missing in BSONObj <{ _id: "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e", expiration: 2147483647.0, reference: "http://172.18.1.5:8668/v2/notify", custom: false, mimeType: "application/json", throttling: 0.0, servicePath: "/", description: "Notify me of temperature", status: "active", entities: [ { id: "", isPattern: "", type: "https://uri.fiware.org/ns/data-models#WeatherObserved", isTypePattern: false } ], attrs: [ "https://uri.fiware.org/ns/data-models#temperature" ], metadata: [], blacklist: false, ldContext: "http://172.18.1.2/datamodels.context-ngsi.jsonld", createdAt: 1656060138.058298, modifiedAt: 1656060138.058298, conditions: [ "https://uri.fiware.org/ns/data-models#temperature" ], expression: { q: "https://uri=fiware=org/ns/data-models#temperature<100", mq: "", geometry: "", coords: "", georel: "", geoproperty: "" }, format: "normalized" }> from caller setCsf:302)
...

Before that I created and validated the created subscription using在此之前,我使用创建并验证了创建的订阅

Creation: http://localhost:1026/ngsi-ld/v1/subscriptions/创建:http://localhost:1026/ngsi-ld/v1/subscriptions/

{
  "description": "Notify me of temperature",
  "type": "Subscription",
  "entities": [{"type": "WeatherObserved"}],
  "watchedAttributes": ["temperature"],
  "notification": {
    "attributes": ["temperature"],
    "format": "normalized",
    "endpoint": {
      "uri": "http://172.18.1.5:8668/v2/notify",
      "accept": "application/json"
    }
  },
   "@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld"
}

Validation: http://localhost:1026/ngsi-ld/v1/subscriptions/验证:http://localhost:1026/ngsi-ld/v1/subscriptions/

[
    {
        "id": "urn:ngsi-ld:Subscription:62b578ea4567412cdf07306e",
        "type": "Subscription",
        "description": "Notify me of temperature",
        "entities": [
            {
                "type": "WeatherObserved"
            }
        ],
        "watchedAttributes": [
            "temperature"
        ],
        "q": "https://uri.fiware.org/ns/data-models#temperature<100",
        "notification": {
            "attributes": [
                "temperature"
            ],
            "format": "normalized",
            "endpoint": {
                "uri": "http://172.18.1.5:8668/v2/notify",
                "accept": "application/json"
            }
        },
        "@context": "http://172.18.1.2/datamodels.context-ngsi.jsonld"
    },
    ...

So it seems that the subscription actually exists and that orion context broker tries to access it actively according to the repeated MongoDB error in Orion-LD logs ( docker logs -f <orion ld container> ).因此,订阅似乎确实存在,并且 Orion 上下文代理尝试根据 Orion-LD 日志中重复的 MongoDB 错误( docker logs -f <orion ld container> )主动访问它。

Could this be related to an old MongoDB driver?这可能与旧的 MongoDB 驱动程序有关吗? I found similar issues https://github.com/telefonicaid/fiware-orion/issues/3070 .我发现了类似的问题https://github.com/telefonicaid/fiware-orion/issues/3070

Here is my actual docker-compose file:这是我实际的 docker-compose 文件:

version: "3.8"
services:

  ########
  # CORE #
  ########
  # -> Orion: context broker as central component
  orion:
    labels:
      org.test: 'fiware'
    image: fiware/orion-ld:${ORION_VERSION}
    hostname: orion
    container_name: fiware-orion
    depends_on:
      - mongo-db
    networks:
      default:
        ipv4_address: 172.18.1.3
    ports:
      - "${ORION_PORT}:${ORION_PORT}"
    command: -dbhost mongo-db -logLevel DEBUG -noCache
    healthcheck:
      test: curl --fail -s http://orion:${ORION_PORT}/version || exit 1
      interval: 5s

  # -> Context: provide ngsi-ld context file for smart data models 
  ld-context:
    labels:
      org.test: 'fiware'
    image: httpd:alpine
    hostname: context
    container_name: fiware-ld-context
    ports:
        - "3004:80"
    networks:
      default:
        ipv4_address: 172.18.1.2
    volumes:
        - ./context:/usr/local/apache2/htdocs/
    healthcheck:
      test: (wget --server-response --spider --quiet  http://172.18.1.2/datamodels.context-ngsi.jsonld 2>&1 | awk 'NR==1{print $$2}'|  grep -q -e "200") || exit 1
  
  
  ##################
  # DATA MANGEMENT #
  ##################
  # Quantum Leap: is persisting Short Term History to Crate-DB
  quantumleap:
    labels:
      org.test: 'fiware'
    image: orchestracities/quantumleap:${QUANTUMLEAP_VERSION}
    hostname: quantumleap
    container_name: fiware-quantumleap
    depends_on:
      - crate-db
      - redis-db
    networks:
      default:
        ipv4_address: 172.18.1.5
    ports:
      - "${QUANTUMLEAP_PORT}:${QUANTUMLEAP_PORT}"
    environment:
      - CRATE_HOST=crate-db
      - REDIS_HOST=redis-db
      - REDIS_PORT=${REDIS_PORT}
      - LOGLEVEL=DEBUG
    healthcheck:
      test: curl --fail -s http://quantumleap:${QUANTUMLEAP_PORT}/version || exit 1

  #################
  # VISUALIZATION #
  #################
  # -> Grafana: Visualize Time Series data
  grafana:
    labels:
      org.test: 'fiware'
    image: grafana/grafana:6.1.6
    container_name: grafana
    depends_on:
      - crate-db
    networks:
      default:
        ipv4_address: 172.18.1.8
    ports:
      - "3003:3000"
    environment:
      - GF_INSTALL_PLUGINS=https://github.com/orchestracities/grafana-map-plugin/archive/master.zip;grafana-map-plugin,grafana-clock-panel,grafana-worldmap-panel
    volumes:
      - grafana:/var/lib/grafana
  
  #############
  # DATABASES #
  #############
  # -> MongoDB: database of Orion
  mongo-db:
    labels:
      org.test: 'fiware'
    image: mongo:${MONGO_DB_VERSION}
    hostname: mongo-db
    container_name: db-mongo
    expose:
      - "${MONGO_DB_PORT}"
    ports:
      - "${MONGO_DB_PORT}:${MONGO_DB_PORT}" # localhost:27017 # localhost:27017
    networks:
      default:
        ipv4_address: 172.18.1.4
    volumes:
      - mongo-db:/data
    healthcheck:
      test: |
        host=`hostname --ip-address || echo '127.0.0.1'`; 
        mongo --quiet $host/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' && echo 0 || echo 1
      interval: 5s

  # -> CreateDB: database to store time-series data
  crate-db:
    labels:
      org.test: 'fiware'
    image: crate:${CRATE_VERSION}
    hostname: crate-db
    container_name: db-crate
    networks:
      default:
        ipv4_address: 172.18.1.6
    ports:
      # Admin UI
      - "4200:4200"
      # Transport protocol
      - "4300:4300"
    command: crate -Cauth.host_based.enabled=false  -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
    environment:
      - CRATE_HEAP_SIZE=2g # see https://crate.io/docs/crate/howtos/en/latest/deployment/containers/docker.html#troubleshooting
    volumes:
      - crate-db:/data

  # -> Redis: Normally used to efficiently store key value pairs
  redis-db:
    labels:
      org.test: 'fiware'
    image: redis:${REDIS_VERSION}
    hostname: redis-db
    container_name: db-redis
    networks:
      default:
        ipv4_address: 172.18.1.7
    ports:
      - "${REDIS_PORT}:${REDIS_PORT}" # localhost:6379
    volumes:
      - redis-db:/data
    healthcheck:
      test: |
        host=`hostname -i || echo '127.0.0.1'`;
        ping=`redis-cli -h "$host" ping` && [ "$ping" = 'PONG' ] && echo 0 || echo 1
      interval: 10s


# NETWORKS
networks:
  default:
    labels:
      org.test: 'fiware'
    ipam:
      config:
        - subnet: 172.18.1.0/24

# VOLUMES
volumes:
  mongo-db: ~
  context: ~
  grafana: ~
  crate-db: ~
  redis-db: ~  

And my related .env-file:还有我相关的 .env 文件:

# Project name
COMPOSE_PROJECT_NAME=fiware

# Orion variables
ORION_PORT=1026
ORION_VERSION=1.0.0

# MongoDB variables
MONGO_DB_PORT=27017
MONGO_DB_VERSION=4.4

# QuantumLeap Variables
QUANTUMLEAP_VERSION=0.8.3
QUANTUMLEAP_PORT=8668

# CrateDB Version
CRATE_VERSION=4.6

# RedisDB Version
REDIS_PORT=6379
REDIS_VERSION=6

I would be really appreciated for further help as this issue already blocks me for some days.非常感谢您提供进一步的帮助,因为这个问题已经让我困扰了几天。 Thank you in advance!先感谢您!

Would you be so kind and create an issue on Orion-LD's github?你会这么好心并在 Orion-LD 的 github 上创建一个问题吗? This seems like a bug report and not really suited for SOF - which we use for questions.这似乎是一个错误报告,并不真正适合 SOF——我们用它来提问。 Bugs are to be reported as issues: https://github.com/FIWARE/context.Orion-LD/issues .错误将作为问题报告: https ://github.com/FIWARE/context.Orion-LD/issues。 Create the issue and I promise to look into this asap.创建这个问题,我保证会尽快调查这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM