将Cygnus作为服务运行时出错

时间:2017-01-17 19:30:48

标签: fiware-cygnus

我一直在按照这个程序安装Cygnus作为服务(https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi),但在运行时会出现以下错误:

● cygnus.service - SYSV: cygnus

   Loaded: loaded (/etc/rc.d/init.d/cygnus; bad; vendor preset: disabled)

   Active: failed (Result: exit-code) since Tue 2017-01-17 18:27:15 UTC; 8s ago

     Docs: man:systemd-sysv-generator(8)

  Process: 8260 ExecStart=/etc/rc.d/init.d/cygnus start (code=exited, status=1/FAILURE)


Jan 17 18:27:15 servername systemd[1]: Starting SYSV: cygnus...

Jan 17 18:27:15 servername systemd[1]: cygnus.service: control process exited, code=exited status=1

Jan 17 18:27:15 servername systemd[1]: Failed to start SYSV: cygnus.

Jan 17 18:27:15 servername systemd[1]: Unit cygnus.service entered failed state.

Jan 17 18:27:15 servername systemd[1]: cygnus.service failed.

Jan 17 18:27:15 servername cygnus[8260]: There aren't any instance of Cygnus configured. Refer to file /usr/cygnus/conf/README.md ...mation.


Hint: Some lines were ellipsized, use -l to show in full

我已经尝试过两种机制来解决问题但没有成功:

  1. /var/run/cygnus目录提供完整许可;正如Fiware: can not start cygnus as service所述。
  2. 就我而言,它使用以下命令作为独立应用程序(而不是服务)运行:

    `/usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf/ -f /usr/cygnus/conf/agent.conf -n cygnusagent -Dflume.root.logger=INFO,console`
    
    1. 按照此处的建议更改所有者权限:unable to start Fiware Cygnus as a service
    2. 补充信息:

      当我运行统计工具时:

      curl -X GET "http://localhost:8081/v1/stats" | python -m json.tool
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100    67  100    67    0     0   3983      0 --:--:-- --:--:-- --:--:--  4187
      {
          "stats": {
              "channels": [],
              "sinks": [],
              "sources": []
          },
          "success": "true"
      }
      

      我正在使用的文件:

      agent.conf

      cygnus-ngsi.sources = http-source
      cygnus-ngsi.sinks = hdfs-sink
      cygnus-ngsi.channels = hdfs-channel
      
      cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
      cygnus-ngsi.sources.http-source.channels = hdfs-channel
      cygnus-ngsi.sources.http-source.port = 5050
      cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
      cygnus-ngsi.sources.http-source.handler.notification_target = /notify
      cygnus-ngsi.sources.http-source.handler.default_service = default
      cygnus-ngsi.sources.http-source.handler.default_service_path = /
      cygnus-ngsi.sources.http-source.interceptors = ts gi
      cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
      cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$Builder
      cygnus-ngsi.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf #/opt/apache-flume/conf/grouping_rules.conf
      
      cygnus-ngsi.sinks.hdfs-sink.type = com.telefonica.iot.cygnus.sinks.NGSIHDFSSink
      cygnus-ngsi.sinks.hdfs-sink.channel = hdfs-channel
      cygnus-ngsi.sinks.hdfs-sink.hdfs_host = iot-hdfs
      cygnus-ngsi.sinks.hdfs-sink.hdfs_port = 14000
      cygnus-ngsi.sinks.hdfs-sink.hdfs_username = <USERNAME>
      cygnus-ngsi.sinks.hdfs-sink.oauth2_token = <TOKEN>
      
      
      cygnus-ngsi.channels.hdfs-channel.type = com.telefonica.iot.cygnus.channels.CygnusMemoryChannel
      cygnus-ngsi.channels.hdfs-channel.capacity = 1000
      cygnus-ngsi.channels.hdfs-channel.transactionCapacity = 100
      

      cygnus_instance.conf

      CYGNUS_USER=cygnus
      
      # Where is the config folder
      CONFIG_FOLDER=/usr/cygnus/conf
      
      # Which is the config file
      CONFIG_FILE=/usr/cygnus/conf/agent.conf
      
      # Name of the agent. The name of the agent is not trivial, since it is the base for the Flume parameters
      # naming conventions, e.g. it appears in .sources.http-source.channels=...
      AGENT_NAME=cygnusagent
      
      # Name of the logfile located at /var/log/cygnus. It is important to put the extension '.log' in order to the log rotation works properly
      LOGFILE_NAME=cygnus.log
      
      # Administration port. Must be unique per instance
      ADMIN_PORT=8081
      
      # Polling interval (seconds) for the configuration reloading
      POLLING_INTERVAL=30
      

      有任何提示可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

正如您在启动服务时在日志中看到的那样:

Jan 17 18:27:15 servername cygnus[8260]: There aren't any instance of Cygnus configured. Refer to file /usr/cygnus/conf/README.md ...mation.

将Cygnus作为服务运行时,必须提供两个文件,一个是代理,另一个是实例。您已经配置了它们,这样就可以了,但是缺少一件重要的事情:两个文件名都必须包含一个ID字符串。例如,它们可以命名为agent_1.confcygnus_instance_1.conf(&#34; 1&#34;字符串是实例的ID)。

这解释为here。尽管如此,我们还是会尝试改进文档,以使其更加清晰。