安装
brew安装
brew install hbase
安装验证:输入hbase,有如下输出即可(但是实际上不一定成功)
[email protected] bin % hbase
Usage: hbase [<options>] <command> [<args>]
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 configuration
Commands:
Some commands take arguments. Pass no args or -h for usage.
shell Run the HBase shell
hbck Run the hbase 'fsck' tool
snapshot Tool for managing snapshots
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
canary Run the Canary tool
version Print the version
CLASSNAME Run the class named CLASSNAME
修改配置文件
1.修改
vim /usr/local/Cellar/hbase/1.3.5/libexec/conf/hbase-env.sh
将其中的 将JAVA_HOME配置为自己的
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home"
2.修改
vim /usr/local/Cellar/hbase/1.3.5/libexec/conf/hbase-site.xml
修改后单机版内容如下
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///usr/local/var/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/var/zookeeper</value>
</property>
</configuration>
坑
有一些坑说一下:
由于hbase自带zk
如果和电脑自带的zk冲突,有两个办法解决
1.保留hbase的配置,修改hbase-site.xml和我上面的一样,修改非hbase的zk端口2182
2.添加配置
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
但是可能有其他问题,调试比较麻烦,为了快捷方便,以及以后版本不冲突,我使用了第一种办法。
启动
./start-hbase.sh
验证
进入shell
hbase shell
输入status
[email protected] bin % hbase shell
2020-04-14 14:46:11,547 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.3.5, rb59afe7b1dc650ff3a86034477b563734e8799a9, Wed Jun 5 15:57:14 PDT 2019
hbase(main):001:0> status
1 active master, 0 backup masters, 1 servers, 0 dead, 3.0000 average load
hbase(main):002:0>
如果没有1 servers, 1 dead说明成功。(一个服务器,还死了一个,说明失败了)
使用jps命令查看进程,如果有多个自己调整配置文件启动的多个hbase,kill掉
[email protected] bin % jps
72129
30963 Jps
27095 HMaster
87785 RemoteMavenServer
90985 RemoteJdbcServer
92139
38252 Kafka
安装完成,大功告成!
转载请注明链接地址: » mac系统搭建hbase