嗨我是hadoop hive的基本学习者。$ HOME / .hivehistory无法正常工作或让我知道在哪里输入该命令。由于某些原因我关闭了我的终端并在一段时间后打开了。现在我怎么能打开以前的命令历史。请帮帮我。我无法理清。
答案 0 :(得分:0)
.hivehistory
位于调用CLI的用户的主目录下,例如 -
当用户cloudera
(我正在使用的用户)
bash-4.1$ ls -l ~/.hivehistory
-rw-rw-r-- 1 cloudera cloudera 1093 May 6 10:42 /home/cloudera/.hivehistory
使用用户hive
bash-4.1$ ls -l ~hive/.hivehistory
-rw-r--r-- 1 hive hive 20 May 6 10:53 /var/lib/hive/.hivehistory
源代码:CliDriver.java
private void setupCmdHistory() {
final String HISTORYFILE = ".hivehistory";
String historyDirectory = System.getProperty("user.home");
PersistentHistory history = null;
try {
if ((new File(historyDirectory)).exists()) {
String historyFile = historyDirectory + File.separator + HISTORYFILE;
history = new FileHistory(new File(historyFile));
reader.setHistory(history);
} else {
System.err.println("WARNING: Directory for Hive history file: " + historyDirectory +
" does not exist. History will not be available during this session.");
}
} catch (Exception e) {
System.err.println("WARNING: Encountered an error while trying to initialize Hive's " +
"history file. History will not be available during this session.");
System.err.println(e.getMessage());
}