/** * Disallow snapshot on a directory. * Usage: hdfs dfsadmin -disallowSnapshot snapshotDir * @param argv List of of command line parameters. * @exception IOException */ public void disallowSnapshot(String[] argv) throws IOException { Path p = new Path(argv[1]); final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), getConf()); try { dfs.disallowSnapshot(p); } catch (SnapshotException e) { throw new RemoteException(e.getClass().getName(), e.getMessage()); } System.out.println("Disallowing snapshot on " + argv[1] + " succeeded"); }
@Override public int run(Configuration conf, List<String> args) throws IOException { if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { Map<String, String> codecs = dfs.getAllErasureCodingCodecs(); if (codecs.isEmpty()) { System.out.println("No erasure coding codecs are supported on the " + "cluster."); } else { System.out.println("Erasure Coding Codecs: Codec [Coder List]"); for (Map.Entry<String, String> codec : codecs.entrySet()) { if (codec != null) { System.out.println("\t" + codec.getKey().toUpperCase() + " [" + codec.getValue().toUpperCase() +"]"); } } } } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
/** * Allow snapshot on a directory. * Usage: hdfs dfsadmin -allowSnapshot snapshotDir * @param argv List of of command line parameters. * @exception IOException */ public void allowSnapshot(String[] argv) throws IOException { Path p = new Path(argv[1]); final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), getConf()); try { dfs.allowSnapshot(p); } catch (SnapshotException e) { throw new RemoteException(e.getClass().getName(), e.getMessage()); } System.out.println("Allowing snapshot on " + argv[1] + " succeeded"); }
@Override public int run(Configuration conf, List<String> args) throws IOException { if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { final Collection<ErasureCodingPolicyInfo> policies = dfs.getAllErasureCodingPolicies(); if (policies.isEmpty()) { System.out.println("There is no erasure coding policies in the " + "cluster."); } else { System.out.println("Erasure Coding Policies:"); for (ErasureCodingPolicyInfo policy : policies) { if (policy != null) { System.out.println(policy); } } } } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
@Override public int run(Configuration conf, List<String> args) throws IOException { String name = StringUtils.popFirstNonOption(args); if (name == null) { System.err.println("You must specify a name when deleting a " + "cache pool."); return 1; } if (!args.isEmpty()) { System.err.print("Can't understand arguments: " + Joiner.on(" ").join(args) + "\n"); System.err.println("Usage is " + getShortUsage()); return 1; } DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.removeCachePool(name); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } System.out.println("Successfully removed cache pool " + name + "."); return 0; } }
@Override public int run(Configuration conf, List<String> args) throws IOException { final String path = StringUtils.popOptionWithArgument("-path", args); if (path == null) { System.err.println("Please specify the path for setting the storage " + "policy.\nUsage: " + getLongUsage()); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.satisfyStoragePolicy(new Path(path)); System.out.println("Scheduled blocks to move based on the current" + " storage policy on " + path); } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
@Override public int run(Configuration conf, List<String> args) throws IOException { final String ecPolicyName = StringUtils.popOptionWithArgument( "-policy", args); if (ecPolicyName == null) { System.err.println("Please specify the policy name.\nUsage: " + getLongUsage()); return 1; } if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.removeErasureCodingPolicy(ecPolicyName); System.out.println("Erasure coding policy " + ecPolicyName + "is removed"); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
@Override public int run(Configuration conf, List<String> args) throws IOException { final String path = StringUtils.popOptionWithArgument("-path", args); if (path == null) { System.err.println("Please specify the path with -path.\nUsage: " + getLongUsage()); return 1; } if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final Path p = new Path(path); final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf); try { ErasureCodingPolicy ecPolicy = dfs.getErasureCodingPolicy(p); if (ecPolicy != null) { System.out.println(ecPolicy.getName()); } else { System.out.println("The erasure coding policy of " + path + " is " + "unspecified"); } } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
return 1; DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.getClient().removeCacheDirective(id);
@Override public int run(Configuration conf, List<String> args) throws IOException { final String ecPolicyName = StringUtils.popOptionWithArgument("-policy", args); if (ecPolicyName == null) { System.err.println("Please specify the policy name.\nUsage: " + getLongUsage()); return 1; } if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.disableErasureCodingPolicy(ecPolicyName); System.out.println("Erasure coding policy " + ecPolicyName + " is disabled"); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
@Override public int run(Configuration conf, List<String> args) throws IOException { final String ecPolicyName = StringUtils.popOptionWithArgument("-policy", args); if (ecPolicyName == null) { System.err.println("Please specify the policy name.\nUsage: " + getLongUsage()); return 1; } if (args.size() > 0) { System.err.println(getName() + ": Too many arguments"); return 1; } final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.enableErasureCodingPolicy(ecPolicyName); System.out.println("Erasure coding policy " + ecPolicyName + " is enabled"); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2; } return 0; } }
final DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { List<ErasureCodingPolicy> policies =
final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf); try { dfs.unsetErasureCodingPolicy(p);
final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf); try { dfs.setErasureCodingPolicy(p, ecPolicyName);
AdminHelper.getDFS(new Path(path).toUri(), conf); CacheDirectiveInfo directive = builder.build(); EnumSet<CacheFlag> flags = EnumSet.noneOf(CacheFlag.class);
try { DistributedFileSystem dfs = AdminHelper.getDFS(new Path(path).toUri(), conf); RemoteIterator<CacheDirectiveEntry> iter = dfs.listCacheDirectives(
return 1; DistributedFileSystem dfs = AdminHelper.getDFS(conf); EnumSet<CacheFlag> flags = EnumSet.noneOf(CacheFlag.class); if (force) {
return 1; DistributedFileSystem dfs = AdminHelper.getDFS(conf); try { dfs.addCachePool(info);
return 1; DistributedFileSystem dfs = AdminHelper.getDFS(conf); TableListing.Builder builder = new TableListing.Builder(). addField("NAME", Justification.LEFT).
DistributedFileSystem dfs = AdminHelper.getDFS(conf); RemoteIterator<CacheDirectiveEntry> iter = dfs.listCacheDirectives(builder.build());