2016-03-04 99 views
0

當我執行我的代碼傳遞的所有參數,我得到有關過程HBase的 - 隱藏通過使用正則表達式過濾

... 
17:00:32.847 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #4 
    17:00:32.847 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: next 1 
    17:00:32.847 [main] DEBUG o.a.h.h.c.HConnectionManager$HConnectionImplementation - Cached location for users,,1457026980361.19aa4c864d45ba861fb1e90777e7a8fb. is localhost:60020 
    17:00:32.847 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #5 
    17:00:32.848 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #5 
    17:00:32.848 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: next 1 
    17:00:32.848 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #6 
    17:00:32.849 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #6 
    17:00:32.849 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: close 1 
    17:00:32.851 [main] DEBUG o.a.h.hbase.client.ClientScanner - Creating scanner over users starting at key '' 
    17:00:32.851 [main] DEBUG o.a.h.hbase.client.ClientScanner - Advancing internal scanner to startKey at '' 
    17:00:32.851 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #7 
    17:00:32.852 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #7 
    17:00:32.852 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: openScanner 1 
    17:00:32.853 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #8 
    17:00:32.854 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #8 
    17:00:32.854 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: next 1 
    Username: alican Password: alican123 - ID: 1 
    17:00:32.854 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #9 
    17:00:32.855 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #9 
    17:00:32.855 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: next 1 
    Username: dino Password: dino123 - ID: 2 
    17:00:32.856 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #10 
    17:00:32.856 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #10 
    17:00:32.856 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: next 1 
    17:00:32.857 [main] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican sending #11 
    17:00:32.857 [IPC Client (47) connection to localhost/127.0.0.1:60020 from alican] DEBUG org.apache.hadoop.ipc.HBaseClient - IPC Client (47) connection to localhost/127.0.0.1:60020 from alican got value #11 
    17:00:32.857 [main] DEBUG org.apache.hadoop.ipc.RPCEngine - Call: close 1 
    17:00:32.857 [main] DEBUG o.a.h.hbase.client.ClientScanner - Finished with scanning at {NAME => 'users,,1457026980361.19aa4c864d45ba861fb1e90777e7a8fb.', STARTKEY => '', ENDKEY => '', ENCODED => 19aa4c864d45ba861fb1e90777e7a8fb,} 

我發現的東西,只能說明什麼,我希望看到輸出如此多的信息。

if (otherArgs.length != 1) { 
      System.out.println("usage: [regular expression]"); 
      System.exit(-1); 
     } 

RegexStringComparator regex = new RegexStringComparator(otherArgs[0]); 
     SingleColumnValueFilter filter = new SingleColumnValueFilter(
        usernameFamily, 
        userQualifier, 
        CompareOp.EQUAL, 
        regex 
} 

scan.setFilter(filter); 

當我添加這些代碼時,程序僅顯示System.out.println("usage: [regular expression]");。當我調試程序時,我無法理解這些代碼是什麼。

還有什麼隱藏每一步的過程?

這裏是全碼:

Configuration config = HBaseConfiguration.create(); 
     String[] otherArgs = new GenericOptionsParser(config, args).getRemainingArgs(); 
     /* if (otherArgs.length != 1) { 
      System.out.println("usage: [regular expression]"); 
      System.exit(-1); 
     }*/ 

     HTable table = new HTable(config, "users"); 

     byte[] usernameFamily = Bytes.toBytes("username"); 
     byte[] userQualifier = Bytes.toBytes("user"); 
     byte[] passwordFamily = Bytes.toBytes("password"); 
     byte[] passQualifier = Bytes.toBytes("pass"); 

     /* RegexStringComparator regex = new RegexStringComparator(otherArgs[0]); 
     SingleColumnValueFilter filter = new SingleColumnValueFilter(
        usernameFamily, 
        userQualifier, 
        CompareOp.EQUAL, 
        regex 
       ); only shows username. */ 
     Scan scan = new Scan(); 
     // scan.setFilter(filter); 

     ResultScanner results = table.getScanner(scan); 
     for (Result result : results) { 
      String id = new String(result.getRow()); 
      byte[] byteUsername = result.getValue(usernameFamily, userQualifier); 
      String strUsername = new String(byteUsername); 
      byte[] bytePassword = result.getValue(passwordFamily, passQualifier); 
      String strPassword = new String(bytePassword); 
      System.out.println("Username: " +strUsername + " Password: " + strPassword + " - ID: " + id); 
      } 
     results.close(); 
     table.close();  } 

回答

0

這看起來像你,在任何你的日誌性能XML文件(取決於你如何配置它,假設你可能有一個這些文件的類型爲log4jlogback),org.apache.hadoop.ipc設置爲DEBUG級別。將其更改爲INFO應縮小輸出方式,或ERROR將其縮小一點。

看到這個code link,例如,搜索與掃描已完成 - 它包裹在一個調試檢查,被稱爲與debug測井方法。 (注意,該鏈接是針對HBase的舊版本,但它說明了這個問題。)

另外,請注意,在上面的代碼中,您使用的是System.out.println。我建議使用上述屬性或xml文件從根記錄器設置中獲取記錄器,並通過該記錄進行登錄。這樣,所有軟件包的日誌級別和其他設置都可以在同一個配置文件中進行管理。