DataStreamer addData方法在集群中无法正常工作

时间:2017-09-02 16:23:53

标签: ignite

我有两台笔记本电脑。它们都安装了windows7(64位),JDK 1.8.0_144(64位)和Ignite 2.1.0。我在第一个笔记本的WindowsCMD中使用简单的配置xml启动了一个点亮节点,就像官方示例一样,然后我运行我的代码来启动点火节点,在另一个笔记本上添加Eclipse中的大量数据。以下是我的代码的一些关键部分:

IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setPeerClassLoadingEnabled(true);
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
tcpDiscoverySpi.setAckTimeout(15000);
tcpDiscoverySpi.setNetworkTimeout(60000);
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509","192.168.1.105:47500..47509")); //two addresses of the notebook computers
tcpDiscoverySpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(tcpDiscoverySpi);
Ignite ignite = Ignition.start(cfg); //start ignite node
CacheConfiguration<Long, Map> cacheConf = new CacheConfiguration();
cacheConf.setName(CACHE_NAME).setCacheMode(CacheMode.PARTITIONED);
cacheConf.setBackups(0);
IgniteCache cache = ignite.getOrCreateCache(cacheConf); //create cache

IgniteDataStreamer<Long,Map> ds = ignite.dataStreamer(CACHE_NAME);
ds.autoFlushFrequency(10000);
ds.perNodeBufferSize(1024);
ds.perNodeParallelOperations(8);
……  //some code to prepare for reading text data from local file
while((line=br.readLine())!=null){ // br is a BufferedReader instance
    ds.addData(count++, parseData(line, Constants.DEFAULT_SEPARATOR, fields)); //parseData method return a Map instance
    if(count%100000==0){
        System.out.println(count+" loaded...");
    }
}
…… //other code

在多次调用ds.addData之前运行没有错误,并发生以下异常:

(err) Failed to execute compound future reducer: GridCompoundFuture [rdc=null, initFlag=1, lsnrCalls=0, done=false, cancelled=false, err=null, futs=[true, false, false, false, false, false, false, false]]class org.apache.ignite.IgniteCheckedException: DataStreamer request failed [node=b0a0b4f8-9f1e-49e9-8422-d9c0fe621398]
    at org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$Buffer.onResponse(DataStreamerImpl.java:1792)
    at org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$3.onMessage(DataStreamerImpl.java:333)
    at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1556)
    at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1184)
    at org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:126)
    at org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1097)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to get deployment for request [sndId=d871b506-57ec-4c8e-ac79-d1c6f48786b3, req=DataStreamerRequest [reqId=1, cacheName=TestDataStreamer, ignoreDepOwnership=true, skipStore=false, keepBinary=false, depMode=SHARED, sampleClsName=org.apache.ignite.internal.processors.datastreamer.DataStreamerImpl$IsolatedUpdater, userVer=2, ldrParticipants=null, clsLdrId=1b30a534e51-d871b506-57ec-4c8e-ac79-d1c6f48786b3, forceLocDep=false, topVer=AffinityTopologyVersion [topVer=31, minorTopVer=1]]]
    at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.processRequest(DataStreamProcessor.java:273)
    at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor.access$000(DataStreamProcessor.java:59)
    at org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$1.onMessage(DataStreamProcessor.java:89)
    ... 7 more

是什么原因? 我该怎么做才能解决问题?

0 个答案:

没有答案