hbase开发,hbase表操作及其java api实现

13 篇文章 0 订阅
]

开发环境

hadoop: hadoop-1.1.2

hbase: hbase-0.94.11-security

eclipse:Juno Service Release 2

配置Eclipse 

通过 Eclipse 创建一个新 Java 工程,右击项目根目录,选择“Properties> Java Build Path> Library>  Add  External  JARs”,将 HBase 安装文件解压后根目录下的hbase-0.94.11-security.jar、hbase-0.94.11-security-tests.jar 和 lib 子目录下所有的 jar 包添加到本工程的 Build Path下。 

示例使用表users及表的基本操作:

创建表

[html]  view plain copy
  1. >create 'users','user_id','address','info'  

添加记录


[html]  view plain copy
  1. put 'users','xiaoming','info:age','24';  
  2. put 'users','xiaoming','info:birthday','1987-06-17';  
  3. put 'users','xiaoming','info:company','alibaba';  
  4. put 'users','xiaoming','address:contry','china';  
  5. put 'users','xiaoming','address:province','zhejiang';  
  6. put 'users','xiaoming','address:city','hangzhou';  
  7. put 'users','zhangyifei','info:birthday','1987-4-17';  
  8. put 'users','zhangyifei','info:favorite','movie';  
  9. put 'users','zhangyifei','info:company','alibaba';  
  10. put 'users','zhangyifei','address:contry','china';  
  11. put 'users','zhangyifei','address:province','guangdong';  
  12. put 'users','zhangyifei','address:city','jieyang';  
  13. put 'users','zhangyifei','address:town','xianqiao'  
注意:最后一个语句没有分号,此时,按回车后将添加数据到表'users'中。

获取一条记录

1.取得一个id的所有数据
[html]  view plain copy
  1. >get 'users','xiaoming'  
2.获取一个id,一个列族的所有数据
[html]  view plain copy
  1. >get 'users','xiaoming','info'  
3.获取一个id,一个列族中一个列的所有数据
[html]  view plain copy
  1. >get 'users','xiaoming','info:age'  

更新记录

[html]  view plain copy
  1. >put 'users','xiaoming','info:age' ,'29'  
  2. >get 'users','xiaoming','info:age'  
  3. >put 'users','xiaoming','info:age' ,'30'  
  4. >get 'users','xiaoming','info:age'  

获取单元格数据的版本数据

[html]  view plain copy
  1. >get 'users','xiaoming',{COLUMN=>'info:age',VERSIONS=>1}  
  2. >get 'users','xiaoming',{COLUMN=>'info:age',VERSIONS=>2}  
  3. >get 'users','xiaoming',{COLUMN=>'info:age',VERSIONS=>3}  

获取单元格数据的某个版本数据

[html]  view plain copy
  1. 〉get 'users','xiaoming',{COLUMN=>'info:age',TIMESTAMP=>1364874937056}  

删除xiaoming值的'info:age'字段

[html]  view plain copy
  1. >delete 'users','xiaoming','info:age'  
  2. >get 'users','xiaoming'  

删除整行

[html]  view plain copy
  1. >deleteall 'users','xiaoming'  

统计表的行数

[html]  view plain copy
  1. >count 'users'  

清空表

[html]  view plain copy
  1. >truncate 'users'  

全表扫描

[html]  view plain copy
  1. >scan 'users'  

输出结果:

[html]  view plain copy
  1. hbase(main):022:0> scan 'users'  
  2. ROW                                          COLUMN+CELL                                                                                                                      
  3.  xiaoming                                    column=address:city, timestamp=1378733106132value=hangzhou                                                                     
  4.  xiaoming                                    column=address:contry, timestamp=1378733106058value=china                                                                      
  5.  xiaoming                                    column=address:province, timestamp=1378733106120value=zhejiang                                                                 
  6.  xiaoming                                    column=info:age, timestamp=1378733105943value=24                                                                               
  7.  xiaoming                                    column=info:birthday, timestamp=1378733105961value=1987-06-17                                                                  
  8.  xiaoming                                    column=info:company, timestamp=1378733106006value=alibaba                                                                      
  9.  zhangyifei                                  column=address:city, timestamp=1378733106184value=jieyang                                                                      
  10.  zhangyifei                                  column=address:contry, timestamp=1378733106176value=china                                                                      
  11.  zhangyifei                                  column=address:province, timestamp=1378733106180value=guangdong                                                                
  12.  zhangyifei                                  column=address:town, timestamp=1378733106189value=xianqiao                                                                     
  13.  zhangyifei                                  column=info:birthday, timestamp=1378733106161value=1987-4-17                                                                   
  14.  zhangyifei                                  column=info:company, timestamp=1378733106171value=alibaba                                                                      
  15.  zhangyifei                                  column=info:favorite, timestamp=1378733106167value=movie                                                                       
  16. 2 row(s) in 0.1900 seconds  

