Table of contentsKey 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.
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.
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 liink below:
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
sh zookeeper-3.4.6/bin/zkServer.sh start
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.
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 untar or double click on the download file in your Finder. Now we would need to make some edits to its configuration files.
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 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-stylesheet type="text/xsl" href=”configuration.xsl"?>
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.
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.