/** * @since 1.6.0 */ public ClientConfiguration getClientConfig() { return impl.getClientConfig(); } }
@Override public Connector getConnector(String user, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException { Instance instance = new ZooKeeperInstance(getClientConfig()); return instance.getConnector(user, token); }
protected String getMonitor() throws KeeperException, InterruptedException { Instance instance = new ZooKeeperInstance(getCluster().getClientConfig()); return MonitorUtil.getLocation(instance); }
String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();
@Override public Void run() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig()); try { inst.getConnector(userWithoutCredentials3, new KerberosToken(userWithoutCredentials3)); Assert.fail("Should not be able to create a Connector as this user cannot be proxied"); } catch (org.apache.accumulo.core.client.AccumuloSecurityException e) { // Expected, this user cannot be proxied } return null; } });
@Override public Void run() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig()); Connector conn = inst.getConnector(proxyPrincipal, new KerberosToken()); try { Scanner s = conn.createScanner(tableName, Authorizations.EMPTY); s.iterator().hasNext(); Assert.fail("Expected to see an exception"); } catch (RuntimeException e) { int numSecurityExceptionsSeen = Iterables .size(Iterables.filter(Throwables.getCausalChain(e), org.apache.accumulo.core.client.AccumuloSecurityException.class)); assertTrue("Expected to see at least one AccumuloSecurityException, but saw: " + Throwables.getStackTraceAsString(e), numSecurityExceptionsSeen > 0); } return null; } });
@Override public Void run() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig()); Connector conn = inst.getConnector(userWithoutCredentials2, new KerberosToken(userWithoutCredentials3)); try { Scanner s = conn.createScanner(tableName, Authorizations.EMPTY); s.iterator().hasNext(); Assert.fail("Expected to see an exception"); } catch (RuntimeException e) { int numSecurityExceptionsSeen = Iterables .size(Iterables.filter(Throwables.getCausalChain(e), org.apache.accumulo.core.client.AccumuloSecurityException.class)); assertTrue("Expected to see at least one AccumuloSecurityException, but saw: " + Throwables.getStackTraceAsString(e), numSecurityExceptionsSeen > 0); } return null; } });
@Override public Void run() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig()); Connector conn = inst.getConnector(userWithoutCredentials1, new KerberosToken(userWithoutCredentials1)); Scanner s = conn.createScanner(tableName, Authorizations.EMPTY); assertFalse(s.iterator().hasNext()); return null; } });
String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();
DistCp cp = newDistCp(new Configuration(false)); String import_ = "file://" + new File(rootPath, "ShellServerIT.import").toString(); if (getCluster().getClientConfig().hasSasl()) {
private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException { // kill gc started by MAC getCluster().killProcess(ServerType.GARBAGE_COLLECTOR, getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR).iterator().next()); // delete lock in zookeeper if there, this will allow next GC to start quickly String path = ZooUtil.getRoot(new ZooKeeperInstance(getCluster().getClientConfig())) + Constants.ZGC_LOCK; ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET); try { ZooLock.deleteLock(zk, path); } catch (IllegalStateException e) { } assertNull(getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR)); }
String zpath = ZooUtil.getRoot(new ZooKeeperInstance(cluster.getClientConfig())) + RootTable.ZROOT_TABLET_PATH; String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
ClientConfiguration clientConfig = SharedMiniClusterBase.getCluster().getClientConfig(); String clientConfPath = new File(SharedMiniClusterBase.getCluster().getConfig().getConfDir(), "client.conf").getAbsolutePath();
String zpath = ZooUtil.getRoot(new ZooKeeperInstance(cluster.getClientConfig())) + RootTable.ZROOT_TABLET_PATH; String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
Connector connector = getConnector(); String tableName = getUniqueNames(1)[0]; ReadWriteIT.ingest(connector, cluster.getClientConfig(), "root", ROWS, COLS, 50, 0, tableName); ReadWriteIT.verify(connector, cluster.getClientConfig(), "root", ROWS, COLS, 50, 0, tableName);
Instance instance = new ZooKeeperInstance(getCluster().getClientConfig()); ClientContext ctx = new ClientContext(instance, creds, getCluster().getClientConfig());
AccumuloOutputFormat outputFormat = new AccumuloOutputFormat(); AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig); AccumuloOutputFormat.setZooKeeperInstance(job, cluster.getClientConfig()); AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(ROOT_PASSWORD)); RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
/** * Get programmatic interface to information available in a normal monitor. XXX the returned * structure won't contain information about the metadata table until there is data in it. e.g. if * you want to see the metadata table you should create a table. * * @since 1.6.1 */ public MasterMonitorInfo getMasterMonitorInfo() throws AccumuloException, AccumuloSecurityException { MasterClientService.Iface client = null; MasterMonitorInfo stats = null; try { Instance instance = new ZooKeeperInstance(getClientConfig()); ClientContext context = new ClientContext(instance, new Credentials("root", new PasswordToken("unchecked")), getClientConfig()); client = MasterClient.getConnectionWithRetry(context); stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds()); } catch (ThriftSecurityException exception) { throw new AccumuloSecurityException(exception); } catch (TException exception) { throw new AccumuloException(exception); } finally { if (client != null) { MasterClient.close(client); } } return stats; }
conn.tableOperations().create(tableName); DistributedTrace.enable("localhost", "testTrace", mac.getClientConfig()); sleepUninterruptibly(1, TimeUnit.SECONDS); Span root = Trace.on("traceTest");
@Override public Void run() throws Exception { ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig()); Connector conn = inst.getConnector(rootUgi.getUserName(), new KerberosToken()); conn.tableOperations().create(tableName); conn.securityOperations().createLocalUser(userWithoutCredentials1, new PasswordToken("ignored")); conn.securityOperations().grantTablePermission(userWithoutCredentials1, tableName, TablePermission.READ); conn.securityOperations().createLocalUser(userWithoutCredentials3, new PasswordToken("ignored")); conn.securityOperations().grantTablePermission(userWithoutCredentials3, tableName, TablePermission.READ); return null; } });