示例一:输出表“users”的列族名称

代码:

[java]  view plain copy
  1. import java.io.IOException;  
  2. import org.apache.hadoop.conf.Configuration;  
  3. import org.apache.hadoop.hbase.HBaseConfiguration;  
  4. import org.apache.hadoop.hbase.HColumnDescriptor;  
  5. import org.apache.hadoop.hbase.HTableDescriptor;  
  6. import org.apache.hadoop.hbase.client.HBaseAdmin;  
  7. import org.apache.hadoop.hbase.util.Bytes;  
  8.   
  9. public class ExampleClient {  
  10.     public static void main(String[] args) throws IOException {  
  11.           
  12.           Configuration conf = HBaseConfiguration.create();  
  13.           conf.set("hbase.zookeeper.quorum""master");//使用eclipse时必须添加这个,否则无法定位  
  14.           conf.set("hbase.zookeeper.property.clientPort""2181");  
  15.           HBaseAdmin admin = new HBaseAdmin(conf);// 新建一个数据库管理员  
  16.           HTableDescriptor tableDescriptor = admin.getTableDescriptor(Bytes.toBytes("users"));  
  17.           byte[] name = tableDescriptor.getName();  
  18.           System.out.println("result:");  
  19.   
  20.           System.out.println("table name: "new String(name));  
  21.           HColumnDescriptor[] columnFamilies = tableDescriptor  
  22.                   .getColumnFamilies();  
  23.           for(HColumnDescriptor d : columnFamilies){  
  24.               System.out.println("column Families: "+ d.getNameAsString());  
  25.               }  
  26.         }  
  27. }  

编译结果:

[java]  view plain copy
  1. 2013-09-09 15:58:51,890 WARN  conf.Configuration (Configuration.java:<clinit>(195)) - DEPRECATED: hadoop-site.xml found in the classpath. Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to override properties of core-default.xml, mapred-default.xml and hdfs-default.xml respectively  
  2. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT  
  3. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:host.name=w253245.ppp.asahi-net.or.jp  
  4. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.version=1.6.0_10-rc2  
  5. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.vendor=Sun Microsystems Inc.  
  6. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.home=C:\Java\jre6  
  7. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.class.path=...............//太占篇幅此处省略  
  8. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.library.path=D:\workspace\Eclipse-jee\hadoop-1.1.21\lib\native;D:\workspace\Eclipse-jee\hadoop-1.1.21\lib\native  
  9. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\  
  10. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.compiler=<NA>  
  11. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.name=Windows XP  
  12. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.arch=x86  
  13. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.version=5.1  
  14. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.name=hadoop  
  15. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.home=C:\Documents and Settings\Administrator  
  16. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.dir=D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht  
  17. 2013-09-09 15:58:55,031 INFO  zookeeper.ZooKeeper (ZooKeeper.java:<init>(438)) - Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=hconnection  
  18. 2013-09-09 15:58:56,171 INFO  zookeeper.RecoverableZooKeeper (RecoverableZooKeeper.java:<init>(104)) - The identifier of this process is 6032@tht  
  19. 2013-09-09 15:58:56,234 INFO  zookeeper.ClientCnxn (ClientCnxn.java:logStartConnect(966)) - Opening socket connection to server master/121.1.253.251:2181. Will not attempt to authenticate using SASL (无法定位登录配置)  
  20. 2013-09-09 15:58:56,296 INFO  zookeeper.ClientCnxn (ClientCnxn.java:primeConnection(849)) - Socket connection established to master/121.1.253.251:2181, initiating session  
  21. 2013-09-09 15:58:56,484 INFO  zookeeper.ClientCnxn (ClientCnxn.java:onConnected(1207)) - Session establishment complete on server master/121.1.253.251:2181, sessionid = 0x141011ad7db000e, negotiated timeout = 180000  
  22. result:  
  23. table name: users  
  24. column Families: address  
  25. column Families: info  
  26. column Families: user_id  

