public static void main(String[] args) throws UnknownHostException, IOException {
SecurityUtil.serverLogin();
Instance instance = HdfsZooInstance.getInstance();
ServerConfiguration serverConf = new ServerConfiguration(instance);
final FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), serverConf.getConfiguration());
Accumulo.init(fs, serverConf, "gc");
String address = "localhost";
SimpleGarbageCollector gc = new SimpleGarbageCollector();
Opts opts = new Opts();
opts.parseArgs(SimpleGarbageCollector.class.getName(), args);
if (opts.safeMode)
gc.setSafeMode();
if (opts.offline)
gc.setOffline();
if (opts.verbose)
gc.setVerbose();
if (opts.address != null)
address = opts.address;
String hostname = address;
// Catch a few edge cases where we might get a non-useful address
if ("0.0.0.0".equals(address)) {
// Get a better hostname for this system
hostname = InetAddress.getLocalHost().getHostName();
}
gc.init(fs, instance, SecurityConstants.getSystemCredentials(), serverConf.getConfiguration().getBoolean(Property.GC_TRASH_IGNORE));
Accumulo.enableTracing(hostname, "gc");
gc.run(hostname);
}