Start, close HBase
./bin/start-hbase.sh
./bin/stop-hbase.sh
Query the HBase version. Its syntax is as follows:
HBase (main):010:0> version
Build table
Create ' <table name> ', ' <column family> '
Create ' emp ', ' personal data ', ' professional data '
List all tables: List
Table Space:
Create_namespace ' name '
With the put command, you can insert rows into a table. Its syntax is as follows:
Put ' <namespace:table name> ', ' row1 ', ' <colfamily:colname> ', ' <value> '
(Table space name is not required)
Put ' emp ', ' 1 ', ' personal data:name ', ' Raju '
Put ' emp ', ' 1 ', ' personal data:city ', ' Hyderabad '
Put ' emp ', ' 1 ', ' professional data:designation ', ' manager '
Put ' emp ', ' 1 ', ' professional data:salary ', ' 50000 '
Put ' emp ', ' 2 ', ' personal data:name ', ' Mike '
Put ' emp ', ' 2 ', ' personal data:city ', ' Nanjing '
Put ' emp ', ' 2 ', ' Professional data:designation ', ' CEO '
Put ' emp ', ' 2 ', ' Professional data:salary ', ' 99000 '
To query all the data in a table:
HBase (main):026:0> scan ' emp '
ROW Column+cell
1 column=personal data:city, timestamp=1510047547743, Value=hyderabad
1 column=personal data:name, timestamp=1510047519200, Value=raju
1 column=professional data:designation, timestamp=1510047567498, Value=manager
1 column=professional data:salary, timestamp=1510047577830, value=50000
2 column=personal data:city, timestamp=1510047806635, value=nanjing
2 column=personal data:name, timestamp=1510047795408, Value=mike
2 column=professional data:designation, timestamp=1510047812168, Value=ceo
2 column=professional data:salary, timestamp=1510047818080, value=99000
2 row (s) in 0.0240 seconds
Use the Get command to get a row of data. Its syntax is as follows:
Get ' <table name> ', ' row1 '
Get ' emp ', ' 1 '
Use the Get method to read the specified column:
Hbase>get ' table name ', ' rowID ', {column = ' column Family:column name '}
Get ' emp ', ' 2 ', {column=> ' personal data:name '}
Hbase Shell Data Operating instructions