天鹅座没有更新数据库

时间:2015-10-21 18:16:27

标签: fiware fiware-cygnus

我想订阅Orion向Cygnus发送通知。然后cygnus将保存mysql数据库中的所有数据。我使用这个脚本来订阅car1的速度属性。

(curl 130.206.118.44:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Fiware-Service: vehicles' --header 'Fiware-ServicePath: /4wheels' -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "car",
            "isPattern": "false",
            "id": "car1"
        }
    ],
    "attributes": [
        "speed",
        "oil_level"
    ],
    "reference": "http://192.168.1.49:5050/notify",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "speed"
            ]
        }
    ],
    "throttling": "PT1S"
}
EOF

但是当我更新汽车1的速度属性时,天鹅座不会更新数据库。

可用数据库:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

有关我的天鹅座服务和我的天鹅座配置(systemctl status cygnus)的一些信息:

cygnus.service - SYSV: cygnus
   Loaded: loaded (/etc/rc.d/init.d/cygnus)
   Active: active (exited) since Wed 2015-10-21 17:54:07 UTC; 8min ago
  Process: 31566 ExecStop=/etc/rc.d/init.d/cygnus stop (code=exited, status=0/SUCCESS)
  Process: 31588 ExecStart=/etc/rc.d/init.d/cygnus start (code=exited, status=0/SUCCESS)

Oct 21 17:54:05 cygnus systemd[1]: Starting SYSV: cygnus...
Oct 21 17:54:05 cygnus su[31593]: (to cygnus) root on none
Oct 21 17:54:07 cygnus cygnus[31588]: Starting Cygnus mysql...  [  OK  ]
Oct 21 17:54:07 cygnus systemd[1]: Started SYSV: cygnus.

agent_mysql.conf:

# main configuration
cygnusagent.sources = http-source
cygnusagent.sinks = mysql-sink
cygnusagent.channels = mysql-channel

# source configuration
cygnusagent.sources.http-source.channels = mysql-channel
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnusagent.sources.http-source.port = 5050
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler

# url target
cygnusagent.sources.http-source.handler.notification_target = /notify
cygnusagent.sources.http-source.handler.default_service = def_serv
cygnusagent.sources.http-source.handler.default_service_path = def_servpath
cygnusagent.sources.http-source.handler.events_ttl = 10
cygnusagent.sources.http-source.interceptors = ts gi
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf


#Orion MysqlSink Configuration
cygnusagent.sinks.mysql-sink.channel = mysql-channel
cygnusagent.sinks.mysql-sink.type = com.telefonica.iot.cygnus.sinks.OrionMySQLSink
cygnusagent.sinks.mysql-sink.enable_grouping = false
# mysqldb ip
cygnusagent.sinks.mysql-sink.mysql_host = 127.0.0.1
# mysqldb port
cygnusagent.sinks.mysql-sink.mysql_port = 3306
cygnusagent.sinks.mysql-sink.mysql_username = root
cygnusagent.sinks.mysql-sink.mysql_password = 12345
cygnusagent.sinks.mysql-sink.attr_persistence = column
cygnusagent.sinks.mysql-sink.table_type = table-by-destination

# configuracao do canal mysql
cygnusagent.channels.mysql-channel.type = memory
cygnusagent.channels.mysql-channel.capacity = 1000
cygnusagent.channels.mysql-channel.transactionCapacity = 100

在阅读this问题后,我在此行中更改了agent_mysql.conf: cygnusagent.sinks.mysql-sink.attr_persistence = columncygnusagent.sinks.mysql-sink.attr_persistence = row并重新启动了该服务。然后我更新了orion实体,我查询了数据库,没有发生任何事情。

天鹅座日志文件:http://pastebin.com/B2FNKcVf

注意:我的JAVA_HOME已设置。

1 个答案:

答案 0 :(得分:1)

正如您在发布的日志中所看到的,Cygnus日志文件存在问题:

java.io.FileNotFoundException: ./logs/cygnus.log (No such file or directory)
之后,天鹅座停了下来。您必须检查有关log4j的配置,一切都在/usr/cygnus/conf/log4j.properties(它应该存在,它是由RPM创建的......如果不存在 - 因为您从源代替RPM而不是RPM-,它必须是从可用的模板)。另外,你可以发布你的实例配置文件吗?无论如何,你在运行哪个版本?

编辑1

最近,我们发现另一个用户处理同样的错误,问题是/usr/cygnus/conf/log4j.properties文件的内容是:

flume.root.logger=INFO,LOGFILE
flume.log.dir=./log
flume.log.file=flume.log

而不是模板包含的内容:

flume.root.logger=INFO,LOGFILE
flume.log.dir=/var/log/cygnus/
flume.log.file=flume.log

一旦更改,它就会起作用,因为RPM会创建/var/log/cygnus但不会./log