zoukankan      html  css  js  c++  java
  • HBase命令(二) -- 表操作

    创建表 

    hbase shell> create 'mytable','col1','col2'   //建表语句  create '表名','列簇名','列簇名','列簇名'
    
    
    hbase shell> create 'mytable',{NAME => 'info',versionS => 1, TTL => 214783647, BLOCKCACHE => false,IN_MEMORY=>false},{NAME=>'tempData',VERSIONS=>1,TTL=>259200,BLOCKCACHE=>false,IN_MEMORY=>false}

    查询    

    //列出所有表
    hbase shell> list   
    
    //查看表结构
    hbase shell> describe 'mytable'   //查看表的结构构造

    修改表结构

    //修改表的结构..删除某列簇
    //删除表中的列簇  注: 要求先disable 表,,修改后enable表
    //请严格区分大小写
    hbase shell> disable 'mytable'
    hbase shell> alter 'mytable',{NAME=>'ct',METHOD=>'delete'}
    hbase shell> enable 'mytable'
    
    //修改表结构 新增一个列簇
    //请严格区分大小写
    hbase shell> disable 'mytable'
    hbase shell> alter 'mytable',{NAME=>'columnsfamilyName',VERSIONS=>1}
    hbase shell> enable 'mytable'

    删除 

    //删除表
    hbase shell> disable 'mytable'   //先禁用表 分离
    hbase shell> drop 'table'        //删除表

    表重命名

    hbase shell> disable 'mytable'    //停用表
    
    hbase shell> snapshot 'mytable', 'tableSnapshot'  //为表创建快照..这时还没有复制数据
    
    hbase shell> clone_snapshot 'tableSnapshot', 'newTableName'  //根据某个快照而创建新表..此时复制数据
    
    hbase shell> delete_snapshot 'tableSnapshot'  //删除快照
    
    hbase shell> drop 'mytable'   //删除原来的表
  • 相关阅读:
    Http请求头与响应头
    获取ip位置方法
    简单的Http Server实现
    HTTP
    long、int与byte数组之间的相互转换
    GlusterFS简单配置
    创建线程池
    网络编程socket
    面向对象-进阶篇
    面向对象-初级篇
  • 原文地址:https://www.cnblogs.com/iiwen/p/5453908.html
Copyright © 2011-2022 走看看