连接Cygnus和STH时出错

时间:2017-03-06 18:06:47

标签: fiware fiware-cygnus fiware-sth-comet

我正在尝试连接Cygnus和STH。我在容器docker中有一个Cygnus实例,在VM中有一个STH实例。

当我向天鹅座发送通知时,可以在fiware-cygnus/cygnus-ngsi/resources/ngsi-examples/notification-json-simple.sh处找到,它会显示以下错误:

注意:我更换了STH IP以发布问题

  

时间= 2017-03-06T17:35:46.522Z | lvl =错误| corr = 0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | trans = 0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv =红色| subsrv = / red / red | comp = cygnus-ngsi | op = processRollbackedBatches | msg = com.telefonica.iot.cygnus.sinks.NGSISink [394]:持久性错误。消息: - ,在等待与PrimaryServerSelector匹配的服务器时,在30000毫秒后超时。群集状态的客户端视图是{type = UNKNOWN,servers = [{address =:27017,type = UNKNOWN,state = CONNECTING,exception = {com.mongodb.MongoSocketReadException:异常接收消息},由{java.net.SocketException引起:连接重置}}],堆栈跟踪:[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)]       时间= 2017-03-06T17:35:46.522Z | lvl = INFO | corr = 0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | trans = 0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv =红色| subsrv = / red / red | comp = cygnus-ngsi | op = doRollbackAgain | msg = com.telefonica.iot.cygnus.sinks.NGSISink [458]:再次回滚(0767a9d2-d44e-4872-9ef4-b57d68ef7f88),这是重试#9

STH没有发布任何内容。

在我的agent.conf(cygnus conf)中我有这个:

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

我的STH配置是:

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 个答案:

答案 0 :(得分:1)

我找到了解决这个问题的方法:我刚刚编辑了/etc/mongod.conf,并注释了bindip=127.0.0.1来监听所​​有接口。