<script type="application/ld+json">
{
 "@context": "https://schema.org",
 "@type": "BlogPosting",
 "mainEntityOfPage": {
   "@type": "WebPage",
   "@id": "https://www.engati.com/blog/install-hbase-on-mac-in-5-minutes"
 },
 "headline": "How to install HBase on your Mac in 5 minutes",
 "description": "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.",
 "image": "https://global-uploads.webflow.com/5ef788f07804fb7d78a4127a/609270f3f62acfb6042ee203_install-hbase-on-mac-in-5-minutes-p-1600.jpeg",  
 

"articleSection" : "Setting up HBase",  "articleBody" : [ "1</SPAN>\n<H3 class=\"inline\">Install Zookeeper", "2</SPAN>\n<H3 class=\"inline\">Get the zookeeper data directory", "3</SPAN>\n<H3 class=\"inline\">Download HBase", "4</SPAN>\n<H3 class=\"inline\">Edit HBase Configurations", "5</SPAN>\n<H3 class=\"inline\">Start HBase" ]

"author": {
   "@type": "Person",
   "name": "Shripati Bhat"
 },  
 "publisher": {
   "@type": "Organization",
   "name": "Engati",
   "logo": {
     "@type": "ImageObject",
     "url": "https://global-uploads.webflow.com/5ef788f07804fb9e0aa41273/60950e66372af76cf098f036_engati%20logo_color.svg"
   }
 },
 "datePublished": "2021-05-20",
 "dateModified": "2021-05-24"
}
</script>

Tech Corner

Install HBase in a snap! A simple step-by-step guide

Shripati Bhat
.
May 20
.
3-4 mins

Table of contents

Key takeawaysCollaboration platforms are essential to the new way of workingEmployees prefer engati over emailEmployees play a growing part in software purchasing decisionsThe future of work is collaborativeMethodology

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, only 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.

There are a few pre-requisites for this setup.

  • OneInstall Java 1.8.0
  • TwoFind the value of JAVA_HOME (just type /usr/libexec/java_home in your terminal)

The most critical 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 select our local file system as an example.

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, refer to the link below:

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

Installing 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 haven’t updated brew, this might take some time.

brew service start zookeeper

Or, 

sh zookeeper-3.4.6/bin/zkServer.sh start

2

Get the zookeeper data directory

Now that we have a zookeeper downloaded and installed, we need to look for the zoo.cfgdataDir file. Pick the value of the property that you want to use later. For instance, it looks something like this in my case. 

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

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 you’ve completed the download, you can enter or double click on the download file in your Finder. Now we would need to make some edits to its configuration files.

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 following command, 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 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></configuration>
<property></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>

 

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 begun, 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, you can find all the logs 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 effortless to install Hbase on a Mac. However, if you have any doubts regarding these 5 simple steps to get HBase set up  or if you find any issues, please leave them in the comments section below.

Until then, start adopting AI with Engati’s automation solutions.

Build an AI chatbot to engage your always-on customers

Share
Share

Shripati Bhat

Shripati is a Senior Technical Manager at Engati. He's a technical enthusiast, passionate about designing and building scalable software.

Shripati has a deeply ingrained customer-first ideology and is skilled in designing and developing Java/J2EE applications and BigData applications.

Andy is the Co-Founder and CIO of SwissCognitive - The Global AI Hub. He’s also the President of the Swiss IT Leadership Forum.

Andy is a digital enterprise leader and is transforming business strategies keeping the best interests of shareholders, customers, and employees in mind.

Follow him for your daily dose of AI news and thoughts on using AI to improve your business.

Catch our interview with Andy on AI in daily life

Continue Reading