|   | 1 | ◢ <[wiki:Hinet120814/Lab11 實作十一]> | <[wiki:Hinet120814 回課程大綱]> ▲ | <[wiki:Hinet120814/Lab13 實作十三]> ◣ | 
                  
                          |   | 2 |  | 
                  
                          |   | 3 | = 實作十二 Lab 12 = | 
                  
                          |   | 4 | [[PageOutline]] | 
                  
                          |   | 5 | {{{ | 
                  
                          |   | 6 | #!html | 
                  
                          |   | 7 | <div style="text-align: center;"><big style="font-weight: bold;"><big>HBase 行為觀察<br/>HBase in Practice</big></big></div> | 
                  
                          |   | 8 | }}} | 
                  
                          |   | 9 |  | 
                  
                          |   | 10 | {{{ | 
                  
                          |   | 11 | #!text | 
                  
                          |   | 12 | 以下練習,請使用 hadoop4win 環境執行。 | 
                  
                          |   | 13 | }}} | 
                  
                          |   | 14 |  | 
                  
                          |   | 15 |  * 首先請先下 start-hbase 指令或點選"開始"->"stat-hbase",來開啟 HBase 與 Hadoop 的 Daemon | 
                  
                          |   | 16 |  * 請回到家目錄,並輸入指令『__'''hbase shell hbase-test'''__』。 | 
                  
                          |   | 17 |  * 註一:這個 hbase-test 存放在安裝帳號身分的家目錄中,倘若用其他帳號登入,可能會找不到。 | 
                  
                          |   | 18 |  * 註二:如果剛剛有下 stop-hadoop 的話,一定要記得 start-hadoop,因為 HBase 的資料表格是存在 HDFS 之上。 | 
                  
                          |   | 19 | {{{ | 
                  
                          |   | 20 | $ cd ~ | 
                  
                          |   | 21 | $ hbase shell hbase-test | 
                  
                          |   | 22 | }}} | 
                  
                          |   | 23 |    * [[BR]][[Image(Hadoop4Win:hadoop4win_24.jpg,width=600)]] | 
                  
                          |   | 24 |  | 
                  
                          |   | 25 |  * STEP 11: 您也可以輸入指令『__'''hbase shell'''__』進入互動式的 HBase 指令列。您可以嘗試用底下列舉的指令,重現 hbase-test 的過程。 | 
                  
                          |   | 26 | {{{ | 
                  
                          |   | 27 | $ hbase shell | 
                  
                          |   | 28 | }}} | 
                  
                          |   | 29 | {{{ | 
                  
                          |   | 30 | create 'test','data' | 
                  
                          |   | 31 | put 'test','row1','data:1','v1' | 
                  
                          |   | 32 | put 'test','row2','data:2','v2' | 
                  
                          |   | 33 | put 'test','row3','data:3','v3' | 
                  
                          |   | 34 | scan 'test' | 
                  
                          |   | 35 | disable 'test' | 
                  
                          |   | 36 | drop 'test' | 
                  
                          |   | 37 | list | 
                  
                          |   | 38 | exit | 
                  
                          |   | 39 | }}} | 
                  
                          |   | 40 |    * [[BR]][[Image(Hadoop4Win:hadoop4win_25.jpg,width=600)]] | 
                  
                          |   | 41 |  | 
                  
                          |   | 42 |  * 欲離開 Cygwin 環境前或者要暫時關閉 HBase 系統時,請輸入指令『__'''stop-hbase'''__』。需提醒您的是 HBase 因採用 !ZooKeeper,有時關閉 master 的速度會比較慢,請耐心等候。註:目前下 exit 指令登出時會執行 stop-hbase 與 stop-hadoop 的動作。 | 
                  
                          |   | 43 | {{{ | 
                  
                          |   | 44 | $ stop-hbase | 
                  
                          |   | 45 | }}} | 
                  
                          |   | 46 |    * [[BR]][[Image(Hadoop4Win:hadoop4win_26.jpg,width=600)]] | 
                  
                          |   | 47 |  | 
                  
                          |   | 48 |  * 倘若是已經關閉 Cygwin 視窗,第二次重新執行 C:\hadoop4win\Cygwin.bat,請輸入指令『__'''start-hbase'''__』,目前 start-hbase 會視目前 java process 判斷 hadoop 是否存在而執行『__'''start-hadoop'''__』。 | 
                  
                          |   | 49 | {{{ | 
                  
                          |   | 50 | $ start-hbase | 
                  
                          |   | 51 | }}} | 
                  
                          |   | 52 |    * [[BR]][[Image(Hadoop4Win:hadoop4win_27.jpg,width=600)]] |