ContextBroker订阅错误

时间:2017-10-03 13:13:56

标签: fiware fiware-orion fiware-cygnus

我已经按照本教程安装NGSI将cygnus从版本0.13更新到1.7.0:

https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi

订阅错误

    [
        {
            "id": "59d38a92dbaa1e477aef9c00",
            "description": "A subscription to get info about pruebas",
            "status": "failed",
            "subject": {
                "entities": [
                    {
                        "id": "pruebas",
                        "type": "pruebas"
                    }
                ],
                "condition": {
                    "attrs": [
                        "pressure"
                    ]
                }
            },
            "notification": {
                "timesSent": 2,
                "lastNotification": "2017-10-03T13:03:43.00Z",
                "attrs": [
                    "temperature",
                    "pressure"
                ],
                "attrsFormat": "legacy",
                "http": {
                    "url": "http://localhost:5050/notify"
                },
                "lastFailure": "2017-10-03T13:03:43.00Z"
            }
        }
]

查看contextBroker日志提供以下内容:

$pp[328]:notificationError | msg=Raising alarm NotificationError http://localhost:5050/notify: (curl_easy_perform failed: Couldn't connect to server)

我在与cygnus相同的机器上安装了contextBroker,所以我已经尝试更改服务器和localhost的通知IP,但它不适用于任何一个。

版本0.13,如果它适用于localhost。

可能是什么问题?

它甚至没有来到cygnus配置文件,因为它无法从contextBroker访问。

问候并谢谢你。

EDIT1:

我使用fiwareLab机器进行了测试,并移除了预先安装了YUM REMOVE CYGNUS的天鹅座0.13。然后我用YUM INSTALL CYGNUS-NGSI安装了1.7并安装了两个包ngsi和common。

使用service cygnus restart重新启动服务表示以下内容:

Dependencies Resolved

================================================================================
 Package              Arch          Version                 Repository     Size
================================================================================
Installing:
 cygnus-ngsi          x86_64        1.7.1-0.g9df0d4d        fiware         74 M
Installing for dependencies:
 cygnus-common        x86_64        1.7.1-0.g9df0d4d        fiware        128 M

Transaction Summary
================================================================================
Install       2 Package(s)

Total size: 202 M
Installed size: 223 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
[INFO] Creating cygnus user
  Installing : cygnus-common-1.7.1-0.g9df0d4d.x86_64                        1/2
[INFO] Creating log directory
Done
  Installing : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64                          2/2
  Verifying  : cygnus-common-1.7.1-0.g9df0d4d.x86_64                        1/2
  Verifying  : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64                          2/2

Installed:
  cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d

Dependency Installed:
  cygnus-common.x86_64 0:1.7.1-0.g9df0d4d

Complete!
[centos@centos6 cygnus]$ sudo service cygnus restart
There aren't any instance of Cygnus  running               [  OK  ]
Starting Cygnus 1...                                       [  OK  ]

当我尝试使用我的服务器时,我会执行相同的步骤,但在进行服务时,天鹅重启有两个天鹅座,1和2不是在vuesta机器中只有一个,因此表明端口8081已在使用。< / p>

Dependencias resueltas

============================================================================================================================================================================
 Paquete                                     Arquitectura                         Versión                                        Repositorio                          Tamaño
============================================================================================================================================================================
Instalando:
 cygnus-ngsi                                 x86_64                               1.7.1-0.g9df0d4d                               fiware                                74 M
Instalando para las dependencias:
 cygnus-common                               x86_64                               1.7.1-0.g9df0d4d                               fiware                               128 M

Resumen de la transacción
============================================================================================================================================================================
Instalar       2 Paquete(s)

Tamaño total de la descarga: 202 M
Tamaño instalado: 223 M
Está de acuerdo [s/N]:s
Descargando paquetes:
(1/2): cygnus-common_hadoopcore_1.2.1-1.7.1-0.g9df0d4d.x86_64.rpm                                                                                    | 128 MB     00:14     
(2/2): cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64.rpm                                                                                                       |  74 MB     00:07     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       8.9 MB/s | 202 MB     00:22     
Ejecutando el rpm_check_debug
Ejecutando prueba de transacción
La prueba de transacción ha sido exitosa
Ejecutando transacción
[INFO] Creating cygnus user
  Instalando    : cygnus-common-1.7.1-0.g9df0d4d.x86_64                                                                                                                 1/2 
[INFO] Creating log directory
Done
  Instalando    : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64                                                                                                                   2/2 
  Verifying     : cygnus-common-1.7.1-0.g9df0d4d.x86_64                                                                                                                 1/2 
  Verifying     : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64                                                                                                                   2/2 

Instalado:
  cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d                                                                                                                                     

Dependencia(s) instalada(s):
  cygnus-common.x86_64 0:1.7.1-0.g9df0d4d                                                                                                                                   

¡Listo!


