Package com.cloudera.flume.master

Examples of com.cloudera.flume.master.ConfigManager


  /**
   * Create simple non translating FlowConfigManager
   */
  FlowConfigManager createSimple() {
    return new FlowConfigManager(new ConfigManager()) {
      @Override
      public ConfigurationManager createConfigMan() {
        return new ConfigManager();
      }
    };
  }
View Full Code Here


   *
   * This exposes a hook to the deepest cfgMan which would ideally be a saved ZK
   * backed version being reloaded from a restarted master.
   */
  void buildMaster() throws IOException {
    cfgMan = new ConfigManager(FlumeMaster.createConfigStore(FlumeConfiguration
        .get()));
    StatusManager statman = new StatusManager();
    flowed = new FlowConfigManager.FailoverFlowConfigManager(cfgMan, statman);
    flumeMaster = new FlumeMaster(new CommandManager(), flowed, statman,
        new MasterAckManager(), FlumeConfiguration.get());
View Full Code Here

   *
   * This exposes a hook to the deepest cfgMan which would ideally be a saved ZK
   * backed version being reloaded from a restarted master.
   */
  void buildMaster() throws IOException {
    cfgMan = new ConfigManager(FlumeMaster.createConfigStore(FlumeConfiguration
        .get()));
    StatusManager statman = new StatusManager();
    flowed = new FlowConfigManager.FailoverFlowConfigManager(cfgMan, statman);
    logical = new LogicalConfigurationManager(flowed, new ConfigManager(),
        statman);
    flumeMaster = new FlumeMaster(new CommandManager(), logical, statman,
        new MasterAckManager(), FlumeConfiguration.get());
  }
View Full Code Here

  /**
   * Instantiate and expose managers
   */
  void setupNewManagers() {
    ConfigurationManager parent = new ConfigManager();
    ConfigurationManager self = new ConfigManager();
    FailoverChainManager fcMan = new ConsistentHashFailoverChainManager(3);
    ConfigurationManager self2 = new ConfigManager();

    failover = new FailoverConfigurationManager(parent, self2, fcMan);
    statman = new StatusManager();
    logical = new LogicalConfigurationManager(failover, self, statman);
    trans = logical;
View Full Code Here

  /**
   * Test the core of the LogicalConfigManager
   */
  @Test
  public void testLogicalTrans() throws IOException, FlumeSpecException {
    ConfigurationManager parent = new ConfigManager();
    ConfigurationManager self = new ConfigManager();
    StatusManager statman = new StatusManager();
    ConfigurationManager trans = new LogicalConfigurationManager(parent, self,
        statman);

    // make it so that the local host info is present
    statman.updateHeartbeatStatus("foo", "foo", "foo", NodeState.HELLO, Clock
        .unixTime());
    statman.updateHeartbeatStatus("bar", "bar", "bar", NodeState.HELLO, Clock
        .unixTime());

    // Next spawn so that all are mapped onto a node and now gets a physical
    trans.addLogicalNode("foo", "foo");
    trans.addLogicalNode("bar", "bar");

    // now set configs
    trans.setConfig("foo", DEFAULTFLOW, "logicalSource", "null");
    trans.setConfig("bar", DEFAULTFLOW, "null", "logicalSink(\"foo\")");

    // update the configurations
    trans.updateAll();
    int port = FlumeConfiguration.get().getCollectorPort();

    // check if translated
    FlumeConfigData transData = trans.getConfig("bar");
    assertEquals("null", transData.getSourceConfig());
    assertEquals("rpcSink( \"foo\", " + port + " )", transData.getSinkConfig());

    FlumeConfigData transData2 = trans.getConfig("foo");
    assertEquals("rpcSource( " + port + " )", transData2.getSourceConfig());
    assertEquals("null", transData2.getSinkConfig());

    // self is same as translated
    FlumeConfigData selfData = self.getConfig("bar");
    assertEquals("null", selfData.getSourceConfig());
    assertEquals("rpcSink( \"foo\", " + port + " )", selfData.getSinkConfig());

    FlumeConfigData selfData2 = self.getConfig("foo");
    assertEquals("rpcSource( " + port + " )", selfData2.getSourceConfig());
    assertEquals("null", selfData2.getSinkConfig());

    // original is the user entered values
    FlumeConfigData origData = parent.getConfig("bar");
View Full Code Here

   * Test the core of the LogicalConfigManager when it fails
   */
  @Test
  public void testLogicalTransFailSource() throws IOException,
      FlumeSpecException {
    ConfigurationManager parent = new ConfigManager();
    ConfigurationManager self = new ConfigManager();
    StatusManager statman = new StatusManager();
    ConfigurationManager trans = new LogicalConfigurationManager(parent, self,
        statman);

    // now set configs
View Full Code Here

   * Test to ensure attempts to map a single logical node to multiple physicals
   * is discarded with a warning. This may be exception worthy.
   */
  @Test
  public void testDuplicateAssignment() {
    ConfigurationManager parent = new ConfigManager();
    ConfigurationManager self = new ConfigManager();
    StatusManager statman = new StatusManager();
    ConfigurationManager trans = new LogicalConfigurationManager(parent, self,
        statman);

    trans.addLogicalNode("hostA", "foo");
View Full Code Here

   *
   * TODO (jon) this implementation is less than idea, should use bulk update
   */
  @Override
  synchronized public void loadConfigFile(String from) throws IOException {
    ConfigManager cfgs = new ConfigManager();
    cfgs.loadConfigFile(from);
    String defaultFlow = FlumeConfiguration.get().getDefaultFlowName();
    for (Entry<String, FlumeConfigData> e : cfgs.getAllConfigs().entrySet()) {
      FlumeConfigData fcd = e.getValue();
      // Flow names aren't saved with this mechanism.
      try {
        setConfig(e.getKey(), defaultFlow, fcd.sourceConfig, fcd.sinkConfig);
      } catch (FlumeSpecException e1) {
View Full Code Here

      this.statman = statman;
    }

    public ConfigurationManager createConfigMan() {
      // Create with all memory based config managers
      return new FailoverConfigurationManager(new ConfigManager(),
          new ConfigManager(), new ConsistentHashFailoverChainManager(3));
    }
View Full Code Here

    FlumeNode node = new FlumeNode(cfg);
    node.start();

    // avoiding gossip ack manager until it shuts down cleanly.
    ConfigStore cfgStore = FlumeMaster.createConfigStore(cfg);
    FlumeMaster fm = new FlumeMaster(new CommandManager(), new ConfigManager(
        cfgStore), new StatusManager(), new MasterAckManager(), cfg);

    assertEquals(0, fm.getKnownNodes().size());
    fm.serve();
    LOG.info("flume master 1 open ");
    while (fm.getKnownNodes().size() == 0) {
      Clock.sleep(1000);
    }
    fm.shutdown();
    LOG.info("flume master 1 closed");

    ConfigStore cfgStore2 = FlumeMaster.createConfigStore(cfg);
    FlumeMaster fm2 = new FlumeMaster(new CommandManager(), new ConfigManager(
        cfgStore2), new StatusManager(), new MasterAckManager(), cfg);
    assertEquals(0, fm2.getKnownNodes().size());
    fm2.serve();
    LOG.info("flume master 2 open ");
    while (fm2.getKnownNodes().size() == 0) {
View Full Code Here

TOP

Related Classes of com.cloudera.flume.master.ConfigManager

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.