hbase shell operate
, start hdfs [hadoop@alamps sbin]$ ./start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [alamps]
alamps: starting namenode, logging to /home/hadoop/app/hadoop-2.4./logs/hadoop-hadoop-namenode-alamps.out
alamps: starting datanode, logging to /home/hadoop/app/hadoop-2.4./logs/hadoop-hadoop-datanode-alamps.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /home/hadoop/app/hadoop-2.4./logs/hadoop-hadoop-secondarynamenode-alamps.out
starting yarn daemons
starting resourcemanager, logging to /home/hadoop/app/hadoop-2.4./logs/yarn-hadoop-resourcemanager-alamps.out
alamps: starting nodemanager, logging to /home/hadoop/app/hadoop-2.4./logs/yarn-hadoop-nodemanager-alamps.out
[hadoop@alamps sbin]$ jps
Jps
DataNode
NodeManager
NameNode
SecondaryNameNode
ResourceManager , start hbase
[hadoop@alamps bin]$ ./start-hbase.sh
alamps: starting zookeeper, logging to /home/hadoop/hbase-0.96./bin/../logs/hbase-hadoop-zookeeper-alamps.out
starting master, logging to /home/hadoop/hbase-0.96./bin/../logs/hbase-hadoop-master-alamps.out
localhost: starting regionserver, logging to /home/hadoop/hbase-0.96./bin/../logs/hbase-hadoop-regionserver-alamps.out
[hadoop@alamps bin]$ jps
DataNode
HQuorumPeer
NodeManager
NameNode
Jps
HMaster
SecondaryNameNode
ResourceManager
HRegionServer
[hadoop@alamps bin]$ , hbase shell
=========================
进入hbase命令行
./hbase shell 显示hbase中的表
list hbase(main)::> list
TABLE
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hbase-0.96./lib/slf4j-log4j12-1.6..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.4./share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
row(s) in 1.8360 seconds => []
hbase(main)::> create 'user', 'info1', 'data1'
row(s) in 0.6790 seconds => Hbase::Table - user
hbase(main)::> list
TABLE
user
row(s) in 0.0670 seconds => ["user"]
hbase(main)::> create 'user', {NAME => 'info', VERSIONS => ''} ERROR: Table already exists: user! Here is some help for this command:
Creates a table. Pass a table name, and a set of column family
specifications (at least one), and, optionally, table configuration.
Column specification can be a simple string (name), or a dictionary
(dictionaries are described below in main help output), necessarily
including NAME attribute.
Examples: Create a table with namespace=ns1 and table qualifier=t1
hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => } Create a table with namespace=default and table qualifier=t1
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
hbase> # The above in shorthand would be the following:
hbase> create 't1', 'f1', 'f2', 'f3'
hbase> create 't1', {NAME => 'f1', VERSIONS => , TTL => , BLOCKCACHE => true}
hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => ''}} Table configuration options can be put at the end.
Examples: hbase> create 'ns1:t1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
hbase> create 't1', {NAME => 'f1', VERSIONS => }, METADATA => { 'mykey' => 'myvalue' }
hbase> # Optionally pre-split the table into NUMREGIONS, using
hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit'}
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}} You can also keep around a reference to the created table: hbase> t1 = create 't1', 'f1' Which gives you a reference to the table named 't1', on which you can then
call methods. hbase(main)::> create 'user', {NAME => 'info1', VERSIONS => ''} ERROR: Table already exists: user! Here is some help for this command:
Creates a table. Pass a table name, and a set of column family
specifications (at least one), and, optionally, table configuration.
Column specification can be a simple string (name), or a dictionary
(dictionaries are described below in main help output), necessarily
including NAME attribute.
Examples: Create a table with namespace=ns1 and table qualifier=t1
hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => } Create a table with namespace=default and table qualifier=t1
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
hbase> # The above in shorthand would be the following:
hbase> create 't1', 'f1', 'f2', 'f3'
hbase> create 't1', {NAME => 'f1', VERSIONS => , TTL => , BLOCKCACHE => true}
hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => ''}} Table configuration options can be put at the end.
Examples: hbase> create 'ns1:t1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
hbase> create 't1', {NAME => 'f1', VERSIONS => }, METADATA => { 'mykey' => 'myvalue' }
hbase> # Optionally pre-split the table into NUMREGIONS, using
hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit'}
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}} You can also keep around a reference to the created table: hbase> t1 = create 't1', 'f1' Which gives you a reference to the table named 't1', on which you can then
call methods. hbase(main)::> san 'user'
NoMethodError: undefined method `san' for #<Object:0x689973> hbase(main)::> scan 'user'
ROW COLUMN+CELL
row(s) in 0.0330 seconds hbase(main)::> create 'user', {NAME => 'info1', VERSIONS => ''} ERROR: Table already exists: user! Here is some help for this command:
Creates a table. Pass a table name, and a set of column family
specifications (at least one), and, optionally, table configuration.
Column specification can be a simple string (name), or a dictionary
(dictionaries are described below in main help output), necessarily
including NAME attribute.
Examples: Create a table with namespace=ns1 and table qualifier=t1
hbase> create 'ns1:t1', {NAME => 'f1', VERSIONS => } Create a table with namespace=default and table qualifier=t1
hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'}
hbase> # The above in shorthand would be the following:
hbase> create 't1', 'f1', 'f2', 'f3'
hbase> create 't1', {NAME => 'f1', VERSIONS => , TTL => , BLOCKCACHE => true}
hbase> create 't1', {NAME => 'f1', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => ''}} Table configuration options can be put at the end.
Examples: hbase> create 'ns1:t1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS => ['', '', '', '']
hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
hbase> create 't1', {NAME => 'f1', VERSIONS => }, METADATA => { 'mykey' => 'myvalue' }
hbase> # Optionally pre-split the table into NUMREGIONS, using
hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit'}
hbase> create 't1', 'f1', {NUMREGIONS => , SPLITALGO => 'HexStringSplit', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}} You can also keep around a reference to the created table: hbase> t1 = create 't1', 'f1' Which gives you a reference to the table named 't1', on which you can then
call methods. hbase(main)::> put 'user', 'rk0001', 'info:name', 'zhangsan' ERROR: Failed action: org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException: Column family info does not exist in region user,,.7dafe6d1353a5be73a69aa03ffdbe8d3. in table 'user', {NAME => 'data1', BLOOMFILTER => 'ROW', VERSIONS => '', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'false', DATA_BLOCK_ENCODING => 'NONE', TTL => '', COMPRESSION => 'NONE', MIN_VERSIONS => '', BLOCKCACHE => 'true', BLOCKSIZE => '', REPLICATION_SCOPE => ''}, {NAME => 'info1', BLOOMFILTER => 'ROW', VERSIONS => '', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'false', DATA_BLOCK_ENCODING => 'NONE', TTL => '', COMPRESSION => 'NONE', MIN_VERSIONS => '', BLOCKCACHE => 'true', BLOCKSIZE => '', REPLICATION_SCOPE => ''}
at org.apache.hadoop.hbase.regionserver.HRegionServer.doBatchOp(HRegionServer.java:)
at org.apache.hadoop.hbase.regionserver.HRegionServer.doNonAtomicRegionMutation(HRegionServer.java:)
at org.apache.hadoop.hbase.regionserver.HRegionServer.multi(HRegionServer.java:)
at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$.callBlockingMethod(ClientProtos.java:)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:)
at org.apache.hadoop.hbase.ipc.RpcServer$Handler.run(RpcServer.java:)
: time, Here is some help for this command:
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates. To put a cell value into table 'ns1:t1' or 't1'
at row 'r1' under column 'c1' marked with the time 'ts1', do: hbase> put 'ns1:t1', 'r1', 'c1', 'value', ts1 The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be: hbase> t.put 'r1', 'c1', 'value', ts1 hbase(main)::> put 'user', 'rk0001', 'info1:name', 'zhangsan'
row(s) in 0.0050 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
row(s) in 0.0330 seconds hbase(main)::> delete 'user' ERROR: wrong number of arguments ( for ) Here is some help for this command:
Put a delete cell value at specified table/row/column and optionally
timestamp coordinates. Deletes must match the deleted cell's
coordinates exactly. When scanning, a delete cell suppresses older
versions. To delete a cell from 't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do: hbase> delete 'ns1:t1', 'r1', 'c1', ts1
hbase> delete 't1', 'r1', 'c1', ts1 The same command can also be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be: hbase> t.delete 'r1', 'c1', ts1 hbase(main)::> list
TABLE
user
row(s) in 0.0580 seconds => ["user"]
hbase(main)::> delete 'user' ERROR: wrong number of arguments ( for ) Here is some help for this command:
Put a delete cell value at specified table/row/column and optionally
timestamp coordinates. Deletes must match the deleted cell's
coordinates exactly. When scanning, a delete cell suppresses older
versions. To delete a cell from 't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do: hbase> delete 'ns1:t1', 'r1', 'c1', ts1
hbase> delete 't1', 'r1', 'c1', ts1 The same command can also be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be: hbase> t.delete 'r1', 'c1', ts1 hbase(main)::> delete user
NameError: undefined local variable or method `user' for #<Object:0x689973> hbase(main)::> disable 'user'
row(s) in 2.7590 seconds hbase(main)::> delete 'user' ERROR: wrong number of arguments ( for ) Here is some help for this command:
Put a delete cell value at specified table/row/column and optionally
timestamp coordinates. Deletes must match the deleted cell's
coordinates exactly. When scanning, a delete cell suppresses older
versions. To delete a cell from 't1' at row 'r1' under column 'c1'
marked with the time 'ts1', do: hbase> delete 'ns1:t1', 'r1', 'c1', ts1
hbase> delete 't1', 'r1', 'c1', ts1 The same command can also be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be: hbase> t.delete 'r1', 'c1', ts1 hbase(main)::> scan 'user'
ROW COLUMN+CELL ERROR: user is disabled. Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications. Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family:'. The filter can be specified in two ways:
. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE- JIRA
. Using the entire package name of the filter. Some examples: hbase> scan 'hbase:meta'
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [, ]}
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( , ))"}
hbase> scan 't1', {FILTER =>
org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(, )} For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false). By
default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} Also for experts, there is an advanced option -- RAW -- which instructs the
scanner to return all cells (including delete markers and uncollected deleted
cells). This option cannot be combined with requesting specific COLUMNS.
Disabled by default. Example: hbase> scan 't1', {RAW => true, VERSIONS => } Besides the default 'toStringBinary' format, 'scan' supports custom formatting
by column. A user can define a FORMATTER by adding it to the column name in
the scan specification. The FORMATTER can be stipulated: . either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'. Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
hbase> scan 't1', {COLUMNS => ['cf:qualifier1:toInt',
'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] } Note that you can specify a FORMATTER by column only (cf:qualifer). You cannot
specify a FORMATTER for all columns of a column family. Scan can also be used directly from a table, by first getting a reference to a
table, like such: hbase> t = get_table 't'
hbase> t.scan Note in the above situation, you can still provide all the filtering, columns,
options, etc as described above. hbase(main)::> scan 'user'
ROW COLUMN+CELL ERROR: user is disabled. Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications. Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family:'. The filter can be specified in two ways:
. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE- JIRA
. Using the entire package name of the filter. Some examples: hbase> scan 'hbase:meta'
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [, ]}
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( , ))"}
hbase> scan 't1', {FILTER =>
org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(, )} For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false). By
default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} Also for experts, there is an advanced option -- RAW -- which instructs the
scanner to return all cells (including delete markers and uncollected deleted
cells). This option cannot be combined with requesting specific COLUMNS.
Disabled by default. Example: hbase> scan 't1', {RAW => true, VERSIONS => } Besides the default 'toStringBinary' format, 'scan' supports custom formatting
by column. A user can define a FORMATTER by adding it to the column name in
the scan specification. The FORMATTER can be stipulated: . either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'. Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
hbase> scan 't1', {COLUMNS => ['cf:qualifier1:toInt',
'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] } Note that you can specify a FORMATTER by column only (cf:qualifer). You cannot
specify a FORMATTER for all columns of a column family. Scan can also be used directly from a table, by first getting a reference to a
table, like such: hbase> t = get_table 't'
hbase> t.scan Note in the above situation, you can still provide all the filtering, columns,
options, etc as described above. hbase(main)::> enable 'user'
row(s) in 0.6160 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
row(s) in 0.0670 seconds hbase(main)::> put 'user', 'rk0001', 'info1:gender', 'female'
row(s) in 0.0130 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
row(s) in 0.0360 seconds hbase(main)::> put 'user', 'rk0001', 'info1:age',
row(s) in 0.0250 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
row(s) in 0.0290 seconds Here is some help for this command:
Put a cell 'value' at specified table/row/column and optionally
timestamp coordinates. To put a cell value into table 'ns1:t1' or 't1'
at row 'r1' under column 'c1' marked with the time 'ts1', do: hbase> put 'ns1:t1', 'r1', 'c1', 'value', ts1 The same commands also can be run on a table reference. Suppose you had a reference
t to table 't1', the corresponding command would be: hbase> t.put 'r1', 'c1', 'value', ts1 hbase(main)::> put 'user', 'rk0001', 'data1:pic', 'picture'
row(s) in 0.0080 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
row(s) in 0.0270 seconds hbase(main)::> get 'user' rk001
SyntaxError: (hbase):: syntax error, unexpected tIDENTIFIER get 'user' rk001
^ hbase(main)::> get 'user', 'rk0001'
COLUMN CELL
data1:pic timestamp=, value=picture
info1:age timestamp=, value=
info1:gender timestamp=, value=female
info1:name timestamp=, value=zhangsan
row(s) in 0.0650 seconds hbase(main)::> get 'user', 'rk0001', 'info1'
COLUMN CELL
info1:age timestamp=, value=
info1:gender timestamp=, value=female
info1:name timestamp=, value=zhangsan
row(s) in 0.0390 seconds hbase(main)::> get 'user', 'rk0001', 'info1:name', 'info1:age'
COLUMN CELL
info1:age timestamp=, value=
info1:name timestamp=, value=zhangsan
row(s) in 0.0260 seconds hbase(main)::> get 'user', 'rk0001', 'info1', 'data1'
COLUMN CELL
data1:pic timestamp=, value=picture
info1:age timestamp=, value=
info1:gender timestamp=, value=female
info1:name timestamp=, value=zhangsan
row(s) in 0.0220 seconds hbase(main)::> get 'user', 'rk0001', {COLUMN => ['info1', 'data1']}
COLUMN CELL
data1:pic timestamp=, value=picture
info1:age timestamp=, value=
info1:gender timestamp=, value=female
info1:name timestamp=, value=zhangsan
row(s) in 0.0200 seconds hbase(main)::> get 'user', 'rk0001', {COLUMN => ['info1:name', 'data1:pic']}
COLUMN CELL
data1:pic timestamp=, value=picture
info1:name timestamp=, value=zhangsan
row(s) in 0.0400 seconds hbase(main)::> get 'user', 'rk0001', {COLUMN => 'info1:name', VERSIONS => }
COLUMN CELL
info1:name timestamp=, value=zhangsan
row(s) in 0.0130 seconds hbase(main)::> get 'user', 'rk0001', {FILTER => "ValueFilter(=, 'binary:图片')"}
COLUMN CELL
row(s) in 0.0750 seconds hbase(main)::> get 'user', 'rk0001', {FILTER => "(QualifierFilter(=,'substring:a'))"}
COLUMN CELL
info1:age timestamp=, value=
info1:name timestamp=, value=zhangsan
row(s) in 0.0290 seconds hbase(main)::> put 'user', 'rk0002', 'info1:name', 'fanbingbing'
row(s) in 0.0110 seconds hbase(main)::> put 'user', 'rk0002', 'info1:gender', 'female'
row(s) in 0.0040 seconds hbase(main)::> put 'user', 'rk0002', 'info1:nationality', '中国'
row(s) in 0.0130 seconds hbase(main)::> get surscan 'user'
NoMethodError: undefined method `surscan' for #<Object:0x689973> hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0280 seconds hbase(main)::> scan 'user'
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0330 seconds hbase(main)::> get 'user', 'rk0002', {FILTER => "ValueFilter(=, 'binary:中国')"}
COLUMN CELL
info1:nationality timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0130 seconds hbase(main)::> scan 'user', {COLUMNS => 'info'}
ROW COLUMN+CELL ERROR: Unknown column family! Valid column names: data1:*, info1:* Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications. Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family:'. The filter can be specified in two ways:
. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE- JIRA
. Using the entire package name of the filter. Some examples: hbase> scan 'hbase:meta'
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [, ]}
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( , ))"}
hbase> scan 't1', {FILTER =>
org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(, )} hbase(main)::> scan 'user', {COLUMNS => 'info1'}
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0570 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1', RAW => true, VERSIONS => }
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0280 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1', RAW => true, VERSIONS => }
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0360 seconds hbase(main)::> scan 'user', {COLUMNS => ['info1', 'data1']}
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0270 seconds hbase(main)::> scan 'user', {COLUMNS => ['info1:name', 'data1:pic']}
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
row(s) in 0.0380 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1:name'}
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
row(s) in 0.0200 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1:name', VERSIONS => }
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
row(s) in 0.0250 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1:name', VERSIONS => }
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
row(s) in 0.0230 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1:name', VERSIONS => }
ROW COLUMN+CELL
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
row(s) in 0.0230 seconds hbase(main)::> scan 'people', {COLUMNS => ['info1', 'data1'], FILTER => "(QualifierFilter(=,'substring:a'))"} ERROR: Unknown table people! Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications. Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE If no columns are specified, all columns will be scanned.
To scan all members of a column family, leave the qualifier empty as in
'col_family:'. The filter can be specified in two ways:
. Using a filterString - more information on this is available in the
Filter Language document attached to the HBASE- JIRA
. Using the entire package name of the filter. Some examples: hbase> scan 'hbase:meta'
hbase> scan 'hbase:meta', {COLUMNS => 'info:regioninfo'}
hbase> scan 'ns1:t1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => , STARTROW => 'xyz'}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [, ]}
hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND
(QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( , ))"}
hbase> scan 't1', {FILTER =>
org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(, )} For experts, there is an additional option -- CACHE_BLOCKS -- which
switches block caching for the scanner on (true) or off (false). By
default it is enabled. Examples: hbase> scan 't1', {COLUMNS => ['c1', 'c2'], CACHE_BLOCKS => false} Also for experts, there is an advanced option -- RAW -- which instructs the
scanner to return all cells (including delete markers and uncollected deleted
cells). This option cannot be combined with requesting specific COLUMNS.
Disabled by default. Example: hbase> scan 't1', {RAW => true, VERSIONS => } Besides the default 'toStringBinary' format, 'scan' supports custom formatting
by column. A user can define a FORMATTER by adding it to the column name in
the scan specification. The FORMATTER can be stipulated: . either as a org.apache.hadoop.hbase.util.Bytes method name (e.g, toInt, toString)
. or as a custom class followed by method name: e.g. 'c(MyFormatterClass).format'. Example formatting cf:qualifier1 and cf:qualifier2 both as Integers:
hbase> scan 't1', {COLUMNS => ['cf:qualifier1:toInt',
'cf:qualifier2:c(org.apache.hadoop.hbase.util.Bytes).toInt'] } Note that you can specify a FORMATTER by column only (cf:qualifer). You cannot
specify a FORMATTER for all columns of a column family. Scan can also be used directly from a table, by first getting a reference to a
table, like such: hbase> t = get_table 't'
hbase> t.scan Note in the above situation, you can still provide all the filtering, columns,
options, etc as described above. hbase(main)::> scan 'user', {COLUMNS => ['info1', 'data1'], FILTER => "(QualifierFilter(=,'substring:a'))"}
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0220 seconds hbase(main)::> scan 'user', {COLUMNS => 'info1', STARTROW => 'rk0001', ENDROW => 'rk0003'}
ROW COLUMN+CELL
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0250 seconds hbase(main)::> scan 'user',{FILTER=>"PrefixFilter('rk')"}
ROW COLUMN+CELL
rk0001 column=data1:pic, timestamp=, value=picture
rk0001 column=info1:age, timestamp=, value=
rk0001 column=info1:gender, timestamp=, value=female
rk0001 column=info1:name, timestamp=, value=zhangsan
rk0002 column=info1:gender, timestamp=, value=female
rk0002 column=info1:name, timestamp=, value=fanbingbing
rk0002 column=info1:nationality, timestamp=, value=\xE4\xB8\xAD\xE5\x9B\xBD
row(s) in 0.0430 seconds hbase(main)::> [hadoop@alamps sbin]$ scan 'user', {TIMERANGE => [, ]}
-bash: scan: command not found
[hadoop@alamps sbin]$ scan 'user', {TIMERANGE => []}
-bash: scan: command not found
[hadoop@alamps sbin]$ delete 'user', 'rk0001', 'info:name'
-bash: delete: command not found
[hadoop@alamps sbin]$ delete 'user', 'rk0001', 'info1:name'
-bash: delete: command not found
[hadoop@alamps sbin]$ delete 'user', 'rk0001', 'info1:name'
-bash: delete: command not found
[hadoop@alamps sbin]$ truncate 'user'
truncate: you must specify one of `--size' or `--reference'
Try `truncate --help' for more information.
[hadoop@alamps sbin]$ truncate 'user'
truncate: you must specify one of `--size' or `--reference'
Try `truncate --help' for more information.
[hadoop@alamps sbin]$ alter 'user', NAME => 'f2'
-bash: alter: command not found
[hadoop@alamps sbin]$ alter 'user', NAME => 'f1', METHOD => 'delete'
-bash: alter: command not found
[hadoop@alamps sbin]$ drop 'user'
-bash: drop: command not found
[hadoop@alamps sbin]$ get 'user', 'rk0002', {COLUMN => ['info1:name', 'data1:pic']}
-bash: get: command not found
[hadoop@alamps sbin]$ get 'user', 'rk0001', {COLUMN => ['info1:name', 'data1:pic']}
-bash: get: command not found
[hadoop@alamps sbin]$ get 'user'
-bash: get: command not found
[hadoop@alamps sbin]$ hbase shell
-- ::, INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.96.-hadoop2, r1581096, Mon Mar :: PDT hbase(main)::> get 'user', 'rk0002', {COLUMN => ['info1:name', 'data1:pic']}
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hbase-0.96./lib/slf4j-log4j12-1.6..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.4./share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
COLUMN CELL
info1:name timestamp=, value=fanbingbing
row(s) in 0.0750 seconds hbase(main)::> list
TABLE
user
row(s) in 0.1340 seconds => ["user"]
hbase(main)::> get 'user'
hbase shell operate的更多相关文章
- HBASE SHELL 命令使用
HBASE SHELL命令的使用 在hbase shell客户端有许多的操作命令,今天回顾并且总结一二,希望和广大读者共同进步,并且悉心聆听你们的意见.在此的hbase版本是:HBase 1.2.0- ...
- HBase ——Shell操作
HBase --Shell操作 Q:你觉得HBase是什么? A:一种结构化的分布式数据存储系统,它基于列来存储数据. 基于HBase,可以实现以廉价PC机器集群存储海量数据的分布式数据库的解决方案. ...
- HBase Shell操作
Hbase 是一个分布式的.面向列的开源数据库,其实现是建立在google 的bigTable 理论之上,并基于hadoop HDFS文件系统. Hbase不同于一般的关系型数据库(RDBMS ...
- HBase Shell 常用命令及例子
下面我们看看HBase Shell的一些基本操作命令,我列出了几个常用的HBase Shell命令,如下: 名称 命令表达式 创建表 create '表名称', '列名称1','列名称2','列名称N ...
- hbase shell command
进入hbase shell console $HBASE_HOME/bin/hbase shell 如果有kerberos认证,需要事先使用相应的keytab进行一下认证(使用kinit命令),认证成 ...
- hbase shell基础和常用命令详解(转)
HBase shell的基本用法 hbase提供了一个shell的终端给用户交互.使用命令hbase shell进入命令界面.通过执行 help可以看到命令的帮助信息. 以网上的一个学生成绩表的例子来 ...
- hbase shell 基本命令总结
访问hbase,以及操作hbase,命令不用使用分号hbase shell 进入hbase list 查看表hbase shell -d hbase(main):024:0> scan '.ME ...
- hbase shell 常用命令
进入hbase shell console$HBASE_HOME/bin/hbase shell如果有kerberos认证,需要事先使用相应的keytab进行一下认证(使用kinit命令),认证成功之 ...
- Hbase Shell常用命令
hbase shell常用的操作命令有create,describe,disable,drop,list,scan,put,get,delete,deleteall,count,status等,通过h ...
随机推荐
- ionic使用cordova插件中的Screenshot截图分享功能
需要实现操作,考试完成后需要将成绩生成一张图片,分享出去, import { Screenshot } from '@ionic-native/screenshot'; constructor(pri ...
- java登录怎么做
(一)1.先查找有没当前用户.2.对比用户名和密码3.返回用户信息 @Override public AppResultEntity userLogin(String username, String ...
- 解决pathForResource返回nil, 无法读取plist文件问题
有很多人在设置plist文件的时候, 会发现读取不了plist文件里面的内容, 返回值为nil, 下面我们来解决一下这个问题. 首先我们打开工程并且按照下面的步骤来设置: 设置好后, 我们来写一段代码 ...
- [性能优化] perf
运行时性能分析工具 wiki:https://en.wikipedia.org/wiki/Perf_(Linux) linux wiki:https://perf.wiki.kernel.org/in ...
- [development][dpdk][hugepage] 大页内存的挂载
参考: [development][dpdk][hugepage] 为不同的结点分配不同大小的大页内存 完成了以上内容之后, 下一步需要做的是挂载, 大页内存只有被挂载了之后,才能被应用程序使用. 挂 ...
- javaweb连接数据库并完成增删改查
一.连接数据库 1.mysql数据库的安装和配置 在网上找到了篇关于mysql的安装详细说明,供读者自己学习 https://www.jb51.net/article/23876.htm 2.mysq ...
- java web指定主页
正常情况下主页是在web.xml里面配置欢迎页面,可以加个过滤器重定向就可以: public void doFilter(ServletRequest req, ServletResponse res ...
- Apache SSL 服务搭建
Web服务器在默认情况下使用HTTP,这是一个纯文本的协议.正如其名称所暗示的,纯文本协议不会对传输中的数据进行任何形式的加密.而基于HTTP的Web服务器是非常容易配置,它在安全方面有重大缺陷.任何 ...
- 转: js实现全角半角检测的方法
//全角半角校验 function issbccase(strTmp) { for (var i=0; i<strTmp.length; i++) { if (strTmp.charCodeAt ...
- discuz config_global.php文件设置说明
<?php $_config = array(); // ---------------------------- CONFIG DB ----------------------------- ...