示例二:使用HBase  Java  API对表users2进行操作:

代码:

[java]  view plain copy
  1. import java.util.ArrayList;  
  2. import java.util.List;  
  3. import org.apache.hadoop.conf.Configuration;  
  4. import org.apache.hadoop.hbase.HBaseConfiguration;  
  5. import org.apache.hadoop.hbase.HColumnDescriptor;  
  6. import org.apache.hadoop.hbase.HTableDescriptor;  
  7. import org.apache.hadoop.hbase.KeyValue;  
  8. import org.apache.hadoop.hbase.client.Delete;  
  9. import org.apache.hadoop.hbase.client.Get;  
  10. import org.apache.hadoop.hbase.client.HBaseAdmin;  
  11. import org.apache.hadoop.hbase.client.HTable;  
  12. import org.apache.hadoop.hbase.client.Put;  
  13. import org.apache.hadoop.hbase.client.Result;  
  14. import org.apache.hadoop.hbase.client.ResultScanner;  
  15. import org.apache.hadoop.hbase.client.Scan;  
  16. import org.apache.hadoop.hbase.util.Bytes;  
  17.   
  18. public class OperateTable {  
  19.     // 声明静态配置  
  20.     private static Configuration conf = null;  
  21.     static {  
  22.         conf = HBaseConfiguration.create();  
  23.         conf.set("hbase.zookeeper.quorum",  
  24.                 "master");  
  25.         conf.set("hbase.zookeeper.property.clientPort""2181");  
  26.     }  
  27.   
  28.     // 创建数据库表  
  29.     public static void createTable(String tableName, String[] columnFamilys)  
  30.             throws Exception {  
  31.         // 新建一个数据库管理员  
  32.         HBaseAdmin hAdmin = new HBaseAdmin(conf);  
  33.   
  34.         if (hAdmin.tableExists(tableName)) {  
  35.             System.out.println("表已经存在");  
  36.             System.exit(0);  
  37.         } else {  
  38.             // 新建一个 scores 表的描述  
  39.             HTableDescriptor tableDesc = new HTableDescriptor(tableName);  
  40.             // 在描述里添加列族  
  41.             for (String columnFamily : columnFamilys) {  
  42.                 tableDesc.addFamily(new HColumnDescriptor(columnFamily));  
  43.             }  
  44.             // 根据配置好的描述建表  
  45.             hAdmin.createTable(tableDesc);  
  46.             System.out.println("创建表成功");  
  47.         }  
  48.     }  
  49.   
  50.     // 删除数据库表  
  51.     public static void deleteTable(String tableName) throws Exception {  
  52.         // 新建一个数据库管理员  
  53.         HBaseAdmin hAdmin = new HBaseAdmin(conf);  
  54.   
  55.         if (hAdmin.tableExists(tableName)) {  
  56.             // 关闭一个表  
  57.             hAdmin.disableTable(tableName);  
  58.             // 删除一个表  
  59.             hAdmin.deleteTable(tableName);  
  60.             System.out.println("删除表成功");  
  61.   
  62.         } else {  
  63.             System.out.println("删除的表不存在");  
  64.             System.exit(0);  
  65.         }  
  66.     }  
  67.   
  68.     // 添加一条数据  
  69.     public static void addRow(String tableName, String row,  
  70.             String columnFamily, String column, String value) throws Exception {  
  71.         HTable table = new HTable(conf, tableName);  
  72.         Put put = new Put(Bytes.toBytes(row));  
  73.         // 参数出分别:列族、列、值  
  74.         put.add(Bytes.toBytes(columnFamily), Bytes.toBytes(column),  
  75.                 Bytes.toBytes(value));  
  76.         table.put(put);  
  77.     }  
  78.   
  79.     // 删除一条数据  
  80.     public static void delRow(String tableName, String row) throws Exception {  
  81.         HTable table = new HTable(conf, tableName);  
  82.         Delete del = new Delete(Bytes.toBytes(row));  
  83.         table.delete(del);  
  84.     }  
  85.   
  86.     // 删除多条数据  
  87.     public static void delMultiRows(String tableName, String[] rows)  
  88.             throws Exception {  
  89.         HTable table = new HTable(conf, tableName);  
  90.         List<Delete> list = new ArrayList<Delete>();  
  91.   
  92.         for (String row : rows) {  
  93.             Delete del = new Delete(Bytes.toBytes(row));  
  94.             list.add(del);  
  95.         }  
  96.   
  97.         table.delete(list);  
  98.     }  
  99.   
  100.     // get row  
  101.     public static void getRow(String tableName, String row) throws Exception {  
  102.         HTable table = new HTable(conf, tableName);  
  103.         Get get = new Get(Bytes.toBytes(row));  
  104.         Result result = table.get(get);  
  105.         // 输出结果  
  106.         for (KeyValue rowKV : result.raw()) {  
  107.             System.out.print("Row Name: " + new String(rowKV.getRow()) + " ");  
  108.             System.out.print("Timestamp: " + rowKV.getTimestamp() + " ");  
  109.             System.out.print("column Family: " + new String(rowKV.getFamily()) + " ");  
  110.             System.out.print("Row Name:  " + new String(rowKV.getQualifier()) + " ");  
  111.             System.out.println("Value: " + new String(rowKV.getValue()) + " ");  
  112.         }  
  113.     }  
  114.   
  115.     // get all records  
  116.     public static void getAllRows(String tableName) throws Exception {  
  117.         HTable table = new HTable(conf, tableName);  
  118.         Scan scan = new Scan();  
  119.         ResultScanner results = table.getScanner(scan);  
  120.         // 输出结果  
  121.         for (Result result : results) {  
  122.             for (KeyValue rowKV : result.raw()) {  
  123.                 System.out.print("Row Name: " + new String(rowKV.getRow()) + " ");  
  124.                 System.out.print("Timestamp: " + rowKV.getTimestamp() + " ");  
  125.                 System.out.print("column Family: " + new String(rowKV.getFamily()) + " ");  
  126.                 System.out  
  127.                         .print("Row Name:  " + new String(rowKV.getQualifier()) + " ");  
  128.                 System.out.println("Value: " + new String(rowKV.getValue()) + " ");  
  129.             }  
  130.         }  
  131.     }  
  132.   
  133.     // main  
  134.     public static void main(String[] args) {  
  135.         try {  
  136.             String tableName = "users2";  
  137.   
  138.             // 第一步:创建数据库表:“users2”  
  139.             String[] columnFamilys = { "info""course" };  
  140.             OperateTable.createTable(tableName, columnFamilys);  
  141.   
  142.             // 第二步:向数据表的添加数据  
  143.             // 添加第一行数据  
  144.             OperateTable.addRow(tableName, "tht""info""age""20");  
  145.             OperateTable.addRow(tableName, "tht""info""sex""boy");  
  146.             OperateTable.addRow(tableName, "tht""course""china""97");  
  147.             OperateTable.addRow(tableName, "tht""course""math""128");  
  148.             OperateTable.addRow(tableName, "tht""course""english""85");  
  149.             // 添加第二行数据  
  150.             OperateTable.addRow(tableName, "xiaoxue""info""age""19");  
  151.             OperateTable.addRow(tableName, "xiaoxue""info""sex""boy");  
  152.             OperateTable.addRow(tableName, "xiaoxue""course""china""90");  
  153.             OperateTable.addRow(tableName, "xiaoxue""course""math""120");  
  154.             OperateTable  
  155.                     .addRow(tableName, "xiaoxue""course""english""90");  
  156.             // 添加第三行数据  
  157.             OperateTable.addRow(tableName, "qingqing""info""age""18");  
  158.             OperateTable.addRow(tableName, "qingqing""info""sex""girl");  
  159.             OperateTable  
  160.                     .addRow(tableName, "qingqing""course""china""100");  
  161.             OperateTable.addRow(tableName, "qingqing""course""math""100");  
  162.             OperateTable.addRow(tableName, "qingqing""course""english",  
  163.                     "99");  
  164.             // 第三步:获取一条数据  
  165.             System.out.println("获取一条数据");  
  166.             OperateTable.getRow(tableName, "tht");  
  167.             // 第四步:获取所有数据  
  168.             System.out.println("获取所有数据");  
  169.             OperateTable.getAllRows(tableName);  
  170.             // 第五步:删除一条数据  
  171.             System.out.println("删除一条数据");  
  172.             OperateTable.delRow(tableName, "tht");  
  173.             OperateTable.getAllRows(tableName);  
  174.             // 第六步:删除多条数据  
  175.             System.out.println("删除多条数据");  
  176.             String[] rows = { "xiaoxue""qingqing" };  
  177.             OperateTable.delMultiRows(tableName, rows);  
  178.             OperateTable.getAllRows(tableName);  
  179.             // 第八步:删除数据库  
  180.             System.out.println("删除数据库");  
  181.             OperateTable.deleteTable(tableName);  
  182.   
  183.         } catch (Exception err) {  
  184.             err.printStackTrace();  
  185.         }  
  186.     }  
  187. }  

