当使用Hbase shell时,ruby (.irbrc)的保存历史选项不起作用



保存历史记录目前正在正常的irb (jruby) shell上工作。但由于某些原因,它不能工作时使用hbase shell。

我过去在其他机器上看到过按照现在描述的相同过程在hbase shell上工作的历史,并且它们确实工作,所以不确定这次我可能错过了什么小细节。

我在里面放了~/。Irbrc如下:

$ cat  ~/.irbrc
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"

在启动irb时发生了吗?是的. .

hbase(main):001:0>   puts IRB.conf[:HISTORY_FILE]
/home/stephenb/.irb-save-history
:AT_EXIT=>[#<Proc:0x6bb5eba4@/shared/jruby-1.7.3/lib/ruby/1.9/irb/ext/save-history.rb:67

这个jruby脚本存在吗?是的. .

$ ll /shared/jruby-1.7.3/lib/ruby/1.9/irb/ext/save-history.rb
-rw-r--r-- 1 stephenb stephenb 2119 Feb 21 07:53 /shared/jruby-1.7.3/lib/ruby/1.9/irb/ext/save-history.rb

hbase shell history工作吗?好吧,不是HBASE命令。但它确实显示了以前的IRB会话(非HBASE)的内容

$ date
Mon Jun  3 12:28:41 PDT 2013
stephenb@gondolin:/shared/git2/etl/appminer/hive$ hbase shell
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.92.2, r1379292, Fri Aug 31 13:13:53 UTC 2012
hbase(main):001:0> describe 'app'
DESCRIPTION                                                                              ENABLED                                         
 {NAME => 'app', FAMILIES => [{NAME => 'm', BLOOMFILTER => 'NONE', REPLICATION_SCOPE =>  true                                            
 '0', VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647',                                                  
 BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}                                                                     
1 row(s) in 0.4500 seconds
hbase(main):002:0> quit
$ ll /home/stephenb/.irb-save-history
-rw-rw-r-- 1 stephenb stephenb 73 Jun  3 12:05 /home/stephenb/.irb-save-history

从调用'hbase shell'之前的'date'和调用'hbase shell'之后历史文件的修改日期可以看出,历史文件没有更新

我也面临同样的问题。经过一点谷歌搜索,我发现这篇文章:http://www.nosql.se/page/2/给出了一个解决方案。.irbrc文件必须如下所示:

# cat .irbrc
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
Kernel.at_exit do
    IRB.conf[:AT_EXIT].each do |i|
        i.call
    end
end

我不能说为什么(我不想学Ruby),但它工作。

最新更新