public Pair<Integer, String> execSudo(String hostname, long timeout, String... cmd)
    throws IOException {
    LOG.info("Executing remote command: {} , hostname:{}", StringUtils.join(cmd, " "), hostname);

    RemoteSudoShell shell = new RemoteSudoShell(hostname, cmd, timeout);
    try {
      shell.execute();
    } catch (Shell.ExitCodeException ex) {
      // capture the stdout of the process as well.
      String output = shell.getOutput();
      // add output for the ExitCodeException.
      throw new Shell.ExitCodeException(ex.getExitCode(),
        "stderr: " + ex.getMessage() + ", stdout: " + output);
    }

    LOG.info("Executed remote command, exit code:{} , output:{}", shell.getExitCode(),
      shell.getOutput());

    return new Pair<>(shell.getExitCode(), shell.getOutput());
  }
Execute the given command on the host using SSH
@return pair of exit code and command output
@throws IOException if something goes wrong.
hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java