Search in sources :

Example 1 with AccumuloInstanceDriver

use of org.apache.rya.accumulo.mr.merge.util.AccumuloInstanceDriver in project incubator-rya by apache.

the class CopyTool method createChildInstance.

private Instance createChildInstance(final Configuration config) throws Exception {
    Instance instance = null;
    String instanceTypeProp = config.get(CREATE_CHILD_INSTANCE_TYPE_PROP);
    final String childAuth = config.get(MRUtils.AC_AUTH_PROP + MergeTool.CHILD_SUFFIX);
    // Default to distribution cluster if not specified
    if (StringUtils.isBlank(instanceTypeProp)) {
        instanceTypeProp = InstanceType.DISTRIBUTION.toString();
    }
    final InstanceType instanceType = InstanceType.fromName(instanceTypeProp);
    switch(instanceType) {
        case DISTRIBUTION:
            if (childInstance == null) {
                throw new IllegalArgumentException("Must specify instance name for distributed mode");
            } else if (childZk == null) {
                throw new IllegalArgumentException("Must specify ZooKeeper hosts for distributed mode");
            }
            instance = new ZooKeeperInstance(childInstance, childZk);
            break;
        case MINI:
            childAccumuloInstanceDriver = new AccumuloInstanceDriver("Child", false, true, false, false, childUserName, childPwd, childInstance, childTablePrefix, childAuth);
            childAccumuloInstanceDriver.setUpInstance();
            childAccumuloInstanceDriver.setUpTables();
            childZk = childAccumuloInstanceDriver.getZooKeepers();
            MergeTool.setDuplicateKeysForProperty(config, MRUtils.AC_ZK_PROP + MergeTool.CHILD_SUFFIX, childZk);
            instance = new ZooKeeperInstance(childInstance, childZk);
            break;
        case MOCK:
            instance = new MockInstance(childInstance);
            break;
        default:
            throw new AccumuloException("Unexpected instance type: " + instanceType);
    }
    return instance;
}
Also used : AccumuloInstanceDriver(org.apache.rya.accumulo.mr.merge.util.AccumuloInstanceDriver) AccumuloException(org.apache.accumulo.core.client.AccumuloException) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) Instance(org.apache.accumulo.core.client.Instance) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) InstanceType(org.apache.rya.accumulo.mr.merge.common.InstanceType) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance)

Aggregations

AccumuloException (org.apache.accumulo.core.client.AccumuloException)1 Instance (org.apache.accumulo.core.client.Instance)1 ZooKeeperInstance (org.apache.accumulo.core.client.ZooKeeperInstance)1 MockInstance (org.apache.accumulo.core.client.mock.MockInstance)1 InstanceType (org.apache.rya.accumulo.mr.merge.common.InstanceType)1 AccumuloInstanceDriver (org.apache.rya.accumulo.mr.merge.util.AccumuloInstanceDriver)1