HBASE-8405 Add more custom options to how ClusterManager runs commands
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1471804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
026779686f
commit
d122093473
|
@ -40,6 +40,7 @@ import org.apache.hadoop.util.Shell;
|
||||||
public class HBaseClusterManager extends ClusterManager {
|
public class HBaseClusterManager extends ClusterManager {
|
||||||
private String sshUserName;
|
private String sshUserName;
|
||||||
private String sshOptions;
|
private String sshOptions;
|
||||||
|
private String sshBeforeCommand;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setConf(Configuration conf) {
|
public void setConf(Configuration conf) {
|
||||||
|
@ -54,6 +55,10 @@ public class HBaseClusterManager extends ClusterManager {
|
||||||
if (!extraSshOptions.isEmpty()) {
|
if (!extraSshOptions.isEmpty()) {
|
||||||
sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " ");
|
sshOptions = StringUtils.join(new Object[] { sshOptions, extraSshOptions }, " ");
|
||||||
}
|
}
|
||||||
|
sshBeforeCommand = conf.get("hbase.it.clustermanager.ssh.beforeCommand", "");
|
||||||
|
if (!sshBeforeCommand.isEmpty()) {
|
||||||
|
sshBeforeCommand += " && ";
|
||||||
|
}
|
||||||
LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]");
|
LOG.info("Running with SSH user [" + sshUserName + "] and options [" + sshOptions + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +66,6 @@ public class HBaseClusterManager extends ClusterManager {
|
||||||
* Executes commands over SSH
|
* Executes commands over SSH
|
||||||
*/
|
*/
|
||||||
protected class RemoteShell extends Shell.ShellCommandExecutor {
|
protected class RemoteShell extends Shell.ShellCommandExecutor {
|
||||||
|
|
||||||
private String hostname;
|
private String hostname;
|
||||||
|
|
||||||
private String sshCmd = "/usr/bin/ssh";
|
private String sshCmd = "/usr/bin/ssh";
|
||||||
|
@ -95,7 +99,7 @@ public class HBaseClusterManager extends ClusterManager {
|
||||||
StringUtils.join(new String[] { sshCmd,
|
StringUtils.join(new String[] { sshCmd,
|
||||||
(sshOptions == null) ? "" : sshOptions,
|
(sshOptions == null) ? "" : sshOptions,
|
||||||
userAndHost,
|
userAndHost,
|
||||||
"\"" + StringUtils.join(super.getExecString(), " ") + "\""
|
"\"" + sshBeforeCommand + StringUtils.join(super.getExecString(), " ") + "\""
|
||||||
}, " ")};
|
}, " ")};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -674,9 +674,9 @@ and public client API's can be used.
|
||||||
<para>
|
<para>
|
||||||
On a distributed cluster, integration tests that use ChaosMonkey or otherwise manipulate services thru cluster manager (e.g. restart regionservers) use SSH to do it.
|
On a distributed cluster, integration tests that use ChaosMonkey or otherwise manipulate services thru cluster manager (e.g. restart regionservers) use SSH to do it.
|
||||||
To run these, test process should be able to run commands on remote end, so ssh should be configured accordingly (for example, if HBase runs under hbase
|
To run these, test process should be able to run commands on remote end, so ssh should be configured accordingly (for example, if HBase runs under hbase
|
||||||
user in your cluster, you can set up passwordless ssh for that user and run the test also under it). To facilitate that, <code>hbase.it.clustermanager.ssh.user</code> and
|
user in your cluster, you can set up passwordless ssh for that user and run the test also under it). To facilitate that, <code>hbase.it.clustermanager.ssh.user</code>,
|
||||||
<code>hbase.it.clustermanager.ssh.opts</code> configuration settings can be used. The former is the remote user that cluster manager should use to perform ssh commands.
|
<code>hbase.it.clustermanager.ssh.opts</code> and <code>hbase.it.clustermanager.ssh.beforeCommand</code> configuration settings can be used. "User" is the remote user that cluster manager should use to perform ssh commands.
|
||||||
The latter contains additional options that are passed to SSH (for example, "-i /tmp/my-key").
|
"Opts" contains additional options that are passed to SSH (for example, "-i /tmp/my-key"). "BeforeCommand" is the command that will be run immediately after SSH-ing to the server, before the actual command (for example, "su hbase").
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<section xml:id="maven.build.commands.integration.tests.mini">
|
<section xml:id="maven.build.commands.integration.tests.mini">
|
||||||
|
|
Loading…
Reference in New Issue