MacOS安装HBase,必然是用于测试了,从简入手、从简配置。
直接通过brew安装即可:
brew install hbase
成功安装后,验证是否成功,如果不出意外的话,应该有如下输出:
RippleMBP:~ username$ hbaseUsage: hbase [] [ ]Options: --config DIR Configuration direction to use. Default: ./conf --hosts HOSTS Override the list in 'regionservers' file --auth-as-server Authenticate to ZooKeeper using servers configurationCommands:Some commands take arguments. Pass no args or -h for usage. shell Run the HBase shell hbck Run the hbase 'fsck' tool snapshot Create a new snapshot of a table snapshotinfo Tool for dumping snapshot information wal Write-ahead-log analyzer hfile Store file analyzer zkcli Run the ZooKeeper shell upgrade Upgrade hbase master Run an HBase HMaster node regionserver Run an HBase HRegionServer node zookeeper Run a Zookeeper server rest Run an HBase REST server thrift Run the HBase Thrift server thrift2 Run the HBase Thrift2 server clean Run the HBase clean up script classpath Dump hbase CLASSPATH mapredcp Dump CLASSPATH entries required by mapreduce pe Run PerformanceEvaluation ltt Run LoadTestTool version Print the version CLASSNAME Run the class named CLASSNAME
编辑配置文件,如果不编辑,是无法成功运行的,通过如下命令判断安装路径:
find / -name hbase
我的安装路径是:/usr/local/Cellar/hbase/1.2.9,编辑如下文件,将JAVA_HOME配置为自己的
vim /usr/local/Cellar/hbase/1.2.9/libexec/conf/hbase-env.sh
#配置JAVA_HOMEexport JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home"
编辑如下文件,大部分保持了默认:
vim /usr/local/Cellar/hbase/1.2.9/libexec/conf/hbase-site.xml
编辑后的文件内容如下(删除了网络相关的配置信息):
hbase.rootdir file:///usr/local/var/hbase hbase.zookeeper.property.clientPort 2181 hbase.zookeeper.property.dataDir /usr/local/var/zookeeper
启动HBase:
/usr/local/Cellar/hbase/1.2.9/libexec/bin/start-hbase.sh
查看HBase状态,先进入hbase的shell:
hbase shell
然后执行:
hbase(main):001:0> status1 active master, 0 backup masters, 1 servers, 0 dead, 2.0000 average loadhbase(main):002:0>
至此,HBase单机版安装完成。