2
votes

I am trying to connect Cygnus and STH. I have a Cygnus instance in a container docker and a STH instance in a VM.

When I send a notification to Cygnus, available at fiware-cygnus/cygnus-ngsi/resources/ngsi-examples/notification-json-simple.sh it shows me the following error:

NOTE: I replaced the STH IP to post the question

time=2017-03-06T17:35:46.522Z | lvl=ERROR | corr=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | trans=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=red | subsrv=/red/red | comp=cygnus-ngsi | op=processRollbackedBatches | msg=com.telefonica.iot.cygnus.sinks.NGSISink[394] : Persistence error. Message: -, Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Exception receiving message}, caused by {java.net.SocketException: Connection reset}}], Stack trace: [com.telefonica.iot.cygnus.sinks.NGSISTHSink.persistOne(NGSISTHSink.java:158), com.telefonica.iot.cygnus.sinks.NGSISTHSink.persistBatch(NGSISTHSink.java:93), com.telefonica.iot.cygnus.sinks.NGSISink.processRollbackedBatches(NGSISink.java:387), com.telefonica.iot.cygnus.sinks.NGSISink.process(NGSISink.java:370), org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68), org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147), java.lang.Thread.run(Thread.java:745)] time=2017-03-06T17:35:46.522Z | lvl=INFO | corr=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | trans=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=red | subsrv=/red/red | comp=cygnus-ngsi | op=doRollbackAgain | msg=com.telefonica.iot.cygnus.sinks.NGSISink[458] : Rollbacking again (0767a9d2-d44e-4872-9ef4-b57d68ef7f88), this was retry #9

And nothing is posted in STH.

In my agent.conf (cygnus conf) I have this:

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

cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnus-ngsi.sources.http-source.channels = sth-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 = /opt/apache-flume/conf/grouping_rules.conf


cygnus-ngsi.sinks.sth-sink.type = com.telefonica.iot.cygnus.sinks.NGSISTHSink
cygnus-ngsi.sinks.sth-sink.channel = sth-channel
#cygnus-ngsi.sinks.sth-sink.enable_encoding = false
#cygnus-ngsi.sinks.sth-sink.enable_grouping = false
#cygnus-ngsi.sinks.sth-sink.enable_name_mappings = false
#cygnus-ngsi.sinks.sth-sink.enable_lowercase = false
cygnus-ngsi.sinks.sth-sink.data_model = dm-by-entity
cygnus-ngsi.sinks.sth-sink.mongo_hosts = <STH-MONGO-IP>:27017
cygnus-ngsi.sinks.sth-sink.mongo_username =
cygnus-ngsi.sinks.sth-sink.mongo_password =
cygnus-ngsi.sinks.sth-sink.db_prefix = sth_
cygnus-ngsi.sinks.sth-sink.collection_prefix = sth_
cygnus-ngsi.sinks.sth-sink.resolutions = day,hour,minute
#cygnus-ngsi.sinks.sth-sink.batch_size = 1
#cygnus-ngsi.sinks.sth-sink.batch_timeout = 30
#cygnus-ngsi.sinks.sth-sink.batch_ttl = 10
#cygnus-ngsi.sinks.sth-sink.data_expiration = 0
#cygnus-ngsi.sinks.sth-sink.ignore_white_spaces = true


cygnus-ngsi.channels.sth-channel.type = com.telefonica.iot.cygnus.channels.CygnusMemoryChannel
cygnus-ngsi.channels.sth-channel.capacity = 1000
cygnus-ngsi.channels.sth-channel.transactionCapacity = 100

And my STH config is:

var config = {};

// STH server configuration
//--------------------------
config.server = {

  host: '10.0.2.15',

  port: '8666',


  defaultService: 'testservice',


  defaultServicePath: '/testservicepath',


  filterOutEmpty: 'true',

  aggregationBy: ['day', 'hour', 'minute'],

  temporalDir: 'temp'
};

// Database configuration
//------------------------
config.database = {

  dataModel: 'collection-per-entity',
 user: '',

  password: '',

  URI: 'localhost:27017',

  replicaSet: '',

  prefix: 'sth_',


  collectionPrefix: 'sth_',

  poolSize: '5',


  shouldStore: 'both',
  truncation: {


    expireAfterSeconds: '0',
    size: '0',

    max: '0'
  },

  ignoreBlankSpaces: 'true',
  nameMapping: {

    enabled: 'false',

    configFile: './name-mapping.json'
  },

  nameEncoding: 'false'
};

// Logging configuration
//------------------------
config.logging = {
  level: 'info',
  NODE_ENV variable is set to 'development'.

  format: 'pipe',


  proofOfLifeInterval: '60'
};

module.exports = config;
1
This seems a network error, more specifically, the MongoDB driver is not able to reach the server to are specifying in Cygnus configuration. Are you running Cygnus locally to MongoDB? Or are both pieces in different machines?frb
Hello, I am running both pieces in different machines. Actually, I am running Cygnus into a container (docker) and the STH (and its MongoDB) into a VM CentOS 6. I already change the iptables configuration to allow access to 27017, but it is not working.Matteus Sthefano
@frb, I got the connection right now. I just edited my /etc/mongod.conf and I commented out the bindip=127.0.0.1 line. Now, I have a problem with authentication, but more easy to solve. Thanks for your help!Matteus Sthefano

1 Answers

1
votes

I found the solution for this problem: I just edited my /etc/mongod.conf and I commented out the bindip=127.0.0.1 to listen on all interfaces.