Java 类org.apache.hadoop.hbase.replication.ReplicationStateZKBase 实例源码

项目:ditb    文件:ZKDataMigrator.java   
private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
     throws KeeperException, NoNodeException {
   String state = Bytes.toString(data);
   if (ZooKeeperProtos.ReplicationState.State.ENABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
   } else if (ZooKeeperProtos.ReplicationState.State.DISABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.DISABLED_ZNODE_BYTES);
   }
 }
项目:pbase    文件:ZKDataMigrator.java   
private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
     throws KeeperException, NoNodeException {
   String state = Bytes.toString(data);
   if (ZooKeeperProtos.ReplicationState.State.ENABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
   } else if (ZooKeeperProtos.ReplicationState.State.DISABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.DISABLED_ZNODE_BYTES);
   }
 }
项目:HIndex    文件:ZKDataMigrator.java   
private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
     throws KeeperException, NoNodeException {
   String state = Bytes.toString(data);
   if (ZooKeeperProtos.ReplicationState.State.ENABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
   } else if (ZooKeeperProtos.ReplicationState.State.DISABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.DISABLED_ZNODE_BYTES);
   }
 }
项目:PyroDB    文件:ZKDataMigrator.java   
private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
     throws KeeperException, NoNodeException {
   String state = Bytes.toString(data);
   if (ZooKeeperProtos.ReplicationState.State.ENABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
   } else if (ZooKeeperProtos.ReplicationState.State.DISABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.DISABLED_ZNODE_BYTES);
   }
 }
项目:c5    文件:ZKDataMigrator.java   
private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
     throws KeeperException, NoNodeException {
   String state = Bytes.toString(data);
   if (ZooKeeperProtos.ReplicationState.State.ENABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
   } else if (ZooKeeperProtos.ReplicationState.State.DISABLED.name().equals(state)) {
     ZKUtil.setData(zkw, peerStatePath, ReplicationStateZKBase.DISABLED_ZNODE_BYTES);
   }
 }
