#Hadoop and Hbase Setup on Windows
This document covers basic setup of hbase and hadoop on a single system on windows. Softwares being setup are:
- Hadoop (3.4.2)
 - Hbase (2.6.3)
 - JDK (17) on wsl
 
the steps are as follows:
- 
Enable WSL on Windows from 'Turn windows features on and off' dialog.
- search for windows features on the start menu.
 - Scroll down to windows sub-system for linux option and enable it.
 - Click ok.
 - Let it load the libraries and restart after.
 
 - 
Install ubuntu system from the ms-store.
- Open the ubuntu System from start menu.
 - Set the login and password for the sub-system.
 
 - 
Download Java JDK using the following commands:
- sudo apt install openjdk-17-jdk
 - Define environment variable JAVA_HOME (By default jdk is installed in /usr/lib/jvm/java-17-openjdk-amd64)
 - export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
 
 - 
After settings these things we wil now start with hadoop setup.
 - 
Here hdoop will be setup as a pseud-distributed system. To setup Hadoop follow these steps:
- 
Install ssh:
- Run: sudo apt install openssh-server
 - Start the service: sudo service ssh start
 - check service: sudo service ssh status
 - (Optional) setup ssh as a startup service: sudo systemctl enable ssh
 
 - 
Install Hadoop: 0. Change location to home directory of the user.(Optional)
- Download Hadoop: wget https://downloads.apache.org/hadoop/common/hadoop-3.4.2/hadoop-3.4.2-lean.tar.gz
 - Unzip the file: tar -xzf hadoop-3.4.2-lean.tar.gz
 - Change directory: cd hadoop-3.4.2
 - Add environment variable: export HADOOP_HOME=/~/hadoop-3.4.2
 - Applying the changes in env: source ~/.bashrc
 - Adding the JAVA_HOME location to hadoop:
- open <-hadoop_directory->/etc/hadoop/hadoop-env.sh: nano $HADOOP_HOME/etc/hadoop/hadoop-env.sh
 - change the variable JAVA_HOME: export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
 - save using ctrl+s and ctrl+x.
 
 - Setting up passwordless ssh:
- generate ssh rsa key: ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
 - add the generated key to authorized keys: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
 - modify file permissions rw for the user: chmod 600 ~/.ssh/authorized_keys
 
 - Adding hdfs namenode for later: hdfs namenode -format
 - starting the hadoop service from the hadoop parent directory:
- Run: start-dfs.sh
 - Run: start-yarn.sh
 
 - Check hadoop setup: hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.4.2.jar pi 2 5
 
 - 
Setting up Hbase:
- Download Hbase 2.6.3: wget https://downloads.apache.org/hbase/2.6.3/hbase-2.6.3-bin.tar.gz
 - Unzip the downloaded file: tar -xzf hbase-2.6.3-bin.tar.gz
 - Enter into hbase base directory: cd hbase-2.6.3
 - Setting JAVA_HOME variable in Hbase config file:
- Edit the file hbase-env.sh: nano conf/hbase-env.sh
 - Modify the JAVA_HOME variable to: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 - Save and exit the file: CTRL-S then, CTRL-X
 
 - Configure Standalone mode:
- Open file hbase-site.xml: nano conf/hbase-site.xml
 - Edit the property as: hbase.cluster.distributed false hbase.rootdir file:///home/<-user-directory-name-here->/hbase-data
 - save and exit: CTRL-S then, CTRL-X
 
 - Make data directory: mkdir -p ~/hbase-data
 - Starting hbase service from hbase parent directory: ./bin/start-hbase.sh
 - Running the hbase shell: ./bin/hbase shell
 - Running commands in hbase shell:
- create 'test', 'cf'
 - put 'test', 'row1', 'cf:a','value1'
 - scan 'test'
 
 - Stopping hbase service: ./bin/stop-hbase.sh
 
 - 
The setup should now be complete.
 
 -