Last active
January 14, 2016 15:04
-
-
Save wjsl/3372a404a20e54c4da19 to your computer and use it in GitHub Desktop.
Quick way to get a shell to a MiniAccumulo Instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(args: Array[String]): Unit = { | |
Logger.getLogger("org.apache.zookeeper").setLevel(Level.OFF) | |
val log = LoggerFactory.getLogger(getClass) | |
val work_dir = Files.createTempDir() | |
log.info("Working dir: {}", work_dir) | |
val password = "secret" | |
val accumulo = new MiniAccumuloCluster(new MiniAccumuloConfig(Files.createTempDir(), password)) | |
var returnCode: Option[Int] = None | |
try { | |
accumulo.start() | |
val shell = new Shell(); | |
val shell_args = s"-u root -p $password -zi ${accumulo.getInstanceName} -zh ${accumulo.getZooKeepers}".split(" ") | |
try { | |
if (!shell.config(shell_args:_*)) { | |
returnCode = Option(shell.getExitCode) | |
} else { | |
returnCode = Option(shell.start()) | |
} | |
} finally { | |
shell.shutdown | |
} | |
} finally { | |
accumulo.stop() | |
work_dir.deleteOnExit() | |
} | |
System.exit(returnCode.get) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment