簡體   English   中英

如何根據 Orion 和 Cosmos 配置 Cygnus

[英]How to configure Cygnus in relation to Orion and Cosmos

我們安裝了 Orion、Cygnus 和 Cosmos,並試圖使它們之間的連接正常工作:通過代理將 Orion 消息轉發到 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 站點上閱讀了有關上述內容的文檔,但似乎無法使其正常工作......

非常感謝!

假設您從 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM