My goal is to setup a pseudo distributed type with only one node but connected with HDFS. So I need to fill with HDFS port and path to connect with HDFS. In conf/hbase-site.xml
HBase use ZooKeeper to manage cluster and resouce state, you need to specify the ZK temporary file to store voting status. Here my zookeeper path is /opt/zookeeper As you can see that my hbase path in HDFS is /user/hbase, hence we need to create and grant write privilege on this path for hbase.
Now our simplest single node distributed hbase completed.
start
Of course you need HDFS started, which I skip here.
start-hbase.sh
If everything runs smoothly, this will command with only output few lines, but you could find log file in your $HBASE_HOME/logs
[master:localhost:60000] master.HMaster: Master has completed initialization
Log above means the success of startup of HBase, cong!
basic usage
Now just use few command to get in touch with hbase. Since hbase is column oriented nosql database, you have to adjust to its column family style of organization of data.
hbase shell
Now you are able to enter hbase shell, let us rock.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
create'test', 'cf' --create table named test under default namespace, and column family named cf
list 'test' -- show available table
put 'test','r','cf:1','v' --Insert one record into table --Note the first parameter is of course table name --The next one is just the primarykey --The third one is column family key, which isto specify which column family this column belong to, as you declared in table definition that this column isstartwith cf --You must put name that isstartwith what column definition is, here is cf: --Then the last one is the value of this row
scan 'test' --scan whole table right away
get 'test', 'r' --get row data of a table
--Todrop a table, you need todolike this disable 'test' enable 'test'
Press CTRL+C for exit hbase shell.
execute command below to stop hbase server, this will automatically stop zookeeper either.