2

我们安装了 Orion、Cygnus 和 Cosmos,并试图让它们之间的连接正常工作:通过代理 Orion 消息将被转发到 Cygnus,而 Cygnus 又将这些消息写入 Cosmos 数据库。

我们知道 Orion 工作正常(之前已经测试和使用过),并且已经使用测试 python 脚本测试了 Cygnus(如https://github.com/telefonicaid/fiware-cygnus/blob/master/doc/中所述) quick_start_guide.md)。目前我们正在尝试配置 Cygnus 以便它接收来自 Orion 的消息,然后将它们写入 Cosmos 数据库。

1)我们如何配置 Cygnus/ 需要设置哪些参数,以便获得从 Orion 通过 Cygnus 到 Cosmos 的最简单的工作链接?是否有一个简单的工作示例供我们查看?(agent_1.conf 是唯一需要在 Cygnus 中设置的配置文件吗?)

2) 我们如何/通过什么方式将 Cygnus 订阅到 Orion?

3) 我们如何将数据持久化到 Cosmos?

我们已经在 StackOverflow 上阅读了很多类似问题的答案;并在 Github 或 Fiware 网站上阅读了有关上述内容的文档,但似乎无法使其正常工作......

非常感谢!

4

1 回答 1

1

假设您从 RPM 安装 Cygnus,您需要的最低配置是在文件中为这组参数/usr/cygnus/conf/agent_1.conf赋值(存在/usr/cygnus/conf/agent.conf.template您可以复制的文件):

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

cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnusagent.sources.http-source.channels = hdfs-channel
cygnusagent.sources.http-source.port = 5050
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler
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

cygnusagent.sinks.hdfs-sink.type = com.telefonica.iot.cygnus.sinks.OrionHDFSSink
cygnusagent.sinks.hdfs-sink.channel = hdfs-channel
cygnusagent.sinks.hdfs-sink.enable_grouping = false
cygnusagent.sinks.hdfs-sink.hdfs_host = cosmos.lab.fiware.org
cygnusagent.sinks.hdfs-sink.hdfs_port = 14000
cygnusagent.sinks.hdfs-sink.hdfs_username = hdfs_username
cygnusagent.sinks.hdfs-sink.hdfs_password = xxxxxxxx
cygnusagent.sinks.hdfs-sink.oauth2_token = xxxxxxxx
cygnusagent.sinks.hdfs-sink.file_format = json-column
cygnusagent.sinks.hdfs-sink.hive_server_version = 2
cygnusagent.sinks.hdfs-sink.hive_host = cosmos.lab.fiware.org
cygnusagent.sinks.hdfs-sink.hive_port = 10000
cygnusagent.sinks.hdfs-sink.krb5_auth = false

cygnusagent.channels.hdfs-channel.type = memory
cygnusagent.channels.hdfs-channel.capacity = 1000
cygnusagent.channels.hdfs-channel.transactionCapacity = 100

除上述内容外,您还需要:

  • /usr/cygnus/conf/grouping_rules.conf要创建的这个文件;您可以从/usr/cygnus/conf/grouping_rules.conf.template.
  • 你需要一个 Cosmos 全局实例的账户,你可以在https://cosmos.lab.fiware.org获得。注册后,门户网站将打印您的凭据。用户名和密码都必须在上面的文件中配置。
  • 您将需要一个 OAuth2 令牌,您可以在https://cosmos.lab.fiware.org:13000获得它,如此所述。获取后,必须在上面的文件中进行配置。

现在,您可以将 Cygnus 作为标准应用程序运行:

$ /usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf -f /usr/cygnus/conf/agent_1.conf -n cygnusagent -Dflume.root.logger=INFO,console

如果您想将 Cygnus 作为服务运行,您将需要一个额外的/usr/cygnus/conf/cygnus_instance_1.conf(安装中有另一个模板),其中包含以下默认内容:

CYGNUS_USER=cygnus
CONFIG_FOLDER=/usr/cygnus/conf
CONFIG_FILE=/usr/cygnus/conf/agent_<id>.conf
AGENT_NAME=cygnusagent
LOGFILE_NAME=cygnus.log
ADMIN_PORT=8081
POLLING_INTERVAL=30

然后,您可以像使用任何其他服务一样继续:

$ service cygnus start
于 2015-10-16T05:47:51.807 回答