use of org.apache.accumulo.server.cli.ClientOpts in project accumulo by apache.
the class LocalityCheck method run.
public int run(String[] args) throws Exception {
ClientOpts opts = new ClientOpts();
opts.parseArgs(LocalityCheck.class.getName(), args);
VolumeManager fs = VolumeManagerImpl.get();
Connector connector = opts.getConnector();
Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
scanner.setRange(MetadataSchema.TabletsSection.getRange());
Map<String, Long> totalBlocks = new HashMap<>();
Map<String, Long> localBlocks = new HashMap<>();
ArrayList<String> files = new ArrayList<>();
for (Entry<Key, Value> entry : scanner) {
Key key = entry.getKey();
if (key.compareColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME) == 0) {
String location = entry.getValue().toString();
String[] parts = location.split(":");
String host = parts[0];
addBlocks(fs, host, files, totalBlocks, localBlocks);
files.clear();
} else if (key.compareColumnFamily(DataFileColumnFamily.NAME) == 0) {
files.add(fs.getFullPath(key).toString());
}
}
System.out.println(" Server %local total blocks");
for (Entry<String, Long> entry : totalBlocks.entrySet()) {
final String host = entry.getKey();
final Long blocksForHost = entry.getValue();
System.out.println(String.format("%15s %5.1f %8d", host, (localBlocks.get(host) * 100.) / blocksForHost, blocksForHost));
}
return 0;
}
use of org.apache.accumulo.server.cli.ClientOpts in project accumulo by apache.
the class FindOfflineTablets method main.
public static void main(String[] args) throws Exception {
ClientOpts opts = new ClientOpts();
opts.parseArgs(FindOfflineTablets.class.getName(), args);
Instance instance = opts.getInstance();
AccumuloServerContext context = new AccumuloServerContext(instance, new ServerConfigurationFactory(opts.getInstance()));
findOffline(context, null);
}
use of org.apache.accumulo.server.cli.ClientOpts in project accumulo by apache.
the class MergeStats method main.
public static void main(String[] args) throws Exception {
ClientOpts opts = new ClientOpts();
opts.parseArgs(MergeStats.class.getName(), args);
Connector conn = opts.getConnector();
Map<String, String> tableIdMap = conn.tableOperations().tableIdMap();
for (Entry<String, String> entry : tableIdMap.entrySet()) {
final String table = entry.getKey(), tableId = entry.getValue();
String path = ZooUtil.getRoot(conn.getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId + "/merge";
MergeInfo info = new MergeInfo();
if (ZooReaderWriter.getInstance().exists(path)) {
byte[] data = ZooReaderWriter.getInstance().getData(path, new Stat());
DataInputBuffer in = new DataInputBuffer();
in.reset(data, data.length);
info.readFields(in);
}
System.out.println(String.format("%25s %10s %10s %s", table, info.getState(), info.getOperation(), info.getExtent()));
}
}
use of org.apache.accumulo.server.cli.ClientOpts in project accumulo by apache.
the class CheckForMetadataProblems method main.
public static void main(String[] args) throws Exception {
ClientOpts opts = new ClientOpts();
opts.parseArgs(CheckForMetadataProblems.class.getName(), args);
VolumeManager fs = VolumeManagerImpl.get();
checkMetadataAndRootTableEntries(RootTable.NAME, opts, fs);
checkMetadataAndRootTableEntries(MetadataTable.NAME, opts, fs);
opts.stopTracing();
if (sawProblems)
throw new RuntimeException();
}
use of org.apache.accumulo.server.cli.ClientOpts in project accumulo by apache.
the class ListTables method main.
public static void main(String[] args) throws Exception {
ClientOpts opts = new ClientOpts();
opts.parseArgs(ListTables.class.getName(), args);
for (Entry<String, Table.ID> table : Tables.getNameToIdMap(opts.getInstance()).entrySet()) System.out.println(table.getKey() + " => " + table.getValue());
}
Aggregations