ContextBroker subscriptions Error

2019-04-13 15:00发布

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

Error the subscription

    [
        {
            "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"
            }
        }
]

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)

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.

with version 0.13 if it works with localhost.

What could be the problem?

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

Greetings and thank you.

EDIT1:

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.

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  ]

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]# 

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?

Log cygnus :

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

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:

The contextBroker log indicates:

 

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

When I try:

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

I do not think anything.

When I launch this:

[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

and gives me the following error:

[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

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

Any clue what that might be?

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条回答
Summer. ? 凉城
2楼-- · 2019-04-13 15:19

Do I have to install cygnus-common manual?

Reading the documentation (https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi) it's wrote:

Cygnus NGSI is based on Apache Flume, which is used through cygnus-common and which Cygnus NGSI depends on.

I think you need to install cygnus-common.

查看更多
劫难
3楼-- · 2019-04-13 15:32

The last error log you have posted is the key: there is another running process listening on TCP/5050 port. Most probably, a previous run of Cygnus not stopped/killed properly.

查看更多
看我几分像从前
4楼-- · 2019-04-13 15:36

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. Install ContextBroker.
  2. Install MongoDB (for contextBroker to work).
  3. Install cygnus-ngsi, this in turn installed automatically cygnus-common.

  4. Copy the agent_ngsi.conf.template and rename it with agent_1.conf

  5. Copy the cygnus_instance.conf.template to cygnus_instance_1.conf

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

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.

查看更多
登录 后发表回答