2013-06-03 49 views
1

保存歷史目前工作正常IRB(JRuby中)外殼紅寶石保存歷史的選擇。但由於某些原因,它在使用hbase shell時不起作用。當使用HBase的外殼(.irbrc)不工作

我已經看到了歷史上的HBase殼工作在過去的其他框下面的同樣的方法現在描述和他們做工作,所以不知道什麼小細節我可能已經錯過了周圍的這段時間。

我已經把裏面的〜/ .irbrc如下:

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

它是否啓動內部評級時考慮?是的..

hbase(main):001:0> puts IRB.conf[:HISTORY_FILE] 
/home/stephenb/.irb-save-history 

:AT_EXIT=>[#<Proc:[email protected]/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 
[email protected]:/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的殼」,之後的歷史文件沒有更新歷史文件的修改日期前看到。

回答

4

我面臨同樣的問題。經過一番谷歌搜索,我發現這個職位: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),但它的工作原理。希望能幫助到你。

+1

如果有人能夠解釋爲什麼這個解決方案能夠提供更完整的答案,這將是有用的。 – w5m

+0

感謝您的回覆。我會嘗試。 – javadba

+0

@ w5m我同意。但沒有人「加強」,所以我反正授予了答案,因爲答案確實有幫助。 – javadba