WhatsApp chatbot now available in 3 pricing plans - 250 USD for 10K messages, 333 USD for 30K messages and 600 USD for 100K messages, all inclusive.

Install HBase on Mac (in 5 minutes)

Shripati Bhat
|
4
min read
Install HBase on Mac (in 5 minutes)

We at Engati use HBase effectively to store a large amount of time-series data. It is a distributed database and extensively uses Zookeeper for synchronization, configuration management, in addition to the communication between its internal components and the clients. This quick guide will help you install HBase on your Mac in barely any time.

Setting up HBase

We can install and set up HBase in our mac in just 5 minutes  (presuming that you have good internet connectivity). These steps work for any Linux based OS as well just if you don't use brew. You can use this setup, for example, to play around with some basic functionalities. You could also use it in your local to do some simple queries or proof of concepts.

Certainly, there are some pre-requisites for this setup.

  1. Install Java 1.8.0
  2. Find the value of JAVA_HOME ( just type /usr/libexec/java_home in your terminal)

The most important aspect while setting up HBase is a file system. For instance, you can choose HDFS as a file system or your local file system. For this post, we will choose our local file system as an example.

Step 1: Install Zookeeper

Firstly we need a zookeeper. If you happen to have an existing zookeeper installed, you can skip this step. If you don't have it, we can now start by installing zookeeper (standalone mode). You can choose to install it using brew or download it from the zookeeper website.

brew install zookeeper

or 

https://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html

This should take approximately a minute and after the installation, you can start zookeeper using the commands below. However, if you are installing brew for the first time or if you haven’t updated brew, this might take some time.

brew service start zookeeper

or 

sh zookeeper-3.4.6/bin/zkServer.sh start

Step 2: Get the zookeeper data directory

Now that we have a zookeeper downloaded and installed, we need to look for the zoo.cfgdataDir file and pick the value of property which will be used later. For instance, it looks something like this in my case 

dataDir=/usr/local/var/run/zookeeper/data

Step 3: Download HBase

Once we have the zookeeper set, you can move on to download HBase. You can download it from https://hbase.apache.org/downloads.html and I’m downloading stable version v1.6.0. After this download is completed, you can untar or double click on the download file in your Finder. Now we would need to make some edits to its configuration files.

Step 4: Edit HBase Configurations

Firstly, we edit hbase-1.6.0/conf/hbase-env.sh. This file already has properties JAVA_HOME and HBASE_MANAGES_ZK that we need to edit to the required values. We should now set the JAVA_HOME to the correct value on your machine and set HBASE_MANAGES_ZK to false.

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Homeexport HBASE_MANAGES_ZK=false

Secondly, we edit hbase-1.6.0/conf/hbase-site.xml from which we need to remove all existing lines and copy the below content into it. An important detail to note here is that the value for hbase.zookeeper.property.dataDir property is the one which we picked from Step 2. 

Furthermore, if any of the properties here are incorrect, HBase won't start and hence we need to be careful in this step. Here if you note the value of hbase.rootdir is file:///tmp which indicates that we are using our local file system to store all data and files (as contrary to hdfs://localhost:9090).

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href=”configuration.xsl"?>
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///tmp</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/var/run/zookeeper/data</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
</configuration>

Step 5: Start HBase

Now we have all the necessary setup and so we can go on to start Hbase. But we need to make sure that Zookeeper has started and then we start Hbase using the below command.

sh hbase-1.6.0/bin/start-hbase.sh

Additionally to check for any errors or if we want to check if it is started successfully or not, all the logs can be found at hbase-1.6.0/logs/ directory. You can now login to the HBase shell using the below command.

sh hbase-1.6.0/bin/hbase shell

That's a wrap

It's really easy to install Hbase on a Mac. However, if you have any doubts regarding these 5 simple steps to get HBase set up in your local or if you find any issues, please leave them in the comments section below.

No items found.
About Engati

Engati is a one-stop platform for delighted customers. With our intelligent bots, we help you create the smoothest of Customer Experiences. And now, we're helping you find those customers too. The award-winning Marketing Automation platform, LeadMi, received some major upgrades and joined our family as Engati Acquire. So, let's get started?

Get Started Free