使用Storm实现实时大数据分析!
2013-01-12 19:10:27   来源:互联网   评论:0 点击:

随着数据体积的越来越大,实时处理成为了许多机构需要面对的首要挑战。Shruthi Kumar和Siddharth Patankar在Dr.Dobb’s上结合了汽车超速监视,为我们演示了使用Storm进行实时大数据分析。CSDN在此编译
  1.                                   splitAndEmit(inputTupleList,collector);  
  2.                           }  
  3.                      }  
  4.                      else if(frequencyChkOp.equals("!="))  
  5.                      {  
  6.                          if(!valueToCheck.equalsIgnoreCase(thresholdValue.toString()))  
  7.                          {  
  8.                               count.incrementAndGet();  
  9.                               if(count.get() > frequency)  
  10.                                   splitAndEmit(inputTupleList,collector);  
  11.                           }  
  12.                       }  
  13.                       else                         System.out.println("Operator not supported");   
  14.                   }  
  15.               }  
  16.               else 
  17.               {  
  18.                   if(frequencyChkOp.equals("=="))  
  19.                   {  
  20.                       if(valueToCheck.equalsIgnoreCase(thresholdValue.toString()))  
  21.                       {  
  22.                           count.incrementAndGet();  
  23.                           if(count.get() > frequency)  
  24.                               splitAndEmit(inputTupleList,collector);  
  25.                           }  
  26.                   }  
  27.                   else if(frequencyChkOp.equals("!="))  
  28.                   {  
  29.                        if(!valueToCheck.equalsIgnoreCase(thresholdValue.toString()))  
  30.                        {  
  31.                            count.incrementAndGet();  
  32.                            if(count.get() > frequency)  
  33.                                splitAndEmit(inputTupleList,collector);  
  34.                           }  
  35.                    }  
  36.                }  
  37.             }  
  38.             else if(thresholdDataType.equalsIgnoreCase("int") ||                     thresholdDataType.equalsIgnoreCase("double") ||                     thresholdDataType.equalsIgnoreCase("float") ||                     thresholdDataType.equalsIgnoreCase("long") ||                     thresholdDataType.equalsIgnoreCase("short"))  
  39.             {  
  40.                 String frequencyChkOp = thresholdInfo.getAction();  
  41.                 if(timeWindow!=null)  
  42.                 {  
  43.                      long valueToCheck =                          Long.parseLong(inputTupleList.get(thresholdColNum-1).toString());  
  44.                      long curTime = System.currentTimeMillis();  
  45.                      long diffInMinutes = (curTime-startTime)/(1000);  
  46.                      System.out.println("Difference in minutes="+diffInMinutes);  
  47.                      if(diffInMinutes>=timeWindow)  
  48.                      {  
  49.                           if(frequencyChkOp.equals("<"))  
  50.                           {  
  51.                               if(valueToCheck < Double.parseDouble(thresholdValue.toString()))  
  52.                               {  
  53. count.incrementAndGet();

相关热词搜索:Storm 实时 大数据 分析

上一篇:网站统计中的数据收集原理及实现(二)
下一篇:大数据定义和十大应用案例

分享到: 收藏
iTechClub广告