mongodb - 固件天鹅座 : no data have been persisted in mongo DB

标签 mongodb fiware fiware-cygnus

我正在尝试将 cygnus 与 Mongo DB 一起使用,但数据库中没有持久化数据。 这是在 cygnus 中收到的通知:

15/07/21 14:48:01 INFO handlers.OrionRestHandler: Starting transaction (1437482681-118-0000000000)
15/07/21 14:48:01 INFO handlers.OrionRestHandler: Received data ({  "subscriptionId" : "55a73819d0c457bb20b1d467",  "originator" : "localhost",  "contextResponses" : [    {      "contextElement" : {        "type" : "enocean",        "isPattern" : "false",        "id" : "enocean:myButtonA",        "attributes" : [          {            "name" : "ButtonValue",            "type" : "",            "value" : "ON",            "metadatas" : [              {                "name" : "TimeInstant",                "type" : "ISO8601",                "value" : "2015-07-20T21:29:56.509293Z"              }            ]          }        ]      },      "statusCode" : {        "code" : "200",        "reasonPhrase" : "OK"      }    }  ]})
15/07/21 14:48:01 INFO handlers.OrionRestHandler: Event put in the channel (id=1454120446, ttl=10)

这是我的代理配置:

cygnusagent.sources = http-source
cygnusagent.sinks = OrionMongoSink
cygnusagent.channels = mongo-channel 

#=============================================
# source configuration
# channel name where to write the notification events
cygnusagent.sources.http-source.channels = mongo-channel 
# source class, must not be changed
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
# listening port the Flume source will use for receiving incoming notifications
cygnusagent.sources.http-source.port = 5050
# Flume handler that will parse the notifications, must not be changed
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler
# URL target
cygnusagent.sources.http-source.handler.notification_target = /notify
# Default service (service semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service = def_serv
# Default service path (service path semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service_path = def_servpath
# Number of channel re-injection retries before a Flume event is definitely discarded (-1 means infinite retries)
cygnusagent.sources.http-source.handler.events_ttl = 10
# Source interceptors, do not change
cygnusagent.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
# GroupinInterceptor, do not change
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
# Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
# See the doc/design/interceptors document for more details
cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /home/egm_demo/usr/fiware-cygnus/conf/grouping_rules.conf

# ============================================
# OrionMongoSink configuration
# sink class, must not be changed
cygnusagent.sinks.mongo-sink.type = com.telefonica.iot.cygnus.sinks.OrionMongoSink
# channel name from where to read notification events
cygnusagent.sinks.mongo-sink.channel = mongo-channel
# FQDN/IP:port where the MongoDB server runs (standalone case) or comma-separated list of FQDN/IP:port pairs where the MongoDB replica set members run
cygnusagent.sinks.mongo-sink.mongo_hosts = 127.0.0.1:27017
# a valid user in the MongoDB server (or empty if authentication is not enabled in MongoDB)
cygnusagent.sinks.mongo-sink.mongo_username =
# password for the user above (or empty if authentication is not enabled in MongoDB)
cygnusagent.sinks.mongo-sink.mongo_password =
# prefix for the MongoDB databases
#cygnusagent.sinks.mongo-sink.db_prefix = kura
# prefix pro the MongoDB collections
#cygnusagent.sinks.mongo-sink.collection_prefix = button
# true is collection names are based on a hash, false for human redable collections
cygnusagent.sinks.mongo-sink.should_hash = false

# ============================================
# mongo-channel configuration
# channel type (must not be changed)
cygnusagent.channels.mongo-channel.type = memory
# capacity of the channel
cygnusagent.channels.mongo-channel.capacity = 1000
# amount of bytes that can be sent per transaction
cygnusagent.channels.mongo-channel.transactionCapacity = 100

这是我的规则:

{
    "grouping_rules": [
        {
            "id": 1,
            "fields": [
                "button"
            ],
            "regex": ".*",            
            "destination": "kura",
            "fiware_service_path": "/kuraspath"
        }

     ]
}

有什么我错过的想法吗?预先感谢您的帮助!

最佳答案

这个配置参数是错误的:

cygnusagent.sinks = OrionMongoSink

根据您的配置,它必须是 mongo-sink (我的意思是,当您配置诸如 cygnusagent.sinks.mongo-sink.type).

此外,我建议您不要使用分组规则功能;这是将数据发送到与默认集合不同的集合的高级功能,在第一阶段我会使用默认行为。因此,我的建议是在 cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file 中保留文件路径,但注释其中的所有 JSON :)

关于mongodb - 固件天鹅座 : no data have been persisted in mongo DB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31540631/

相关文章:

固件 IDAS 和 Orion 生产部署

postgresql - 连接系统,包括 OPC UA IoT Agent、Orion Context Broker。 Cygnus 和 Postgres 的历史数据

mongodb - 删除 mongo shell 上的文档

mongodb - mongodb中的查询 View

hadoop - Fi-Ware 宇宙 : Name node is in safe mode

Fiware CEP 使用 Fiware-Service 和 Fiware-ServicePath 将输出事件发送到上下文代理

mongodb - FIWARE Cygnus 在空间使用方面有任何问题吗?

hadoop - Fiware-Cosmos MapReduce

mongodb - 在spring mongodb查询中指定多个条件

mongodb - Couchdb 中任意谓词查询的策略