Java Code Examples for org.apache.accumulo.minicluster.MiniAccumuloCluster#start()
The following examples show how to use
org.apache.accumulo.minicluster.MiniAccumuloCluster#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ITBase.java From fluo with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUpAccumulo() throws Exception { instanceName = System.getProperty(IT_INSTANCE_NAME_PROP, "it-instance-default"); File instanceDir = new File("target/accumulo2-maven-plugin/" + instanceName); boolean instanceClear = System.getProperty(IT_INSTANCE_CLEAR_PROP, "true").equalsIgnoreCase("true"); if (instanceDir.exists() && instanceClear) { FileUtils.deleteDirectory(instanceDir); } if (!instanceDir.exists()) { MiniAccumuloConfig cfg = new MiniAccumuloConfig(instanceDir, PASSWORD); cfg.setInstanceName(instanceName); cluster = new MiniAccumuloCluster(cfg); cluster.start(); startedCluster = true; } Properties props = MiniAccumuloCluster.getClientProperties(instanceDir); aClient = Accumulo.newClient().from(props).build(); }
Example 2
Source File: AccumuloInstanceDriver.java From rya with Apache License 2.0 | 5 votes |
/** * Sets up the {@link MiniAccumuloCluster} or the {@link MockInstance}. * @throws Exception */ public void setUpInstance() throws Exception { if (!isMock) { log.info("Setting up " + driverName + " MiniAccumulo cluster..."); // Create and Run MiniAccumulo Cluster tempDir = Files.createTempDir(); tempDir.deleteOnExit(); miniAccumuloCluster = new MiniAccumuloCluster(tempDir, userpwd); copyHadoopHomeToTemp(); miniAccumuloCluster.getConfig().setInstanceName(instanceName); log.info(driverName + " MiniAccumulo instance starting up..."); miniAccumuloCluster.start(); Thread.sleep(1000); log.info(driverName + " MiniAccumulo instance started"); log.info("Creating connector to " + driverName + " MiniAccumulo instance..."); zooKeeperInstance = new ZooKeeperInstance(miniAccumuloCluster.getClientConfig()); instance = zooKeeperInstance; connector = zooKeeperInstance.getConnector(user, new PasswordToken(userpwd)); log.info("Created connector to " + driverName + " MiniAccumulo instance"); } else { log.info("Setting up " + driverName + " mock instance..."); mockInstance = new MockInstance(instanceName); instance = mockInstance; connector = mockInstance.getConnector(user, new PasswordToken(userpwd)); log.info("Created connector to " + driverName + " mock instance"); } zooKeepers = instance.getZooKeepers(); }
Example 3
Source File: AccumuloMiniClusterDriver.java From accumulo-recipes with Apache License 2.0 | 5 votes |
public void start() throws IOException { try { initInstanceAndConnector(300); } catch (Throwable e) { try { initConfig(); miniAccumuloCluster = new MiniAccumuloCluster(miniAccumuloConfig); miniAccumuloCluster.start(); log.info("started minicluster"); initInstanceAndConnector(null); } catch (Throwable e1) { throw new IOException(e1); } } }
Example 4
Source File: MiniFluoImpl.java From fluo with Apache License 2.0 | 5 votes |
private void startMiniAccumulo() { try { // start mini accumulo cluster MiniAccumuloConfig cfg = new MiniAccumuloConfig(new File(config.getMiniDataDir()), PASSWORD); cluster = new MiniAccumuloCluster(cfg); cluster.start(); log.debug("Started MiniAccumulo(accumulo=" + cluster.getInstanceName() + " zk=" + cluster.getZooKeepers() + ")"); // configuration that must overridden config.setAccumuloInstance(cluster.getInstanceName()); config.setAccumuloUser(USER); config.setAccumuloPassword(PASSWORD); config.setAccumuloZookeepers(cluster.getZooKeepers()); config.setInstanceZookeepers(cluster.getZooKeepers() + "/fluo"); // configuration that only needs to be set if not by user if ((config.containsKey(FluoConfiguration.ACCUMULO_TABLE_PROP) == false) || config.getAccumuloTable().trim().isEmpty()) { config.setAccumuloTable("fluo"); } InitializationOptions opts = new InitializationOptions(); try (FluoAdmin admin = FluoFactory.newAdmin(config)) { admin.initialize(opts); } File miniProps = new File(clientPropsPath(config)); config.getClientConfiguration().save(miniProps); log.debug("Wrote MiniFluo client properties to {}", miniProps.getAbsolutePath()); } catch (Exception e) { throw new RuntimeException(e); } }
Example 5
Source File: PutRecordIT.java From nifi with Apache License 2.0 | 5 votes |
@BeforeClass public static void setupInstance() throws IOException, InterruptedException, AccumuloSecurityException, AccumuloException, TableExistsException { Assume.assumeTrue("Test only runs on *nix", !SystemUtils.IS_OS_WINDOWS); Path tempDirectory = Files.createTempDirectory("acc"); // JUnit and Guava supply mechanisms for creating temp directories accumulo = new MiniAccumuloCluster(tempDirectory.toFile(), "password"); accumulo.start(); }
Example 6
Source File: ScanAccumuloIT.java From nifi with Apache License 2.0 | 5 votes |
@BeforeClass public static void setupInstance() throws IOException, InterruptedException, AccumuloSecurityException, AccumuloException, TableExistsException { Assume.assumeTrue("Test only runs on *nix", !SystemUtils.IS_OS_WINDOWS); Path tempDirectory = Files.createTempDirectory("acc"); // JUnit and Guava supply mechanisms for creating temp directories accumulo = new MiniAccumuloCluster(tempDirectory.toFile(), "password"); accumulo.start(); }
Example 7
Source File: TestAccumuloPigCluster.java From spork with Apache License 2.0 | 5 votes |
@BeforeClass public static void setupClusters() throws Exception { MiniAccumuloConfig macConf = new MiniAccumuloConfig(tmpdir, "password"); macConf.setNumTservers(1); accumuloCluster = new MiniAccumuloCluster(macConf); accumuloCluster.start(); }
Example 8
Source File: AccumuloIndexSetColumnVisibilityTest.java From rya with Apache License 2.0 | 5 votes |
private static MiniAccumuloCluster startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException { final File miniDataDir = Files.createTempDir(); // Setup and start the Mini Accumulo. final MiniAccumuloCluster accumulo = new MiniAccumuloCluster( miniDataDir, "password"); accumulo.start(); // Store a connector to the Mini Accumulo. final Instance instance = new ZooKeeperInstance( accumulo.getInstanceName(), accumulo.getZooKeepers()); accCon = instance.getConnector("root", new PasswordToken("password")); return accumulo; }
Example 9
Source File: TableConfigHelperFactoryTest.java From datawave with Apache License 2.0 | 5 votes |
@BeforeClass public static void startCluster() throws Exception { File macDir = new File(System.getProperty("user.dir") + "/target/mac/" + TableConfigHelperFactoryTest.class.getName()); if (macDir.exists()) FileUtils.deleteDirectory(macDir); macDir.mkdirs(); mac = new MiniAccumuloCluster(new MiniAccumuloConfig(macDir, "pass")); mac.start(); }
Example 10
Source File: DemoDriver.java From rya with Apache License 2.0 | 5 votes |
/** * Setup a Mini Accumulo cluster that uses a temporary directory to store its data. * * @return A Mini Accumulo cluster. */ private static MiniAccumuloCluster startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException { final File miniDataDir = Files.createTempDir(); // Setup and start the Mini Accumulo. final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(miniDataDir, "password"); accumulo.start(); // Store a connector to the Mini Accumulo. final Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()); accumuloConn = instance.getConnector("root", new PasswordToken("password")); return accumulo; }
Example 11
Source File: MiniAccumuloClusterInstance.java From rya with Apache License 2.0 | 5 votes |
/** * Start the {@link MiniAccumuloCluster}. */ public void startMiniAccumulo() throws IOException, InterruptedException, AccumuloException, AccumuloSecurityException { final File miniDataDir = Files.createTempDir(); // Setup and start the Mini Accumulo. final MiniAccumuloConfig cfg = new MiniAccumuloConfig(miniDataDir, PASSWORD); cluster = new MiniAccumuloCluster(cfg); cluster.start(); }
Example 12
Source File: AmcHelper.java From OSTMap with Apache License 2.0 | 5 votes |
public MiniAccumuloCluster startMiniCluster(File tempFile) { try { amc = new MiniAccumuloCluster(tempFile, "password"); amc.start(); return amc; }catch (IOException | InterruptedException e){ e.printStackTrace(); } return null; }
Example 13
Source File: TwoWaySSLIT.java From timely with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { final MiniAccumuloConfig macConfig = new MiniAccumuloConfig(temp.newFolder("mac"), "secret"); mac = new MiniAccumuloCluster(macConfig); mac.start(); conf = TestConfiguration.createMinimalConfigurationForTest(); conf.getAccumulo().setInstanceName(mac.getInstanceName()); conf.getAccumulo().setZookeepers(mac.getZooKeepers()); setupSSL(conf); }
Example 14
Source File: TwoWaySSLFailureIT.java From timely with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { temp.create(); final MiniAccumuloConfig macConfig = new MiniAccumuloConfig(temp.newFolder("mac"), "secret"); mac = new MiniAccumuloCluster(macConfig); mac.start(); conf = TestConfiguration.createMinimalConfigurationForTest(); conf.getAccumulo().setInstanceName(mac.getInstanceName()); conf.getAccumulo().setZookeepers(mac.getZooKeepers()); setupSSL(conf); }
Example 15
Source File: TwoWaySSLIT.java From qonduit with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { final MiniAccumuloConfig macConfig = new MiniAccumuloConfig(temp.newFolder("mac"), "secret"); mac = new MiniAccumuloCluster(macConfig); mac.start(); conf = TestConfiguration.createMinimalConfigurationForTest(); conf.getAccumulo().setInstanceName(mac.getInstanceName()); conf.getAccumulo().setZookeepers(mac.getZooKeepers()); setupSSL(conf); }
Example 16
Source File: TwoWaySSLFailureIT.java From qonduit with Apache License 2.0 | 5 votes |
@BeforeClass public static void beforeClass() throws Exception { temp.create(); final MiniAccumuloConfig macConfig = new MiniAccumuloConfig(temp.newFolder("mac"), "secret"); mac = new MiniAccumuloCluster(macConfig); mac.start(); conf = TestConfiguration.createMinimalConfigurationForTest(); conf.getAccumulo().setInstanceName(mac.getInstanceName()); conf.getAccumulo().setZookeepers(mac.getZooKeepers()); setupSSL(conf); }
Example 17
Source File: AccumuloInstanceDriver.java From rya with Apache License 2.0 | 4 votes |
/** * Sets up the {@link MiniAccumuloCluster} or the {@link MockInstance} or * distribution instance * @throws Exception */ public void setUpInstance() throws Exception { switch (instanceType) { case DISTRIBUTION: log.info("Setting up " + driverName + " distribution instance..."); if (instanceName == null) { throw new IllegalArgumentException("Must specify instance name for distributed mode"); } else if (zooKeepers == null) { throw new IllegalArgumentException("Must specify ZooKeeper hosts for distributed mode"); } instance = new ZooKeeperInstance(instanceName, zooKeepers); connector = instance.getConnector(user, new PasswordToken(userpwd)); log.info("Created connector to " + driverName + " distribution instance"); break; case MINI: log.info("Setting up " + driverName + " MiniAccumulo cluster..."); // Create and Run MiniAccumulo Cluster tempDir = Files.createTempDir(); tempDir.deleteOnExit(); miniAccumuloCluster = new MiniAccumuloCluster(tempDir, userpwd); copyHadoopHomeToTemp(); miniAccumuloCluster.getConfig().setInstanceName(instanceName); log.info(driverName + " MiniAccumulo instance starting up..."); miniAccumuloCluster.start(); Thread.sleep(1000); log.info(driverName + " MiniAccumulo instance started"); log.info("Creating connector to " + driverName + " MiniAccumulo instance..."); zooKeeperInstance = new ZooKeeperInstance(miniAccumuloCluster.getClientConfig()); instance = zooKeeperInstance; connector = zooKeeperInstance.getConnector(user, new PasswordToken(userpwd)); log.info("Created connector to " + driverName + " MiniAccumulo instance"); break; case MOCK: log.info("Setting up " + driverName + " mock instance..."); mockInstance = new MockInstance(instanceName); instance = mockInstance; connector = mockInstance.getConnector(user, new PasswordToken(userpwd)); log.info("Created connector to " + driverName + " mock instance"); break; default: throw new AccumuloException("Unexpected instance type: " + instanceType); } zooKeepers = instance.getZooKeepers(); }
Example 18
Source File: QueryBenchmarkRunIT.java From rya with Apache License 2.0 | 4 votes |
@BeforeClass public static void setup() throws Exception { // Squash loud logs. Logger.getLogger(ClientCnxn.class).setLevel(Level.ERROR); // Setup the Mini Accumulo Cluster. final File miniDataDir = com.google.common.io.Files.createTempDir(); final MiniAccumuloConfig cfg = new MiniAccumuloConfig( miniDataDir, ACCUMULO_PASSWORD); cluster = new MiniAccumuloCluster(cfg); cluster.start(); // Create a Rya Client connected to the Mini Accumulo Cluster. final AccumuloConnectionDetails connDetails = new AccumuloConnectionDetails( ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), cluster.getInstanceName(), cluster.getZooKeepers()); final Connector connector = cluster.getConnector(ACCUMULO_USER, ACCUMULO_PASSWORD); final RyaClient ryaClient = AccumuloRyaClientFactory.build(connDetails, connector); // Install an instance of Rya on the mini cluster. installRya(ryaClient); // Get a Sail object that is backed by the Rya store that is on the mini cluster. final AccumuloRdfConfiguration ryaConf = new AccumuloRdfConfiguration(); ryaConf.setTablePrefix(RYA_INSTANCE_NAME); ryaConf.set(ConfigUtils.CLOUDBASE_USER, ACCUMULO_USER); ryaConf.set(ConfigUtils.CLOUDBASE_PASSWORD, ACCUMULO_PASSWORD); ryaConf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, cluster.getZooKeepers()); ryaConf.set(ConfigUtils.CLOUDBASE_INSTANCE, cluster.getInstanceName()); ryaConf.set(ConfigUtils.USE_PCJ, "true"); ryaConf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinStorageType.ACCUMULO.toString()); ryaConf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinUpdaterType.NO_UPDATE.toString()); sail = RyaSailFactory.getInstance( ryaConf ); // Load some data into the cluster that will match the query we're testing against. loadTestStatements(); // Add a PCJ to the application that summarizes the query. createTestPCJ(ryaClient); }
Example 19
Source File: SinksTest.java From OSTMap with Apache License 2.0 | 4 votes |
@BeforeClass public static void setUpCluster() throws AccumuloException, AccumuloSecurityException, InterruptedException, IOException { accumulo = new MiniAccumuloCluster(tmpDir.getRoot().getAbsoluteFile(), "password"); accumulo.start(); }