原文https://java-er.com/blog/danji-hbase-install-command/
下载stable版本
http://www.apache.org/dyn/closer.cgi/hbase/
我下载的时候hbase-2.2.3-bin.tar.gz
tar -zvxf hbase-2.2.3-bin.tar.gz
cd hbase-2.2.3
决定将HBase写入到哪里目录
vi conf/hbase-site.xml <configuration> <property> <name>hbase.rootdir</name> <value>/Users/ge/mysoft/hbase-2.2.3/data</value> </property> </configuration>
设置JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home) export PATH=$JAVA_HOME/bin:$PATH export CLASS_PATH=$JAVA_HOME/lib
这么命令行输入,只能起效一次
cd ~
vi .bash_profile
加在底部
export JAVA_HOME=$(/usr/libexec/java_home) export PATH=$JAVA_HOME/bin:$PATH export CLASS_PATH=$JAVA_HOME/lib
localhost:~ $ source .bash_profile localhost:~ $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
$ ./bin/start-hbase.sh
2020-01-22 21:02:55,071 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable HBase Shell Use "help" to get list of supported commands. Use "exit" to quit this interactive shell. Version 1.4.12, r6ae4a77408ad35d6a7a4e5cebfd401fc4b72b5ec, Sun Nov 24 13:25:41 CST 2019 hbase(main):001:0>
创建一个表名字叫Test 列族叫cf
hbase(main):001:0> create 'test', 'cf'
看下这个表
hbase(main):003:0> list 'test' TABLE test 1 row(s) in 0.0250 seconds => ["test"] hbase(main):004:0> put 'test', 'row1', 'cf:a1', 'v1' hbase(main):005:0> put 'test', 'row2', 'cf:a2', 'v2' hbase(main):006:0> scan 'test' ROW COLUMN+CELL row1 column=cf:a1, timestamp=1579698357881, value=v1 row2 column=cf:a2, timestamp=1579698364045, value=v2 2 row(s) in 0.0290 seconds hbase(main):007:0> get 'test', 'row1' COLUMN CELL cf:a1 timestamp=1579698357881, value=v1 hbase(main):008:0> disable 'test' 0 row(s) in 2.3640 seconds hbase(main):009:0> drop 'test' 0 row(s) in 1.2700 seconds hbase(main):010:0> exit
./bin/stop-hbase.sh stopping hbase....