本文介绍了ContextBroker订阅错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此教程之后,我通过安装NGSI将cygnus从0.13版本更新到1.7.0:

I've updated cygnus from version 0.13 to 1.7.0 by installing NGSI following this tutorial:

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日志将给出以下内容:

viewing the contextBroker log gives the following:

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

我在与cygnus相同的计算机上安装了contextBroker,因此我已经尝试更改服务器和localhost的notify ip,但不适用于其中的任何一个.

I have contextBroker on the same machine as cygnus so I have already tried to change the notify ip for the server and for localhost and it does not work for any of it.

如果与localhost兼容,则版本为0.13.

with version 0.13 if it works with localhost.

可能是什么问题?

它甚至没有出现在cygnus配置文件中,因为它无法从contextBroker中访问.

It does not even come to cygnus configuration files because it can not access from the contextBroker.

问候,谢谢.

我已通过fiwareLab机器进行了测试,并删除了YUM REMOVE CYGNUS预先安装的cygnus 0.13.然后,我用YUM INSTALL CYGNUS-NGSI安装了1.7,并安装了两个软件包ngsi和common.

I am tested with the fiwareLab machines and removing cygnus 0.13 that comes pre installed with YUM REMOVE CYGNUS. Then I installed 1.7 with YUM INSTALL CYGNUS-NGSI and installed two packages ngsi and common.

通过服务cygnus restart重新启动服务指示以下内容:

Restarting the service with service cygnus restart indicates the following:

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  ]

当我在服务器上尝试时,我执行相同的步骤,但是在执行服务cygnus restart时具有两个cygnus 1和2,与在vuesta计算机中只有一个,因此表明端口8081已在使用中./p>

When I try on my server I do the same steps but when doing the service cygnus restart has two cygnus the 1 and 2 not as in vuesta machine that only has one and therefore indicates that the port 8081 is already in use.

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的共同之处吗?还是正常?

Is it possible that this is the problem and that is not recognizing my NGSI and this occupying the 8081 the common? or is this normal?

日志天鹅座:

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 [email protected]: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.我已删除其中之一,并且已经执行了服务天鹅座重启,仅出现了一个天鹅座.我们越来越好了.

I have already solved the problem of two cygnus, had two agent_1 and agent_2 created. I have deleted one of them and already performing service cygnus restart appears only one cygnus. We are getting better.

但是订阅仍然有相同的问题:

But I still have the same problem with the subscriptions:

contextBroker日志指示:

The contextBroker log indicates:

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

我正在尝试对您的页面进行测试.

I am trying to launch a Test of your page.

./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年我什么都听不到.

It gives the impression that in the 5050 I have nothing listening.

有什么线索吗?

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

推荐答案

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

I have already solved the problem.It was in the configuration file of cygnus_instance_1.conf, you had to rename the cygnusagent agent by cygnus-ngsi.

对于安装,我只需遵循以下步骤即可.

For installation, I have simply followed these steps.

  1. 安装ContextBroker.
  2. 安装MongoDB(用于contextBroker到工作).
  3. 安装cygnus-ngsi,这将自动安装天鹅座常见.

  1. Install ContextBroker.
  2. Install MongoDB (for contextBroker towork).
  3. Install cygnus-ngsi, this in turn installed automaticallycygnus-common.

复制agent_ngsi.conf.template并将其重命名为agent_1.conf

Copy the agent_ngsi.conf.template and rename it withagent_1.conf

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

Copy the cygnus_instance.conf.template to cygnus_instance_1.conf

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

Rename the agent from cygnus_instance_1.conf to cygnus-ngsi and the configuration file created above (agent_1.conf)

这一切都是通过Yum Install,RPM进行的,我不必安装apache flume或任何东西,这样就可以自动完成所有操作.

All this has been with Yum Install, with RPM, I have not had to install apache flume or anything, this way it does everything automatically.

我希望这会有所帮助,谢谢.

I hope this helps and thanks.

这篇关于ContextBroker订阅错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:14