Package org.apache.accumulo.fate.zookeeper

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter


   * @param secret
   *          instance secret
   * @return reader/writer
   */
  public IZooReaderWriter getZooReaderWriter(String string, int timeInMillis, String secret) {
    return new ZooReaderWriter(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes(Constants.UTF8));
  }
View Full Code Here


    if (secret == null) {
      AccumuloConfiguration conf = SiteConfiguration.getInstance(DefaultConfiguration.getInstance());
      secret = conf.get(Property.INSTANCE_SECRET);
    }
   
    return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), SCHEME, (USER + ":" + secret).getBytes());
  }
View Full Code Here

      @SuppressWarnings("deprecation")
      AccumuloConfiguration conf = AccumuloConfiguration.getSiteConfiguration();
      secret = conf.get(Property.INSTANCE_SECRET);
    }
   
    return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), SCHEME, (USER + ":" + secret).getBytes());
  }
View Full Code Here

    // wait for master
    UtilWaitThread.sleep(1000);
    // create a backup
    Process backup = exec(Master.class);
    try {
      ZooReaderWriter writer = new ZooReaderWriter(cluster.getZooKeepers(), 30*1000, "digest", "accumulo:DONTTELL".getBytes());
      String root = "/accumulo/" + getConnector().getInstance().getInstanceID();
      List<String> children = Collections.emptyList();
      // wait for 2 lock entries
      do {
        UtilWaitThread.sleep(100);
        children = writer.getChildren(root + "/masters/lock");
      } while (children.size() != 2);
      Collections.sort(children);
      // wait for the backup master to learn to be the backup
      UtilWaitThread.sleep(1000);
      // generate a false zookeeper event
      String lockPath = root + "/masters/lock/" + children.get(0);
      byte data[] = writer.getData(lockPath, null);
      writer.getZooKeeper().setData(lockPath, data, -1);
      // let it propagate
      UtilWaitThread.sleep(500);
      // kill the master by removing its lock
      writer.recursiveDelete(lockPath, NodeMissingPolicy.FAIL);
      // ensure the backup becomes the master
      getConnector().tableOperations().create(getUniqueNames(1)[0]);
    } finally {
      backup.destroy();
    }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.fate.zookeeper.ZooReaderWriter

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.