结果:

[java]  view plain copy
  1. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT  
  2. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:host.name=tht  
  3. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.version=1.6.0_45  
  4. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Sun Microsystems Inc.  
  5. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.home=D:\Java\jre6  
  6. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.class.path=。。。。。。。。。。。。  
  7. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.library.path=。。。。。。。。。。。  
  8. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\  
  9. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>  
  10. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:os.name=Windows 7  
  11. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:os.arch=x86  
  12. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:os.version=6.1  
  13. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:user.name=hadoop  
  14. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:user.home=C:\Users\Administrator  
  15. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Client environment:user.dir=D:\workspace\eclipse-workspace-jee-kepler\hadoop-Apps-tht  
  16. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=hconnection  
  17. 13/09/09 22:01:18 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 9608@tht  
  18. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.1.101:2181. Will not attempt to authenticate using SASL (无法定位登录配置)  
  19. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.1.101:2181, initiating session  
  20. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.1.101:2181, sessionid = 0x14102d851f8000b, negotiated timeout = 180000  
  21. 13/09/09 22:01:18 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=catalogtracker-on-org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@ba8602  
  22. 13/09/09 22:01:18 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 9608@tht  
  23. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.1.101:2181. Will not attempt to authenticate using SASL (无法定位登录配置)  
  24. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.1.101:2181, initiating session  
  25. 13/09/09 22:01:18 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.1.101:2181, sessionid = 0x14102d851f8000c, negotiated timeout = 180000  
  26. 13/09/09 22:01:20 INFO zookeeper.ZooKeeper: Session: 0x14102d851f8000c closed  
  27. 13/09/09 22:01:20 INFO zookeeper.ClientCnxn: EventThread shut down  
  28. 13/09/09 22:01:36 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=catalogtracker-on-org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@ba8602  
  29. 13/09/09 22:01:36 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.1.101:2181. Will not attempt to authenticate using SASL (无法定位登录配置)  
  30. 13/09/09 22:01:36 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 9608@tht  
  31. 13/09/09 22:01:36 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.1.101:2181, initiating session  
  32. 13/09/09 22:01:38 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.1.101:2181, sessionid = 0x14102d851f8000d, negotiated timeout = 180000  
  33. 13/09/09 22:01:38 INFO zookeeper.ZooKeeper: Session: 0x14102d851f8000d closed  
  34. 13/09/09 22:01:38 INFO zookeeper.ClientCnxn: EventThread shut down  
  35. 创建表成功  
  36. 获取一条数据  
  37. Row Name: tht Timestamp: 1378735285456 column Family: course Row Name:  china Value: 97   
  38. Row Name: tht Timestamp: 1378735285918 column Family: course Row Name:  english Value: 85   
  39. Row Name: tht Timestamp: 1378735285591 column Family: course Row Name:  math Value: 128   
  40. Row Name: tht Timestamp: 1378735285056 column Family: info Row Name:  age Value: 20   
  41. Row Name: tht Timestamp: 1378735285368 column Family: info Row Name:  sex Value: boy   
  42. 获取所有数据  
  43. Row Name: qingqing Timestamp: 1378735286503 column Family: course Row Name:  china Value: 100   
  44. Row Name: qingqing Timestamp: 1378735286547 column Family: course Row Name:  english Value: 99   
  45. Row Name: qingqing Timestamp: 1378735286524 column Family: course Row Name:  math Value: 100   
  46. Row Name: qingqing Timestamp: 1378735286463 column Family: info Row Name:  age Value: 18   
  47. Row Name: qingqing Timestamp: 1378735286482 column Family: info Row Name:  sex Value: girl   
  48. Row Name: tht Timestamp: 1378735285456 column Family: course Row Name:  china Value: 97   
  49. Row Name: tht Timestamp: 1378735285918 column Family: course Row Name:  english Value: 85   
  50. Row Name: tht Timestamp: 1378735285591 column Family: course Row Name:  math Value: 128   
  51. Row Name: tht Timestamp: 1378735285056 column Family: info Row Name:  age Value: 20   
  52. Row Name: tht Timestamp: 1378735285368 column Family: info Row Name:  sex Value: boy   
  53. Row Name: xiaoxue Timestamp: 1378735286268 column Family: course Row Name:  china Value: 90   
  54. Row Name: xiaoxue Timestamp: 1378735286403 column Family: course Row Name:  english Value: 90   
  55. Row Name: xiaoxue Timestamp: 1378735286343 column Family: course Row Name:  math Value: 120   
  56. Row Name: xiaoxue Timestamp: 1378735286114 column Family: info Row Name:  age Value: 19   
  57. Row Name: xiaoxue Timestamp: 1378735286236 column Family: info Row Name:  sex Value: boy   
  58. 删除一条数据  
  59. Row Name: qingqing Timestamp: 1378735286503 column Family: course Row Name:  china Value: 100   
  60. Row Name: qingqing Timestamp: 1378735286547 column Family: course Row Name:  english Value: 99   
  61. Row Name: qingqing Timestamp: 1378735286524 column Family: course Row Name:  math Value: 100   
  62. Row Name: qingqing Timestamp: 1378735286463 column Family: info Row Name:  age Value: 18   
  63. Row Name: qingqing Timestamp: 1378735286482 column Family: info Row Name:  sex Value: girl   
  64. Row Name: xiaoxue Timestamp: 1378735286268 column Family: course Row Name:  china Value: 90   
  65. Row Name: xiaoxue Timestamp: 1378735286403 column Family: course Row Name:  english Value: 90   
  66. Row Name: xiaoxue Timestamp: 1378735286343 column Family: course Row Name:  math Value: 120   
  67. Row Name: xiaoxue Timestamp: 1378735286114 column Family: info Row Name:  age Value: 19   
  68. Row Name: xiaoxue Timestamp: 1378735286236 column Family: info Row Name:  sex Value: boy   
  69. 删除多条数据  
  70. 删除数据库  
  71. 13/09/09 22:01:40 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=catalogtracker-on-org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@ba8602  
  72. 13/09/09 22:01:40 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 9608@tht  
  73. 13/09/09 22:01:40 INFO zookeeper.ClientCnxn: Opening socket connection to server master/192.168.1.101:2181. Will not attempt to authenticate using SASL (无法定位登录配置)  
  74. 13/09/09 22:01:40 INFO zookeeper.ClientCnxn: Socket connection established to master/192.168.1.101:2181, initiating session  
  75. 13/09/09 22:01:42 INFO zookeeper.ClientCnxn: Session establishment complete on server master/192.168.1.101:2181, sessionid = 0x14102d851f8000e, negotiated timeout = 180000  
  76. 13/09/09 22:01:44 INFO zookeeper.ZooKeeper: Session: 0x14102d851f8000e closed  
  77. 13/09/09 22:01:44 INFO zookeeper.ClientCnxn: EventThread shut down  
  78. 13/09/09 22:01:48 INFO client.HBaseAdmin: Started disable of users2  
  79. 13/09/09 22:01:50 INFO client.HBaseAdmin: Disabled users2  
  80. 13/09/09 22:01:51 INFO client.HBaseAdmin: Deleted users2  
  81. 删除表成功  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值