2017-03-06 91 views
2

我正在嘗試連接Cygnus和STH。我在容器docker中有一個Cygnus實例,在VM中有一個STH實例。連接Cygnus和STH時出錯

當我在fiware-cygnus/cygnus-ngsi/resources/ngsi-examples/notification-json-simple.sh發送通知到天鵝座,可它讓我看到以下錯誤:

注:我更換了STH IP後的問題

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

,並沒有什麼貼在STH。

在我agent.conf(天鵝的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

這似乎是一個網絡錯誤,更具體地說,MongoDB驅動程序無法到達服務器以在Cygnus配置中指定。你是否在本地運行Cygnus到MongoDB?或者兩件都在不同的機器上? – frb

+0

你好,我在不同的機器上運行這兩件。實際上,我正在將Cygnus運行到一個容器(docker)和STH(及其MongoDB)中運行到一個VM CentOS 6.我已經更改了iptables配置以允許訪問27017,但它不起作用。 –

+1

@frb,我現在得到了連接。我剛剛編輯了我的'/ etc/mongod.conf',並將'bindip = 127.0.0.1'這一行註釋掉了。現在,我遇到了身份驗證問題,但更容易解決。謝謝你的幫助! –

回答

1

我發現這個問題的解決方案:我剛編輯我的/etc/mongod.conf並且我將bindip=127.0.0.1註釋掉在所有接口上偵聽。