Step 1 - download hbase 1.4.
9 under downloads folder
Step 2 - create 3 folders in your C drive - zookeeper,hbasesetup,Hfile
Step 3 - extract using the same method ,put content inside the hbasesetup folder.
Step 4 - set env variables and also path
step 5 - CONFIGURE HBASE-SITE AND HBASE-ENV
cd C:\hadoopsetup\hadoop-3.2.4\sbin
./start-all.cmd
jps
**HMaster refers to the master server that manages the entire HBase cluster.
cd C:\hbasesetup\hbase-1.4.9-bin\hbase-1.4.9\bin
./start-hbase.cmd
jps ( daemon for hbase will be available i.e HMaster)
hbase shell
****************COMMMANDS*******************
1 ) status -- Displays cluster status summary.
2 ) status 'simple' -- Shows a simplified status of the HBase cluster.
3 ) status 'detailed' -- Provides detailed info about each region server.
4 ) version -- Displays the current version of HBase.
5 ) table_help -- Lists table-related commands and syntax help.
6 ) whoami -- Displays the current HBase shell user.
7 ) create 'sample_table','colfam' -- Creates a new table with one column family.
In HBase, colfam (short for column family) is a logical grouping of columns in
a table. Every column in HBase belongs to a column family, and this grouping is
defined when you create a table.
8 ) list -- Lists all tables in HBase.
9 ) describe 'sample_table' -- Shows schema of a given table.
10 ) disable 'sample_table' -- Disables the table to allow deletion or alteration.
Check using the describe command
11 ) enable 'sample_table' -- Re-enables a previously disabled table.
12 ) drop 'sample_table' -- Deletes a disabled table.
13.1 ) create 'test_table','colfam1'
describe 'test_table'
13.2 ) alter 'test_table',{NAME => 'colfam2'}
describe 'test_table'
13.3 ) alter'test_table',{NAME => 'colfam2',METHOD =>'delete'}
describe 'test_table'
-- Adds and deletes column family colfam2 from test_table.
14 ) alter 'test_table',{NAME => 'colfam1',VERSIONS => 2}
describe 'test_table'
-- Sets the number of versions for column family colfan1. By default no of
versions are 3
15 ) alter 'test_table',READONLY => true -- Makes a table read-only.
16 ) alter 'test_table',NAME => 'colfam3',VERSIONS => 5
-- incorrect as brackets are missing?
17 ) alter 'test_table', MAX_FILESIZE => '1234566'
-- Changes the max size of HFiles for the table.
18 ) alter_status 'test_table' -- Shows status of last alter operation.
19 ) create_namespace 'ns1' - Creates a new namespace ns1.
-- logical grouping of tables similar to schema in relational databases
20 ) create 'ns1:rt1','cf' - Creates table rt1 under namespace ns1.
21 ) list 'ns1:rt1' - Lists the specific table ns1:rt1.
22 ) describe_namespace 'ns1' - Shows metadata info about namespace
23 ) list_namespace - Lists all namespaces.
24.1 ) create 'f','f1'
put 'f',1,'f1:name','Richa'
put 'f',1,'f1:city','XYZ'
put 'f',1,'f1:id','10'
24.2 ) put 'f',2,'f1:address','abcdefg'
25 ) scan 'f' -- Scans all rows of table f.
26.1 ) get 'f','1' -- Gets all columns of row with key '1'
26.2 ) get 'f','2' -- Gets all columns of row with key '2'
27.1 ) get 'f','1',{COLUMN => 'f1:name'} -- Gets a single column value.
27.2 ) get 'f','1', {COLUMN => ['f1:name', 'f1:city']}
--get 'f','1',{COLUMN => ['f1:name','fields']}
--gets multiple columns. fields should be a valid column or column family.
28.1 ) delete 'mytable', 1, 'colfam1:Creator'
--Deleting a specific cell in the table
--'mytable' – the name of the table
--1 – the row key
--'colfam1:Creator' – the column family and column qualifier.
28.2 ) deleteall 'mytable', '1'
--Deletes all cells in a given row.
--deletes every cell in row 1, across all column families and columns.
--After this, row 1 is completely gone from the table.
29 ) count 'mytable'
--Counts the number of rows in the table 'mytable'.
--does not count individual cells, just the row keys.