项目:pbase    文件:TestReplicationSourceManager.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {

  conf = HBaseConfiguration.create();
  conf.set("replication.replicationsource.implementation",
      ReplicationSourceDummy.class.getCanonicalName());
  conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY,
      HConstants.REPLICATION_ENABLE_DEFAULT);
  conf.setLong("replication.sleep.before.failover", 2000);
  conf.setInt("replication.source.maxretriesmultiplier", 10);
  utility = new HBaseTestingUtility(conf);
  utility.startMiniZKCluster();

  zkw = new ZooKeeperWatcher(conf, "test", null);
  ZKUtil.createWithParents(zkw, "/hbase/replication");
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1",
      Bytes.toBytes(conf.get(HConstants.ZOOKEEPER_QUORUM) + ":"
          + conf.get(HConstants.ZOOKEEPER_CLIENT_PORT) + ":/1"));
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1/peer-state");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1/peer-state",
    ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
  ZKUtil.createWithParents(zkw, "/hbase/replication/state");
  ZKUtil.setData(zkw, "/hbase/replication/state", ReplicationStateZKBase.ENABLED_ZNODE_BYTES);

  ZKClusterId.setClusterId(zkw, new ClusterId());
  FSUtils.setRootDir(utility.getConfiguration(), utility.getDataTestDir());
  fs = FileSystem.get(conf);
  oldLogDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_OLDLOGDIR_NAME);
  logDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_LOGDIR_NAME);
  replication = new Replication(new DummyServer(), fs, logDir, oldLogDir);
  manager = replication.getReplicationManager();

  manager.addSource(slaveId);

  htd = new HTableDescriptor(test);
  HColumnDescriptor col = new HColumnDescriptor("f1");
  col.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
  htd.addFamily(col);
  col = new HColumnDescriptor("f2");
  col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
  htd.addFamily(col);

  hri = new HRegionInfo(htd.getTableName(), r1, r2);
}
项目:HIndex    文件:TestReplicationSourceManager.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {

  conf = HBaseConfiguration.create();
  conf.set("replication.replicationsource.implementation",
      ReplicationSourceDummy.class.getCanonicalName());
  conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY,
      HConstants.REPLICATION_ENABLE_DEFAULT);
  utility = new HBaseTestingUtility(conf);
  utility.startMiniZKCluster();

  zkw = new ZooKeeperWatcher(conf, "test", null);
  ZKUtil.createWithParents(zkw, "/hbase/replication");
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1",
      Bytes.toBytes(conf.get(HConstants.ZOOKEEPER_QUORUM) + ":"
          + conf.get(HConstants.ZOOKEEPER_CLIENT_PORT) + ":/1"));
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1/peer-state");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1/peer-state",
    ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
  ZKUtil.createWithParents(zkw, "/hbase/replication/state");
  ZKUtil.setData(zkw, "/hbase/replication/state", ReplicationStateZKBase.ENABLED_ZNODE_BYTES);

  ZKClusterId.setClusterId(zkw, new ClusterId());

  replication = new Replication(new DummyServer(), fs, logDir, oldLogDir);
  manager = replication.getReplicationManager();
  fs = FileSystem.get(conf);
  oldLogDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_OLDLOGDIR_NAME);
  logDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_LOGDIR_NAME);
  logName = HConstants.HREGION_LOGDIR_NAME;

  manager.addSource(slaveId);

  htd = new HTableDescriptor(test);
  HColumnDescriptor col = new HColumnDescriptor("f1");
  col.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
  htd.addFamily(col);
  col = new HColumnDescriptor("f2");
  col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
  htd.addFamily(col);

  hri = new HRegionInfo(htd.getTableName(), r1, r2);
}
项目:PyroDB    文件:TestReplicationSourceManager.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {

  conf = HBaseConfiguration.create();
  conf.set("replication.replicationsource.implementation",
      ReplicationSourceDummy.class.getCanonicalName());
  conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY,
      HConstants.REPLICATION_ENABLE_DEFAULT);
  utility = new HBaseTestingUtility(conf);
  utility.startMiniZKCluster();

  zkw = new ZooKeeperWatcher(conf, "test", null);
  ZKUtil.createWithParents(zkw, "/hbase/replication");
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1",
      Bytes.toBytes(conf.get(HConstants.ZOOKEEPER_QUORUM) + ":"
          + conf.get(HConstants.ZOOKEEPER_CLIENT_PORT) + ":/1"));
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1/peer-state");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1/peer-state",
    ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
  ZKUtil.createWithParents(zkw, "/hbase/replication/state");
  ZKUtil.setData(zkw, "/hbase/replication/state", ReplicationStateZKBase.ENABLED_ZNODE_BYTES);

  ZKClusterId.setClusterId(zkw, new ClusterId());

  replication = new Replication(new DummyServer(), fs, logDir, oldLogDir);
  manager = replication.getReplicationManager();
  fs = FileSystem.get(conf);
  oldLogDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_OLDLOGDIR_NAME);
  logDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_LOGDIR_NAME);
  logName = HConstants.HREGION_LOGDIR_NAME;

  manager.addSource(slaveId);

  htd = new HTableDescriptor(test);
  HColumnDescriptor col = new HColumnDescriptor("f1");
  col.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
  htd.addFamily(col);
  col = new HColumnDescriptor("f2");
  col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
  htd.addFamily(col);

  hri = new HRegionInfo(htd.getTableName(), r1, r2);
}
项目:c5    文件:TestReplicationSourceManager.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {

  conf = HBaseConfiguration.create();
  conf.set("replication.replicationsource.implementation",
      ReplicationSourceDummy.class.getCanonicalName());
  conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY,
      HConstants.REPLICATION_ENABLE_DEFAULT);
  utility = new HBaseTestingUtility(conf);
  utility.startMiniZKCluster();

  zkw = new ZooKeeperWatcher(conf, "test", null);
  ZKUtil.createWithParents(zkw, "/hbase/replication");
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1",
      Bytes.toBytes(conf.get(HConstants.ZOOKEEPER_QUORUM) + ":"
          + conf.get(HConstants.ZOOKEEPER_CLIENT_PORT) + ":/1"));
  ZKUtil.createWithParents(zkw, "/hbase/replication/peers/1/peer-state");
  ZKUtil.setData(zkw, "/hbase/replication/peers/1/peer-state",
    ReplicationStateZKBase.ENABLED_ZNODE_BYTES);
  ZKUtil.createWithParents(zkw, "/hbase/replication/state");
  ZKUtil.setData(zkw, "/hbase/replication/state", ReplicationStateZKBase.ENABLED_ZNODE_BYTES);

  ZKClusterId.setClusterId(zkw, new ClusterId());

  replication = new Replication(new DummyServer(), fs, logDir, oldLogDir);
  manager = replication.getReplicationManager();
  fs = FileSystem.get(conf);
  oldLogDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_OLDLOGDIR_NAME);
  logDir = new Path(utility.getDataTestDir(),
      HConstants.HREGION_LOGDIR_NAME);
  logName = HConstants.HREGION_LOGDIR_NAME;

  manager.addSource(slaveId);

  htd = new HTableDescriptor(test);
  HColumnDescriptor col = new HColumnDescriptor("f1");
  col.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
  htd.addFamily(col);
  col = new HColumnDescriptor("f2");
  col.setScope(HConstants.REPLICATION_SCOPE_LOCAL);
  htd.addFamily(col);

  hri = new HRegionInfo(htd.getTableName(), r1, r2);
}