Package org.apache.hadoop.chukwa.conf

Examples of org.apache.hadoop.chukwa.conf.ChukwaConfiguration


  public void testMetricDataLoader() {
    boolean skip=false;
    String srcDir = System.getenv("CHUKWA_DATA_DIR") + File.separator + "samples";
    try {
      ChukwaConfiguration conf = new ChukwaConfiguration();
      FileSystem fs = FileSystem.get(conf);
      FileStatus[] sources = fs.listStatus(new Path(srcDir));
      for (FileStatus sequenceFile : sources) {
        MetricDataLoader mdl = new MetricDataLoader(conf, fs, sequenceFile.getPath().toUri().toString());
        mdl.call();
View Full Code Here


    if ("-local".equalsIgnoreCase(args[0])) {
      compareLocalDirectory(demuxGoldDirectory, demuxTestDirectory);
    } else if ("-hdfs".equalsIgnoreCase(args[0])) {
      isLocal = false;
      conf = new ChukwaConfiguration();
      String fsName = conf.get("writer.hdfs.filesystem");
      try {
        fs = FileSystem.get(new URI(fsName), conf);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

      }
    }
  }

  public void verifyTable(String table) {
    ChukwaConfiguration cc = new ChukwaConfiguration();
    String query = "select * from ["+table+"];";
    Macro mp = new Macro(current,query);
    query = mp.toString();
    try {
      DatabaseWriter db = new DatabaseWriter(cluster);
View Full Code Here

      log.error(ExceptionUtil.getStackTrace(e));
    }
  }
 
  public int run(String[] args) throws Exception {
    JobConf conf = new JobConf(new ChukwaConfiguration(), Demux.class);
   

    conf.setJobName("Chukwa-Demux_" + day.format(new Date()));
    conf.setInputFormat(SequenceFileInputFormat.class);
    conf.setMapperClass(Demux.MapClass.class);
View Full Code Here

  }
 
  @Override
  public String parseArgs(String s) {
    portno = Integer.parseInt(s);
    ChukwaConfiguration cc = new ChukwaConfiguration();
    for(FacilityType e : FacilityType.values()) {
      StringBuilder buffer = new StringBuilder();
      buffer.append("syslog.adaptor.port.");
      buffer.append(portno);
      buffer.append(".facility.");
      buffer.append(e.name());
      String dataType = cc.get(buffer.toString(), e.name());
      facilityMap.put(e.ordinal(), dataType);
    }
    return s;
  }
View Full Code Here

                    + "\n\tservlet=<classname>@path");
        System.out.println("Command line options will override normal configuration.");
        System.exit(0);
      }

      ChukwaConfiguration conf = new ChukwaConfiguration();
     
      try {
        Configuration collectorConf = new Configuration(false);
        collectorConf.addResource(new Path(conf.getChukwaConf() + "/chukwa-common.xml"));
        collectorConf.addResource(new Path(conf.getChukwaConf() + "/chukwa-collector-conf.xml"));
        Checker.checkConf(new OptDictionary(new File(new File(conf.getChukwaHome(), "share/chukwa/lib"), "collector.dict")),
            HSlurper.fromHConf(collectorConf));
      } catch(Exception e) {e.printStackTrace();}
     
      int portNum = conf.getInt("chukwaCollector.http.port", 9999);
      THREADS = conf.getInt("chukwaCollector.http.threads", THREADS);

      // pick a writer.
      ChukwaWriter w = null;
      Map<String, HttpServlet> servletsToAdd = new TreeMap<String, HttpServlet>();
      ServletCollector servletCollector = new ServletCollector(conf);
      for(String arg: args) {
        if(arg.startsWith("writer=")) {       //custom writer class
          String writerCmd = arg.substring("writer=".length());
          if (writerCmd.equals("pretend") || writerCmd.equals("pretend-quietly")) {
            boolean verbose = !writerCmd.equals("pretend-quietly");
            w = new ConsoleWriter(verbose);
            w.init(conf);
            servletCollector.setWriter(w);
          } else
            conf.set("chukwaCollector.writerClass", writerCmd);
        } else if(arg.startsWith("servlet=")) {     //adding custom servlet
           String servletCmd = arg.substring("servlet=".length());
           String[] halves = servletCmd.split("@");
           try {
             Class<?> servletClass = Class.forName(halves[0]);
             HttpServlet srvlet = (HttpServlet) servletClass.newInstance();
             if(!halves[1].startsWith("/"))
               halves[1] = "/" + halves[1];
             servletsToAdd.put(halves[1], srvlet);
           } catch(Exception e) {
             e.printStackTrace();
           }
        } else if(arg.startsWith("portno=")) {
          portNum = Integer.parseInt(arg.substring("portno=".length()));
        } else { //unknown arg
          System.out.println("WARNING: unknown command line arg " + arg);
          System.out.println("Invoke collector with command line arg 'help' for usage");
        }
      }

      // Set up jetty connector
      SelectChannelConnector jettyConnector = new SelectChannelConnector();
      jettyConnector.setLowResourcesConnections(THREADS - 10);
      jettyConnector.setLowResourceMaxIdleTime(1500);
      jettyConnector.setPort(portNum);
     
      // Set up jetty server proper, using connector
      jettyServer = new Server(portNum);
      jettyServer.setConnectors(new Connector[] { jettyConnector });
      org.mortbay.thread.BoundedThreadPool pool = new org.mortbay.thread.BoundedThreadPool();
      pool.setMaxThreads(THREADS);
      jettyServer.setThreadPool(pool);
     
      // Add the collector servlet to server
      Context root = new Context(jettyServer, "/", Context.SESSIONS);
      root.addServlet(new ServletHolder(servletCollector), "/*");
     
      if(conf.getBoolean(HttpConnector.ASYNC_ACKS_OPT, false))
        root.addServlet(new ServletHolder(new CommitCheckServlet(conf)), "/"+CommitCheckServlet.DEFAULT_PATH);

      if(conf.getBoolean(LogDisplayServlet.ENABLED_OPT, false))
        root.addServlet(new ServletHolder(new LogDisplayServlet(conf)), "/"+LogDisplayServlet.DEFAULT_PATH);

     
      root.setAllowNullPathInfo(false);

View Full Code Here

    }    
  };

 
  public PostProcessorManager() throws Exception {
    this.conf = new ChukwaConfiguration();
    init();
  }
View Full Code Here

   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    DaemonWatcher.createInstance("HourlyChukwaRecordRolling");
   
    conf = new ChukwaConfiguration();
    String fsName = conf.get("writer.hdfs.filesystem");
    fs = FileSystem.get(new URI(fsName), conf);

    // TODO read from config
    String rollingFolder = "/chukwa/rolling/";
View Full Code Here

    } // for(FileStatus dayFS : daysFS)
  }

  public int run(String[] args) throws Exception {
    JobConf conf = new JobConf(new ChukwaConfiguration(), HourlyChukwaRecordRolling.class);

    conf.setJobName("HourlyChukwa-Rolling");
    conf.setInputFormat(SequenceFileInputFormat.class);

    conf.setMapperClass(IdentityMapper.class);
View Full Code Here

    if(args.length < 2) {
      System.out.println("usage: Dump [-s] pattern1,pattern2,pattern3... file1 file2 file3...");
      System.exit(-1);
    }
   
    ChukwaConfiguration conf = new ChukwaConfiguration();

    dump(args, conf, System.out);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.conf.ChukwaConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.