access_time 26 days ago languageEnglish
more_vert

Install HBase in WSL - Standalone Mode

visibility 30 comment 0

HBase is the short name for Hadoop database. HBase is a distributed non-SQL database like Google Bigtable, which can utilizes distributed file system like HDFS. HBase can run in two modes - standalone and distributed. In this tutorial, I will show you how to install a standalone HBase on WSL (Windows Subsystem for Linux) without using HDFS. 

Prerequisites

WSL

Please ensure you have WSL enabled on your Windows 10 system.  Follow Install Windows Subsystem for Linux on a Non-System Drive to install WSL on a non-C drive.  This tutorial utilizes Debian distro. You could also replicate these steps on Debian Linux system directly.

JDK

Follow article Install Open JDK on WSL to install JDK if it is not available.

Ensure JAVA_HOME environment variable is setup properly.

Step by step guide

1) Download HBase from a mirror site: Apache Download Mirrors.

For example, I am using the following command to download the released binary into my WSL user home folder:

wget https://www.strategylions.com.au/mirror/hbase/2.4.1/hbase-2.4.1-bin.tar.gz

The version downloaded is 2.4.1.

2) Extract the downloaded file using the following command:

tar xzvf hbase-2.4.1-bin.tar.gz

3) Change directory to the extracted folder:

cd hbase-2.4.1

The folder includes these files/subfolders:

~/hbase-2.4.1$ ls
bin  CHANGES.md  conf  docs  hbase-webapps  LEGAL  lib  LICENSE.txt  NOTICE.txt  README.txt  RELEASENOTES.md

4) Start HBase daemon service:

~/hbase-2.4.1$ bin/start-hbase.sh

The service may not start successfully due to the following error:

2021-02-02 23:13:40,683 INFO  [main] server.NIOServerCnxnFactory: binding to port localhost/127.0.0.1:2181
2021-02-02 23:13:40,684 ERROR [main] master.HMasterCommandLine: Master exiting
java.net.SocketException: Permission denied
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:461)
        at sun.nio.ch.Net.bind(Net.java:453)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:78)
        at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:687)
        at org.apache.zookeeper.server.ServerCnxnFactory.configure(ServerCnxnFactory.java:76)
        at org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster.startup(MiniZooKeeperCluster.java:241)
        at org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster.startup(MiniZooKeeperCluster.java:189)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:227)
        at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:149)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
        at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2863)

I resolved this issue via the following two steps:

  • Update conf/hbase-site.xml file to use a different client port:
    As shown in line 56 of the following screenshot, the client port is changed to 10231.

  • And then rerun the command to start the daemons.  Make sure to allow java communications:

5) Run jps command to ensure HMaster Java process exists.

~/hbase-2.4.1$ jps
1608 HMaster
2508 Jps

6) Check the Web UI: http://localhost:16010.

The UI looks like the following:

7) Connect to HBase using Shell:

~/hbase-2.4.1$ bin/hbase shell
2021-02-02 23:34:14,903 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.4.1, rb4d9639f66fccdb45fea0244202ffbd755341260, Fri Jan 15 10:58:57 PST 2021
Took 0.0017 seconds
hbase:001:0>

8) Practice the following commands in the HBase shell:

  • create 'test_table', 'cf'
  • list 'test_table'
  • describe 'test_table'
  • put 'test_table', 'row1', 'cf:a', 'value1'
  • put 'test_table', 'row2', 'cf:b', 'value B'
  • put 'test_table', 'row3', 'cf:c', 'value 3'
  • scan 'test_table'
  • get 'test_table', 'row1'
  • drop 'test_table'
  • disable 'test_table'
  • drop 'test_table'

The output looks like the following screenshot:


9) Quit the shell by running this command:

quit
# or
exit

10) Stop HBase daemon services if you don't want to use HBase in WSL:

~/hbase-2.4.1$ bin/stop-hbase.sh
stopping hbase............

info Last modified by Raymond 26 days ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to contribute on Kontext to help others?

Learn more