Fiware Cygnus 0.7.1不创建表(MySQL和HDFS)

Fiware Cygnus 0.7.1不创建表(MySQL和HDFS),fiware,fiware-cygnus,Fiware,Fiware Cygnus,我已经(从源代码)安装了Cygnus0.7.1,在配置它(MySQL和HDFS接收器)之后,我可以毫无问题地启动它。当我将cygnus订阅到orion上下文时,它会接收信息,但MySQL和HDFS存在问题。这是日志: 15/03/17 13:58:52 INFO handlers.OrionRestHandler: Starting transaction (1426597123-891-0000000000) 15/03/17 13:58:52 INFO handlers.OrionRestH

我已经(从源代码)安装了Cygnus0.7.1,在配置它(MySQL和HDFS接收器)之后,我可以毫无问题地启动它。当我将cygnus订阅到orion上下文时,它会接收信息,但MySQL和HDFS存在问题。这是日志:

15/03/17 13:58:52 INFO handlers.OrionRestHandler: Starting transaction (1426597123-891-0000000000)
15/03/17 13:58:52 INFO handlers.OrionRestHandler: Received data ({  "subscriptionId" : "5508250c1860a36e55240c84",  "originator" : "localhost",  "contextResponses" : [    {      "contextElement" : {        "type" : "ubk-temp",        "isPattern" : "false",        "id" : "ubk:temp:1",        "attributes" : [          {            "name" : "temperature",            "type" : "float",            "value" : "11"          }        ]      },      "statusCode" : {        "code" : "200",        "reasonPhrase" : "OK"      }    }  ]})
15/03/17 13:58:52 INFO handlers.OrionRestHandler: Event put in the channel (id=1549700267, ttl=10)
15/03/17 13:58:52 INFO sinks.OrionSink: Event got from the channel (id=1549700267, headers={fiware-servicepath=ubktemp, destination=ubk_temp_1_ubk-temp, content-type=application/json, fiware-service=ubikwa, ttl=10, transactionId=1426597123-891-0000000000, timestamp=1426597132511}, bodyLength=462)
15/03/17 13:58:52 INFO sinks.OrionSink: Event got from the channel (id=1549700267, headers={fiware-servicepath=ubktemp, destination=ubk_temp_1_ubk-temp, content-type=application/json, fiware-service=ubikwa, ttl=10, transactionId=1426597123-891-0000000000, timestamp=1426597132511}, bodyLength=462)
15/03/17 13:58:52 INFO sinks.OrionMySQLSink: [mysql-sink] Persisting data at OrionMySQLSink. Database: ubikwa, Table: ubktemp_ubk_temp_1_ubk-temp, Timestamp: 2015-03-17T13:58:52.511, Data (attrs): {temperature=11}, (metadata): {temperature_md=[]}
15/03/17 13:58:53 INFO sinks.OrionHDFSSink: [hdfs-sink] Persisting data at OrionHDFSSink. HDFS file (ubikwa/ubktemp/ubk_temp_1_ubk-temp/ubk_temp_1_ubk-temp.txt), Data ({"recvTime":"2015-03-17T13:58:52.511","temperature":"11", "temperature_md":[]})
15/03/17 13:58:53 WARN sinks.OrionSink: Bad context data (Table 'ubikwa.ubktemp_ubk_temp_1_ubk-temp' doesn't exist)
15/03/17 13:58:53 INFO sinks.OrionSink: Finishing transaction (1426597123-891-0000000000)
MySQL接收器不会引发任何错误,但不会创建任何表。HDFS接收器似乎无法创建文件。我以前安装过Cygnus0.6,它使用相同的配置

编辑:

这是我的配置:

cygnusagent.sources = http-source
cygnusagent.sinks = hdfs-sink mysql-sink
cygnusagent.channels = hdfs-channel mysql-channel

#=============================================
# source configuration
# channel name where to write the notification events
cygnusagent.sources.http-source.channels = hdfs-channel mysql-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 = es.tid.fiware.fiwareconnectors.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 = ubikwa
# Default service path (service path semantic depends on the persistence sink)
cygnusagent.sources.http-source.handler.default_service_path = ubktemp
# 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 de
# Timestamp interceptor, do not change
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
# Destination extractor interceptor, do not change
cygnusagent.sources.http-source.interceptors.de.type = es.tid.fiware.fiwareconnectors.cygnus.interceptors.DestinationExtractor$Builder
# Matching table for the destination extractor interceptor, put the right absolute path to the file if necessary
# See the doc/design/interceptors document for more details
cygnusagent.sources.http-source.interceptors.de.matching_table = /opt/cygnus/conf/matching_table.conf

# ============================================
# OrionHDFSSink configuration
# channel name from where to read notification events
cygnusagent.sinks.hdfs-sink.channel = hdfs-channel
# sink class, must not be changed
cygnusagent.sinks.hdfs-sink.type = es.tid.fiware.fiwareconnectors.cygnus.sinks.OrionHDFSSink
# Comma-separated list of FQDN/IP address regarding the Cosmos Namenode endpoints
# If you are using Kerberos authentication, then the usage of FQDNs instead of IP addresses is mandatory
cygnusagent.sinks.hdfs-sink.cosmos_host = 130.206.80.46
# port of the Cosmos service listening for persistence operations; 14000 for httpfs, 50070 for webhdfs and free choice for inifinty
cygnusagent.sinks.hdfs-sink.cosmos_port = 14000
# default username allowed to write in HDFS
cygnusagent.sinks.hdfs-sink.cosmos_default_username = ***
# default password for the default username
cygnusagent.sinks.hdfs-sink.cosmos_default_password = ***
# HDFS backend type (webhdfs, httpfs or infinity)
cygnusagent.sinks.hdfs-sink.hdfs_api = httpfs
# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.hdfs-sink.attr_persistence = column
# Hive FQDN/IP address of the Hive server
cygnusagent.sinks.hdfs-sink.hive_host = 130.206.80.46
# Hive port for Hive external table provisioning
cygnusagent.sinks.hdfs-sink.hive_port = 10000
# Kerberos-based authentication enabling
cygnusagent.sinks.hdfs-sink.krb5_auth = false
# Kerberos username
cygnusagent.sinks.hdfs-sink.krb5_auth.krb5_user = krb5_username
# Kerberos password
cygnusagent.sinks.hdfs-sink.krb5_auth.krb5_password = xxxxxxxxxxxxx
# Kerberos login file
cygnusagent.sinks.hdfs-sink.krb5_auth.krb5_login_conf_file = /usr/cygnus/conf/krb5_login.conf
# Kerberos configuration file
cygnusagent.sinks.hdfs-sink.krb5_auth.krb5_conf_file = /usr/cygnus/conf/krb5.conf

# ============================================
# OrionMySQLSink configuration
# channel name from where to read notification events
cygnusagent.sinks.mysql-sink.channel = mysql-channel
# sink class, must not be changed
cygnusagent.sinks.mysql-sink.type = es.tid.fiware.fiwareconnectors.cygnus.sinks.OrionMySQLSink
# the FQDN/IP address where the MySQL server runs
cygnusagent.sinks.mysql-sink.mysql_host = 127.0.0.1
# the port where the MySQL server listes for incomming connections
cygnusagent.sinks.mysql-sink.mysql_port = 3306
# a valid user in the MySQL server
cygnusagent.sinks.mysql-sink.mysql_username = ***
# password for the user above
cygnusagent.sinks.mysql-sink.mysql_password = ***
# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.mysql-sink.attr_persistence = column

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

#=============================================
# mysql-channel configuration
# channel type (must not be changed)
cygnusagent.channels.mysql-channel.type = memory
# capacity of the channel
cygnusagent.channels.mysql-channel.capacity = 1000
# amount of bytes that can be sent per transaction
cygnusagent.channels.mysql-channel.transactionCapacity = 100
有什么提示吗


谢谢

我相信这是因为您在OrionMySQLSink的配置中使用了参数

# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.mysql-sink.attr_persistence = column 
在文档中指出,当使用列时,必须在cygnus启动之前创建数据库和表。使用行时在第一次插入之前,将自动创建所有8行

在表中,我们可以找到两个选项:

固定了8字段行,与往常一样:RecvTimes、recvTime、entityId、entityType、attrName、attrType、attrValue和attrMd。这些桌子 (和数据库)在执行时创建,如果表没有 在行插入之前存在。关于属性值,在其 最简单的形式,这个值只是一个字符串,但由于Orion 0.11.0 可以是Json对象或Json数组。关于attrMd,它包含一个 Json中属性元数据数组的字符串序列化 (如果属性没有元数据,则插入空数组[]), 每个实体的属性有两列(一列用于值,另一列用于元数据),外加一个关于接收的附加列 数据的时间(记录时间)。这类表(和数据库) 必须在执行天鹅座之前准备好,因为 每个实体可能具有不同数量的属性,并且 通知必须确保通知每个属性的值

关于内部表示的连接器行为 通过一个配置参数来管理数据的, 属性持久性,其值可以是行或列


我相信这是因为您在OrionMySQLSink的配置中使用了参数

# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.mysql-sink.attr_persistence = column 
在文档中指出,当使用列时,必须在cygnus启动之前创建数据库和表。使用行时在第一次插入之前,将自动创建所有8行

在表中,我们可以找到两个选项:

固定了8字段行,与往常一样:RecvTimes、recvTime、entityId、entityType、attrName、attrType、attrValue和attrMd。这些桌子 (和数据库)在执行时创建,如果表没有 在行插入之前存在。关于属性值,在其 最简单的形式,这个值只是一个字符串,但由于Orion 0.11.0 可以是Json对象或Json数组。关于attrMd,它包含一个 Json中属性元数据数组的字符串序列化 (如果属性没有元数据,则插入空数组[]), 每个实体的属性有两列(一列用于值,另一列用于元数据),外加一个关于接收的附加列 数据的时间(记录时间)。这类表(和数据库) 必须在执行天鹅座之前准备好,因为 每个实体可能具有不同数量的属性,并且 通知必须确保通知每个属性的值

关于内部表示的连接器行为 通过一个配置参数来管理数据的, 属性持久性,其值可以是行或列

正如Petark所建议的,“列模式”不会自动创建表,这必须由您在advanced中进行设置。为什么?原因是,根据您订阅Orion CB以向Cygnus发送通知的情况,此类通知有时可能包括一些属性更新,有时包括其他非常不同的属性集,等等

例如,让我们考虑一个称为“Car”的实体,它具有“速度”、“位置”和“油位”。然后你可以说“每次速度变化时通知天鹅座,但只发送速度值。但同时你可以说”每次油位变化时通知天鹅座,并发送所有属性值”“也是。如果汽车开始移动,只有速度和位置发生了变化,但油位没有变化,那么只有速度更新才会通知天鹅座,天鹅座在任何时候都没有机会知道其他属性

因此,如果希望数据行具有所有3个属性,则必须自己配置表。顺便说一句,拥有这样的订阅示例将导致表中出现大量“speed-value,null,null”行

“行模式”的不同之处在于,与通知属性的数量无关,将为每个通知属性添加一个新行,使所有行具有相同的格式(entityId、EntityType、attrName、attrType、attrValue、attrMd);这些格式可以由Cygnus自动设置。

正如Petark建议的那样,“列模式”不会自动创建表,这必须由您在advanced中设置。为什么?原因是,根据您订阅Orion CB以向Cygnus发送通知的情况,此类通知有时可能包括一些属性更新,有时包括其他非常不同的属性集,等等

例如,让我们考虑一个称为“Car”的实体,它具有“速度”、“位置”和“油位”。然后你可以说“每次速度变化时通知天鹅座,但只发送速度值。但同时你可以说“每次油位变化时通知天鹅座,并发送所有属性值”。如果汽车开始移动,只有速度和位置变化,而不是o