[root@UAL-IoF2020 conf]# ls
agent_1.conf         agent_ngsi.conf.template    cygnus_instance_2.conf         grouping_rules_2.conf         krb5_login.conf              README-cygnus-common.md
agent_3.conf         cartodb_keys.conf.template  cygnus_instance.conf.template  grouping_rules.conf.template  log4j.properties             README-cygnus-ngsi.md
agent.conf.template  cygnus_instance_1.conf      flume-env.sh.template          krb5.conf.template            name_mappings.conf.template
[root@UAL-IoF2020 conf]# service cygnus restart
There aren't any instance of Cygnus  running               [  OK  ]
Starting Cygnus 1...                                       [  OK  ]
Starting Cygnus 2...                                       [  OK  ]
[root@UAL-IoF2020 conf]# 

这可能是问题所在并且没有认识到我的NGSI并且占据8081的常见问题吗?或者这是正常的吗?

记录天鹅座:

time=2017-10-03T21:51:09.326Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[301] : Starting a Jetty server listening on 0.0.0.0:8081 (Management Interface)
time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed SelectChannelConnector@0.0.0.0:8081: java.net.BindException: La dirección ya se está usando
time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed Server@52992ace: java.net.BindException: La dirección ya se está usando
time=2017-10-03T21:51:09.381Z | lvl=FATAL | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=run | msg=com.telefonica.iot.cygnus.http.JettyServer[90] : Fatal error running the Management Interface. Details=La dirección ya se está usando

EDIT2

我已经解决了两个天鹅座的问题,创建了两个agent_1和agent_2。我删除了其中一个并且已经执行服务天鹅重启只出现一个天鹅座。我们越来越好了。

但是我的订阅仍然存在同样的问题:

contextBroker日志表明:

msg = Raising alarm NotificationError http: // localhost: 5050 / notify: (curl_easy_perform failed: could not connect to server)

当我尝试:

[root @ UAL-IoF2020 conf] # netstat -np | grep 5050

我什么都没想。

当我启动时:

[root @ UAL-IoF2020 conf] # netstat -np | grep 1026
tcp 0 0 150.XXX.XXX.XXX:1026 XXX.XXX.XXX.XXX:50348 ESTABLISHED 5169 / contextBroker

我正在尝试启动您的网页测试。

./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath

并给我以下错误:

[root @ UAL-IoF2020 ngsi-examples] # ./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath
* About to connect () to localhost port 5050 (# 0)
* Trying :: 1 ... Connection refused
* Trying 127.0.0.1 ... Connection refused
* could not connect to host
* Closing connection # 0
curl: (7) could not connect to host

它给人的印象是在5050年我什么都没有听。

有什么想法可能是什么?

cygnus-ngsi.sources = http-source
cygnus-ngsi.sinks = mysql-sink
cygnus-ngsi.channels = mysql-channel

#=============================================
# source configuration
# channel name where to write the notification events
cygnus-ngsi.sources.http-source.channels = mysql-channel
# source class, must not be changed
cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
# listening port the Flume source will use for receiving incoming notifications
cygnus-ngsi.sources.http-source.port = 5050
# Flume handler that will parse the notifications, must not be changed
cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
# URL target
cygnus-ngsi.sources.http-source.handler.notification_target = /notify
# default service (service semantic depends on the persistence sink)
cygnus-ngsi.sources.http-source.handler.default_service = default
# default service path (service path semantic depends on the persistence sink)
cygnus-ngsi.sources.http-source.handler.default_service_path = /
# source interceptors, do not change
cygnus-ngsi.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
# GroupingInterceptor, do not change
cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$Builder
# Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
# see the doc/design/interceptors document for more details
cygnus-ngsi.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf

3 个答案:

答案 0 :(得分:1)

  

我是否必须安装天鹅座普通手册?

阅读文档(https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi),写道:

  

Cygnus NGSI基于Apache Flume,它通过cygnus-common和Cygnus NGSI所依赖的方式使用。

我认为你需要安装cygnus-common。

答案 1 :(得分:1)

我已经解决了这个问题。 它位于cygnus_instance_1.conf的配置文件中,您必须通过cygnus-ngsi重命名cygnusagent代理。

对于安装,我只是按照这些步骤进行操作。

  1. 安装ContextBroker。
  2. 安装MongoDB(for contextBroker to 工作)。
  3. 安装cygnus-ngsi,然后自动安装 天鹅常见。

  4. 复制agent_ngsi.conf.template并使用重命名 agent_1.conf

  5. 将cygnus_instance.conf.template复制到cygnus_instance_1.conf

  6. 将代理从cygnus_instance_1.conf重命名为cygnus-ngsi和上面创建的配置文件(agent_1.conf)

  7. 所有这一切都与Yum Install一起使用,使用RPM,我没有必要安装apache flume或任何东西,这样它就可以自动完成所有操作。

    我希望这会有所帮助和感谢。

答案 2 :(得分:0)

您发布的最后一个错误日志是密钥:还有另一个正在侦听TCP / 5050端口的正在运行的进程。最有可能的是,之前的天鹅座没有正确停止/杀死。