2

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

当我向 Cygnus 发送通知时,可用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 | 反式=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=红色 | subsrv=/红色/红色 | 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=信息 | corr=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | 反式=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=红色 | subsrv=/红色/红色 | comp=cygnus-ngsi | op=doRollbackAgain | msg=com.telefonica.iot.cygnus.sinks.NGSISink[458] :再次回滚(0767a9d2-d44e-4872-9ef4-b57d68ef7f88),这是重试#9 运行(SinkRunner.java:147), java.lang.Thread.run(Thread.java:745)] 时间=2017-03-06T17:35:46.522Z | lvl=信息 | corr=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | 反式=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=红色 | subsrv=/红色/红色 | comp=cygnus-ngsi | op=doRollbackAgain | msg=com.telefonica.iot.cygnus.sinks.NGSISink[458] :再次回滚(0767a9d2-d44e-4872-9ef4-b57d68ef7f88),这是重试#9 运行(SinkRunner.java:147), java.lang.Thread.run(Thread.java:745)] 时间=2017-03-06T17:35:46.522Z | lvl=信息 | corr=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | 反式=0767a9d2-d44e-4872-9ef4-b57d68ef7f88 | srv=红色 | subsrv=/红色/红色 | 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;
4

1 回答 1

1

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

于 2017-03-07T17:25:59.217 回答