错误 运行 Cygnus 即服务

Error running Cygnus as a service

我一直按照此过程将 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.

在我的例子中,它 运行 作为独立应用程序(而不是服务)使用:

`/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

补充资料:

当我 运行 统计工具时:

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

有解决这个问题的提示吗?

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

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(“1”字符串是实例的 ID)。

对此进行了解释here。尽管如此,我们将尝试改进文档以使其更清晰。