Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Good programmer big data Learning Route sharing Hbase instruction Learning

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Good programmer big data Learning Route sharing Hbase instruction Learning

Start:

1. Start zk zkServer.sh start

2. Start hdfs start-dfs.sh

3. Start the hbase service start-hbase.sh

(start the kill QuorumPeerMain process if the error is reported, and restart it)

4 start the client: hbase shell

The time must be synchronized, or there will be an error.

Array range range of TIMERANGE= > [xxxxx,xxxxx] timestamps

TIMESTAMP= > xxxxx timestamp singular stamp flag

Xy02:16010

Xy02:16010

Hbase has no concept of library, belongs to no schema, but has the concept of namespace (namespace is equivalent to library) and group (equivalent to table).

Hbase has two groups by default: Deflult and Hbase

List displays tables in hbase

-

Increase

Create 'user',' info', 'data' creates the user table, which contains two column families, info and data, and defaults to (default)

Create 'ns1:user',' info', 'data' built user under ns1 (namesqpce)

Create 'user1', {NAME= >' info',BLOOMFILTER = > 'ROWCOL',VERSIONS = >' 2'}

Alter 'user1', {NAME= >' data',BLOOMFILTER = > 'ROWCOL',VERSIONS = >' 2'}

(some are updated and changed, others are added. You can use alter to add data column clusters)

Create 'user2',' F1, SPLITS = > ['10','20','30','40']-- assign in advance the scope of the rowkey under the jurisdiction of region

Insert data: (multiple columns cannot be inserted at once)

Put 'user','rk01','info:name','xuyu'

Put 'user','rk01','info:age','18'

Put 'user','rk01','info:sex','boy'

Put 'user','rk01','data:pic','picture'

Update data

When put 'user','rk01','info:name','xuyu1111' queries, name becomes xuyu1111.

-

Delete (disable the table when deleting the entire table, just as the file cannot be renamed when it is opened)

1disable 'test' disables the test table

2drop 'test' deletes the test table

3list found that the test table had been deleted

4 enable 'user' enable table

Delete column clusters:

Alter 'user1', NAME = >' info', METHOD = > 'delete'

Alter 'user1',' delete' = > 'info'

Delete data

Delete 'user','rk01','info:name' Delete name

Delete 'user',' rk01', 'info:name', 1534126109598 Delete name with a timestamp of xxx

Delete the specified version: (delete the version up)

Delete 'user','rk01','info:name',TIMESTAMP= > 1534138686498

Table judgment:

Exists' user' judgment table

Disable 'user' disable list

Enable 'user' opens the table

Desc 'user' displays the attribute information of the table

Statistical tables: (poor statistical efficiency, not recommended)

Count 'user'

Clear the table:

Truncate 'user'

-

Change (disable the table when renaming the entire table, just as the file cannot be renamed when it is opened)

1disable 'user'

Some will be updated and none will be added.

Alter 'user', NAME = >' F1'

Alter 'user1', {NAME= >' data',BLOOMFILTER = > 'ROWCOL',VERSIONS = >' 2'}

-

Check

Describe 'user' will display a series of attribute information such as name=data,name=info.

Table scan (scan)

Scan 'user' scans the table and displays the content data in the table

Scan 'user', {COLUMNS = > [' info:name','info:age']} scan the specified section

Set query conditions: (the head of the packet is not covered with the tail)

Scan 'user', {COLUMNS = > [' info:name','info:age'], STARTROW= > 'rk00002',LIMIT= > 2}

Scan 'user', {COLUMNS = > [' info:name','info:age'], STARTROW= > 'rk01',ENDROW= >' rk04',LIMIT= > 2}

Note: the startrow and endrow here are only rowkey (equivalent to primary keys)

Query data: (GET)

Get 'user','rk01' gets all the data

Get 'user','rk01', {TIMESTAMP= > 1534126755704}

Get 'user','rk01','info' gets the column cluster as info data

Get 'user','rk01','data' gets the column cluster as data data

Get 'user','rk01','info:name' only gets the name in info

Get the information that row key is rk0001,info and data column family in user table

Get 'user',' rk01', 'info',' data' to get info and data data

Get 'user','rk01', {COLUMN= > [' info','data']}

Get 'user',' rk01', {COLUMN = > ['info:name',' data:pic']}

Get the information that the row key is rk0001, the column family is info and the version number is the latest 5 in the user table

Get 'user',' rk01', {COLUMN = > 'info', VERSIONS = > 2}

Get 'user',' rk01', {COLUMN = > 'info:name', VERSIONS = > 5}

Get 'user',' rk01', {COLUMN = > 'info:name', VERSIONS = > 5Magna timeframe = > [1534123523054 Magi xxxxxxxxxxxxxx]} get the name of the two timestamps in the five version numbers

-

Operations under Namespace

List_namespace lists all the namespace (equivalent to libraries), with two groups by default: default and hbase

Create_namespace 'ns1' creates a namespace named ns1 (equivalent to a library)

Create 'ns1:user',' info', 'data' built user under ns1 (namesqpce), adding ns1 before user:

List_namespace_tables' ns1' view the table under ns1

Alter_namespace 'ns1', {METHOD = >' set', 'NAME' = >' gjz1'} modification

Alter_namespace 'ns1', {METHOD = >' unset', NAME = > 'NAME'} delete

Drop_namespace 'ns1' # only one empty namespace can be deleted

Describe_namespace 'ns1' to view content description

-

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report