@Override public int run(Configuration conf, List<String> args) throws IOException { final FileSystem fs = FileSystem.get(conf); try { Collection<? extends BlockStoragePolicySpi> policies = fs.getAllStoragePolicies(); System.out.println("Block Storage Policies:"); for (BlockStoragePolicySpi policy : policies) { if (policy != null) { System.out.println("\t" + 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 { final String path = StringUtils.popOptionWithArgument("-path", args); if (path == null) { System.err.println("Please specify the path from which " + "the storage policy will be unset.\nUsage: " + getLongUsage()); return 1; } Path p = new Path(path); final FileSystem fs = FileSystem.get(p.toUri(), conf); try { fs.unsetStoragePolicy(p); System.out.println("Unset storage policy from " + 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 { 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; } }
@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; } }
System.out.println("Removed cached directive " + id); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); return 2;
System.err.println(AdminHelper.prettifyException(e)); System.err.println("Use '-setPolicy -path <PATH> -replicate' to enforce" + " default replication policy irrespective of EC policy" return 2; } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 2;
@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 String policyName = StringUtils.popOptionWithArgument("-policy", args); if (policyName == null) { System.err.println("Please specify the policy name.\nUsage: " + getLongUsage()); return 1; } Path p = new Path(path); final FileSystem fs = FileSystem.get(p.toUri(), conf); try { fs.setStoragePolicy(p, policyName); System.out.println("Set storage policy " + policyName + " 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.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; } }
System.err.println(AdminHelper.prettifyException(e)); return 2;
@Override public int run(String[] args) throws Exception { if (args.length == 0) { AdminHelper.printUsage(false, "storagepolicies", COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } final AdminHelper.Command command = AdminHelper.determineCommand(args[0], COMMANDS); if (command == null) { System.err.println("Can't understand command '" + args[0] + "'"); if (!args[0].startsWith("-")) { System.err.println("Command names must start with dashes."); } AdminHelper.printUsage(false, "storagepolicies", COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } final List<String> argsList = new LinkedList<>(); argsList.addAll(Arrays.asList(args).subList(1, args.length)); try { return command.run(getConf(), argsList); } catch (IllegalArgumentException e) { System.err.println(AdminHelper.prettifyException(e)); return -1; } }
@Override public int run(String[] args) throws Exception { if (args.length == 0) { AdminHelper.printUsage(false, NAME, COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } final AdminHelper.Command command = AdminHelper.determineCommand(args[0], COMMANDS); if (command == null) { System.err.println("Can't understand command '" + args[0] + "'"); if (!args[0].startsWith("-")) { System.err.println("Command names must start with dashes."); } AdminHelper.printUsage(false, NAME, COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } final List<String> argsList = new LinkedList<>(); argsList.addAll(Arrays.asList(args).subList(1, args.length)); try { return command.run(getConf(), argsList); } catch (IllegalArgumentException e) { System.err.println(AdminHelper.prettifyException(e)); return -1; } }
return 2; } catch (Exception e) { System.err.println(AdminHelper.prettifyException(e)); return 2;
@Override public int run(String[] args) throws IOException { if (args.length == 0) { AdminHelper.printUsage(false, "cacheadmin", COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } AdminHelper.Command command = AdminHelper.determineCommand(args[0], COMMANDS); if (command == null) { System.err.println("Can't understand command '" + args[0] + "'"); if (!args[0].startsWith("-")) { System.err.println("Command names must start with dashes."); } AdminHelper.printUsage(false, "cacheadmin", COMMANDS); ToolRunner.printGenericCommandUsage(System.err); return 1; } List<String> argsList = new LinkedList<String>(); for (int j = 1; j < args.length; j++) { argsList.add(args[j]); } try { return command.run(getConf(), argsList); } catch (IllegalArgumentException e) { System.err.println(AdminHelper.prettifyException(e)); return -1; } }
entry.getInfo().getId()); } catch (IOException e) { System.err.println(AdminHelper.prettifyException(e)); exitCode = 2; System.err.println(AdminHelper.prettifyException(e)); exitCode = 2;
System.err.println(AdminHelper.prettifyException(e)); return 3;