大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
操作环境:
成都创新互联是一家专注于成都网站设计、成都网站建设与策划设计,西盟网站建设哪家好?成都创新互联做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:西盟等地区。西盟做网站价格咨询:18980820575操作系统:Ubuntu 16.04.6 LTS
HBase版本:HBase 1.1.5
HBase是一个高可靠、高性能、面向列、可伸缩的分布式数据库,主要用来存储非结构化和半结构化的松散数据。
hadoop@dblab:/usr/local/hadoop$ cd /usr/local/hbase
hadoop@dblab:/usr/local/hbase$ bin/start-hbase.sh #启动HBase
hadoop@dblab:/usr/local/hbase$ bin/hbase shell #进入Shell模式
#创建student表
hbase(main):001:0> create 'student','Sname','Ssex','Sage','Sdept','course'
0 row(s) in 1.6440 seconds
=> Hbase::Table - student
#查看数据库中已经创建的表
hbase(main):002:0> list
TABLE
student
1 row(s) in 0.0410 seconds
=> ["student"]
#查看表结构
hbase(main):003:0> describe 'student'
Table student is ENABLED
student
COLUMN FAMILIES DESCRIPTION
{NAME => 'Sage', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => '
NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE =>
'0'}
{NAME => 'Sdept', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING =>
'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE =
> '0'}
{NAME => 'Sname', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING =>
'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE =
> '0'}
{NAME => 'Ssex', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => '
NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE =>
'0'}
{NAME => 'course', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING =>
'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE
=> '0'}
5 row(s) in 0.1650 seconds
#向表中添加数据
hbase(main):004:0> put 'student','95001','Sname','LiYing'
hbase(main):004:0> put 'student','95001','Sname','LiYing'
hbase(main):005:0> put 'student','95001','Ssex','male'
hbase(main):006:0> put 'student','95001','Sage','22'
hbase(main):007:0> put 'student','95001','Sdept','Cs'
hbase(main):008:0> put 'student','95001','Course:math','80'
ERROR: Unknown column family! Valid column names: Sage:*, Sdept:*, Sname:*, Ssex:*, course:*
hbase(main):009:0> put 'student','95001','course:math','80'
0 row(s) in 0.0330 seconds
#查看某个单元格数据
hbase(main):010:0> get 'student','95001'
COLUMN CELL
Sage: timestamp=1558580423554, value=22
Sdept: timestamp=1558580447276, value=Cs
Sname: timestamp=1558580336295, value=LiYing
Ssex: timestamp=1558580402507, value=male
course:math timestamp=1558580543129, value=80
5 row(s) in 0.0850 seconds
#查询表中有数据所
hbase(main):011:0> scan 'student'
ROW COLUMN+CELL
95001 column=Sage:, timestamp=1558580423554, value=22
95001 column=Sdept:, timestamp=1558580447276, value=Cs
95001 column=Sname:, timestamp=1558580336295, value=LiYing
95001 column=Ssex:, timestamp=1558580402507, value=male
95001 column=course:math, timestamp=1558580543129, value=80
1 row(s) in 0.0740 seconds
#删除95001行中的Ssex列的所有数据
hbase(main):014:0> delete 'student','95001','Ssex'
hbase(main):015:0> scan 'student'
ROW COLUMN+CELL
95001 column=Sage:, timestamp=1558580423554, value=22
95001 column=Sdept:, timestamp=1558580447276, value=Cs
95001 column=Sname:, timestamp=1558580336295, value=LiYing
95001 column=course:math, timestamp=1558580543129, value=80
#删除表中为95001行的全部数据
hbase(main):016:0> deleteall 'student','95001'
0 row(s) in 0.0390 seconds
#该表中所存在任何数据
hbase(main):017:0> scan 'student'
ROW COLUMN+CELL
#删除表
hbase(main):006:0> disable 'student'
hbase(main):009:0> drop 'student'
#退出数据库操作
hbase(main):018:0> exit
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。