本文整理汇总了Java中org.apache.accumulo.minicluster.MiniAccumuloCluster类的典型用法代码示例。如果您正苦于以下问题:Java MiniAccumuloCluster类的具体用法?Java MiniAccumuloCluster怎么用?Java MiniAccumuloCluster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MiniAccumuloCluster类属于org.apache.accumulo.minicluster包,在下文中一共展示了MiniAccumuloCluster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupMiniAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@BeforeClass
public static void setupMiniAccumulo() throws Exception {
try {
// try to put in target dir
File targetDir = new File("target");
if (targetDir.exists() && targetDir.isDirectory()) {
baseDir = new File(targetDir, "accumuloExportIT-" + UUID.randomUUID());
} else {
baseDir = new File(FileUtils.getTempDirectory(), "accumuloExportIT-" + UUID.randomUUID());
}
FileUtils.deleteDirectory(baseDir);
MiniAccumuloConfig cfg = new MiniAccumuloConfig(baseDir, ACCUMULO_PASSWORD);
cluster = new MiniAccumuloCluster(cfg);
cluster.start();
} catch (IOException | InterruptedException e) {
throw new IllegalStateException(e);
}
}
示例2: preFluoInitHook
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Override
public void preFluoInitHook() throws Exception {
// create and configure export table
exportTable = "export" + tableCounter.getAndIncrement();
getAccumuloConnector().tableOperations().create(exportTable);
MiniAccumuloCluster miniAccumulo = getMiniAccumuloCluster();
getFluoConfiguration().setObserverProvider(AccumuloExporterObserverProvider.class);
ExportQueue.configure(QUEUE_ID).keyType(String.class).valueType(String.class).buckets(5)
.bucketsPerTablet(1).save(getFluoConfiguration());
AccumuloExporter.configure(QUEUE_ID)
.instance(miniAccumulo.getInstanceName(), miniAccumulo.getZooKeepers())
.credentials(ACCUMULO_USER, ACCUMULO_PASSWORD).table(exportTable)
.save(getFluoConfiguration());
}
示例3: preFluoInitHook
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Override
public void preFluoInitHook() throws Exception {
// create and configure export table
exportTable = "export" + tableCounter.getAndIncrement();
getAccumuloConnector().tableOperations().create(exportTable);
MiniAccumuloCluster miniAccumulo = getMiniAccumuloCluster();
ExportQueue.configure(QUEUE_ID).keyType(String.class).valueType(TxLog.class).buckets(5)
.save(getFluoConfiguration());
AccumuloExporter.configure(QUEUE_ID)
.instance(miniAccumulo.getInstanceName(), miniAccumulo.getZooKeepers())
.credentials(ACCUMULO_USER, ACCUMULO_PASSWORD).table(exportTable)
.save(getFluoConfiguration());
getFluoConfiguration().setObserverProvider(AritObserverProvider.class);
}
示例4: teardownRya
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@After
public void teardownRya() {
final MiniAccumuloCluster cluster = getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Uninstall the instance of Rya.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(
new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers),
super.getAccumuloConnector());
try {
ryaClient.getUninstall().uninstall(RYA_INSTANCE_NAME);
// Shutdown the repo.
if(ryaSailRepo != null) {ryaSailRepo.shutDown();}
if(dao != null ) {dao.destroy();}
} catch (final Exception e) {
System.out.println("Encountered the following Exception when shutting down Rya: " + e.getMessage());
}
}
示例5: installRyaInstance
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
private void installRyaInstance() throws Exception {
final MiniAccumuloCluster cluster = super.getMiniAccumuloCluster();
final String instanceName = cluster.getInstanceName();
final String zookeepers = cluster.getZooKeepers();
// Install the Rya instance to the mini accumulo cluster.
final RyaClient ryaClient = AccumuloRyaClientFactory.build(
new AccumuloConnectionDetails(ACCUMULO_USER, ACCUMULO_PASSWORD.toCharArray(), instanceName, zookeepers),
super.getAccumuloConnector());
ryaClient.getInstall().install(RYA_INSTANCE_NAME,
InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableFreeTextIndex(false)
.setEnableEntityCentricIndex(false).setEnableGeoIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true)
.setFluoPcjAppName(super.getFluoConfiguration().getApplicationName()).build());
// Connect to the Rya instance that was just installed.
final AccumuloRdfConfiguration conf = makeConfig(instanceName, zookeepers);
final Sail sail = RyaSailFactory.getInstance(conf);
dao = RyaSailFactory.getAccumuloDAOWithUpdatedConfig(conf);
ryaSailRepo = new RyaSailRepository(sail);
}
示例6: connectAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Test
public void connectAccumulo() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Execute the connect command.
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
final CommandResult connectResult = shell.executeCommand(cmd);
// Ensure the connection was successful.
assertTrue( connectResult.isSuccess() );
}
示例7: connectAccumulo_wrongCredentials
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Test
public void connectAccumulo_wrongCredentials() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the wrong password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("asjifo[ijwa".toCharArray());
// Execute the command
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
final CommandResult connectResult = shell.executeCommand(cmd);
// Ensure the command failed.
assertFalse( connectResult.isSuccess() );
}
示例8: connectToInstance_instanceDoesNotExist
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Test
public void connectToInstance_instanceDoesNotExist() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
shell.executeCommand(cmd);
// Try to connect to a non-existing instance.
cmd = RyaConnectionCommands.CONNECT_INSTANCE_CMD + " --instance doesNotExist";
final CommandResult result = shell.executeCommand(cmd);
assertFalse( result.isSuccess() );
}
示例9: disconnect
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Test
public void disconnect() throws IOException {
final MiniAccumuloCluster cluster = getCluster();
final Bootstrap bootstrap = getTestBootstrap();
final JLineShellComponent shell = getTestShell();
// Mock the user entering the correct password.
final ApplicationContext context = bootstrap.getApplicationContext();
final PasswordPrompt mockPrompt = context.getBean( PasswordPrompt.class );
when(mockPrompt.getPassword()).thenReturn("password".toCharArray());
// Connect to the mini accumulo instance.
final String cmd =
RyaConnectionCommands.CONNECT_ACCUMULO_CMD + " " +
"--username root " +
"--instanceName " + cluster.getInstanceName() + " "+
"--zookeepers " + cluster.getZooKeepers();
shell.executeCommand(cmd);
// Disconnect from it.
final CommandResult disconnectResult = shell.executeCommand( RyaConnectionCommands.DISCONNECT_COMMAND_NAME_CMD );
assertTrue( disconnectResult.isSuccess() );
}
示例10: getGraphForDirectRDDForValidationChecking
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
private Graph getGraphForDirectRDDForValidationChecking(final KeyPackage keyPackage,
final String tableName)
throws InterruptedException, AccumuloException, AccumuloSecurityException,
IOException, OperationException, TableNotFoundException {
final MiniAccumuloCluster cluster = MiniAccumuloClusterProvider.getMiniAccumuloCluster();
final Graph graph = _getGraphForDirectRDD(keyPackage, tableName, getSchemaForValidationChecking(), null);
graph.execute(new AddElements.Builder()
.input(getElementsForValidationChecking())
.validate(false)
.build(), USER);
cluster.getConnector(MiniAccumuloClusterProvider.ROOT, MiniAccumuloClusterProvider.PASSWORD)
.tableOperations()
.compact(tableName, new CompactionConfig());
Thread.sleep(1000L);
return graph;
}
示例11: getGraphForDirectRDDForIngestAggregation
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
private Graph getGraphForDirectRDDForIngestAggregation(final KeyPackage keyPackage,
final String tableName)
throws InterruptedException, AccumuloException, AccumuloSecurityException,
IOException, OperationException, TableNotFoundException {
final Graph graph = _getGraphForDirectRDD(keyPackage, tableName, getSchemaForIngestAggregationChecking(), null);
final MiniAccumuloCluster cluster = MiniAccumuloClusterProvider.getMiniAccumuloCluster();
// Write 2 files and import them to the table - writing 2 files with the same data allows us to test whether
// data from multiple Rfiles is combined, i.e. whether the ingest aggregation is applied at query time when
// using the RFileReaderRDD
for (int i = 0; i < 2; i++) {
final String dir = tempFolder.newFolder().getAbsolutePath();
final String file = dir + File.separator + "file" + i + ".rf";
final String failure = tempFolder.newFolder().getAbsolutePath();
writeFile(keyPackage, graph.getSchema(), file);
cluster.getConnector(MiniAccumuloClusterProvider.USER, MiniAccumuloClusterProvider.PASSWORD)
.tableOperations()
.importDirectory(tableName, dir, failure, false);
}
return graph;
}
示例12: setUpClass
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@Override
public void setUpClass() throws IOException, InterruptedException {
log.info("Starting Accumulo MiniAccumuloCluster...");
try {
tmpDir.create();
MiniAccumuloConfig miniCfg = new MiniAccumuloConfig(tmpDir.getRoot(), PASSWORD);
miniCfg.setInstanceName("goraTest");
miniCfg.setZooKeeperPort(56321);
cluster = new MiniAccumuloCluster(miniCfg);
cluster.start();
} catch (Exception e) {
LOG.error("Error starting Accumulo MiniAccumuloCluster: {}", e.getMessage());
// cleanup
tearDownClass();
}
}
示例13: createAccumuloCluster
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@BeforeClass
public static void createAccumuloCluster() throws Exception {
macDir = File.createTempFile("miniaccumulocluster", null);
Assert.assertTrue(macDir.delete());
Assert.assertTrue(macDir.mkdir());
macDir.deleteOnExit();
MiniAccumuloConfig config = new MiniAccumuloConfig(macDir, "");
config.setNumTservers(2);
mac = new MiniAccumuloCluster(config);
mac.start();
ZooKeeperInstance zkInst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
Connector c = zkInst.getConnector("root", new PasswordToken(""));
// Add in auths for "en"
c.securityOperations().changeUserAuthorizations("root", new Authorizations("en"));
zk = new TestingServer();
}
示例14: setupMAC
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@BeforeClass
public static void setupMAC() throws Exception {
File tmp = Files.createTempDir();
tmp.deleteOnExit();
conf = new MiniAccumuloConfig(tmp, "foo");
conf.setNumTservers(2);
mac = new MiniAccumuloCluster(conf);
mac.start();
ZooKeeperInstance zkInst = new ZooKeeperInstance(mac.getInstanceName(), mac.getZooKeepers());
Connector con = zkInst.getConnector("root", new PasswordToken("foo"));
con.tableOperations().create(Defaults.DATA_TABLE);
con.tableOperations().create(Defaults.METADATA_TABLE);
zk = new TestingServer();
}
示例15: setUpAccumulo
import org.apache.accumulo.minicluster.MiniAccumuloCluster; //导入依赖的package包/类
@BeforeClass
public static void setUpAccumulo() throws Exception {
instanceName = System.getProperty(IT_INSTANCE_NAME_PROP, "it-instance-default");
File instanceDir = new File("target/accumulo-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;
}
miniAccumulo = new MiniAccumuloInstance(instanceName, instanceDir);
conn = miniAccumulo.getConnector(USER, new PasswordToken(PASSWORD));
}