问题描述
我们已经安装了Orion,Cygnus和Cosmos,并正在尝试使它们之间的连接正常工作:通过代理,Orion消息将转发到Cygnus,后者又将这些消息写入Cosmos数据库.
We have Orion, Cygnus, and Cosmos installed, and are trying to get the connections between them working: via the broker Orion messages are to be forwarded to Cygnus, which in turn is to write those to the Cosmos database.
我们知道Orion正常工作(之前已经过测试和使用),并且已经使用测试python脚本测试了Cygnus(如 https://github.com/telefonicaid/fiware-cygnus/blob/master/doc/quick_start_guide.md ).当前,我们正在尝试配置Cygnus,以使其从Orion接收消息,然后将它们写入Cosmos数据库.
We know that Orion is working properly (it has been tested and used before), and have tested Cygnus with the test python script (as explained in https://github.com/telefonicaid/fiware-cygnus/blob/master/doc/quick_start_guide.md). Currently we are trying to configure Cygnus so that it receives messages from Orion, and subsequently writes them to the Cosmos database.
1)我们如何配置Cygnus/,需要设置哪些参数,以便获得从Orion通过Cygnus到Cosmos的最简单的工作链接?有没有一个简单的工作示例可供我们看? (agent_1.conf是唯一需要在天鹅座中设置的配置文件吗?)
1) How do we configure Cygnus/ which parameters need to set, in order to obtain the simplest working link from Orion, via Cygnus, to Cosmos? Is there a simple working example for us to see? (is the agent_1.conf the only config file that needs to be set in Cygnus?)
2)我们如何/通过什么方式使天鹅座订阅Orion?
2) How/by what means do we subscribe Cygnus to Orion?
3)我们如何将数据持久化到Cosmos?
3) And how do we persist the data to Cosmos?
我们在StackOverflow上已经阅读了很多类似问题的答案;并已在Github或Fiware网站上阅读了有关上述内容的文档,但似乎无法使其正常工作...
We have read quite a few answers to similar questions here on StackOverflow; and have read documentation regarding the above on either Github or the Fiware site, but seem to not be able to get it to work...
非常感谢!
推荐答案
假设您从RPM安装了Cygnus,则所需的最低配置是在/usr/cygnus/conf/agent_1.conf
文件中为这组参数提供值(存在您可以复制的文件):
Assuming you installed Cygnus from RPM, the minimum configuration you need is about giving values to this set of parameters in a /usr/cygnus/conf/agent_1.conf
file (there exists a /usr/cygnus/conf/agent.conf.template
file that you may copy):
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
除上述内容外,您还需要:
In addition to the above, you will need:
- 要创建的文件
/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 ,如此处所述.获取后,必须在上面的文件中对其进行配置.
- This file
/usr/cygnus/conf/grouping_rules.conf
to be created; you may make a copy from/usr/cygnus/conf/grouping_rules.conf.template
. - You will need an account in the global instance of Cosmos, you may get it at https://cosmos.lab.fiware.org. Once registered, the portal will print your credentials. Both username and password must be configured in the file above.
- You will need an OAuth2 token, you may get it at https://cosmos.lab.fiware.org:13000 as explained here. Once obtained, it must be configured in the file above.
现在,您可以将Cygnus作为标准应用程序运行:
Now, you are able to run Cygnus as a standard application:
$ /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
(安装中有另一个模板):
If you want to run Cygnus as a service, you will need an additional /usr/cygnus/conf/cygnus_instance_1.conf
(there is another template within the installation) with the following default content:
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
然后,您可以像使用其他任何服务一样继续进行操作:
Then, you can proceeed as with any other service:
$ service cygnus start
这篇关于如何配置与Orion和Cosmos有关的天鹅座的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!