Jdk 7 On Homebrew

The adoptopenjdk cask will automatically upgrade to the newest patch or major release as soon as it comes out. To stay with a specific major release, activate the AdoptOpenJDK tap with brew tap and then install the desired version with brew install -cask: $ brew tap AdoptOpenJDK/openjdk $ brew install -cask. Install Homebrew Cask. On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8. Install Homebrew Cask first if you haven’t: brew update brew tap caskroom/cask brew install brew-cask-completion If your brew or cask is outdated, update and upgrade.

In this article, I will take you through step by step on how to easily install Hadoop 3.3.0 on a mac OS – Big Sur (version 11.2.1) with HomeBrew for a single node cluster in pseudo-distributed mode.

Install Hadoop on Mac

The installation of Hadoop is divided into these steps:

  1. Install Java environment
  2. Install SSH
  3. Install HomeBrew
  4. Install Hadoop through HomeBrew
  5. Health Check

Install Java Environment

  1. Open the terminal and enter java -version to check the current Java version. If no version is returned then go for the official website to install it
  2. After the installation is complete, Configure the environment variables of JAVA. JDK is installed in the directory /Library/Java/JavaVirtualMachines.
  3. Enter vim ~/.bash_profile in the terminal to configure the Java path.
  4. Place the following statement in the blank line export JAVA_HOME=”/Library/Java/JavaVirtualMachines/ jdk version.jdk/Contents/Home”
  5. Then, execute source ~/.bash_profile in the terminal to make the configuration file effective.
  6. Then enter the java -version in the terminal, you can see the Java version. (Similar to below)

Note: In recent versions, the mac should have built-in java, but it is possible that the version will be lower, and the lower version will affect the installation of Hadoop.

Install Homebrew

Homebrew is very commonly used on mac, not much to describe, installation method

Install SSH

After this step open terminal and enter “ssh localhost”, you should log in without a password and that indicates your settings is successful

Install hadoop

Note: latest hadoop will be installed. In our case Hadoop 3.3.0 at the time of writing this article.

After the installation is complete, we enter “hadoop version” to view the version. If there is an information receipt, the installation is successful.

Hadoop configuration

Please make the changes with the below configuration details to the following files under $HADOOP_HOME/etc/hadoop/ to set HDFS.

  1. core-site.xml
  2. hdfs-site.xml
  3. mapred-site.xml
  4. yarn-site.xml
  5. hadoop-env.sh

Get the configuration variables in ~/.bash_profile file in $HOME directory

Hadoop Installed Path

Core-site.xml

Open $HADOOP_HOME/etc/hadoop/Core-site.xml in terminal and add below properties

Hdfs-site.xml

Open $HADOOP_HOME/etc/hadoop/Hdfs-site.xml file in terminal and add below properties

yarn-site.xml

Open $HADOOP_HOME/etc/hadoop/yarn-site.xml file and add below properties

Mapred-site.xml

Open $HADOOP_HOME/etc/hadoop/mapred-site.xml file in termial and add below properties.

hadoop-env.sh

Open $HADOOP_HOME/etc/hadoop/hadoop-env.sh file in terminal and add below properties

# export JAVA_HOME [Same as in .profile file]

hdfs format

Note: Open terminal and Initialize Hadoop cluster by formatting HDFS directory

Final Step

Run start-all.sh in the sbin folder

Use JPS command to check if all name node, Data node, resource manager is started successfully

Health Check

Running Basic HDFS Command

Related Online Courses

1. Online Courses – Hands-On Hadoop

What you’ll get from it: This course provides hands-on Hadoop with MapReduce, HDFS, Spark, Flink, Hive, HBase, MongoDB, Cassandra, Kafka, etc.

Introduction Homebrew

I recently moved from an i5 2018 MacBook Pro to an M1 MacBook Air and I thought I’d see if I could keep everything native rather than using Rosetta 2.
Two items have popped up so far – there is no driver for my printer, and native Java requires some hoops depending on your needs.
Before I dig any deeper, you can absolutely go straight to the Azul download site and download the .dmg for Zulu Java JDK; I didn’t want to go with this, I usually use Homebrew to manage my apps, and as I do Java development, want to have multiple Java versions installed and managed.

Homebrew fails to install a native JDK, and instead tries to install an x86 compiled version which errors on install if you don’t have Rosetta 2 installed. I’ve raised a request for this as Homebrew should ideally offer the native Java JDK option.

I went hunting and found that SDKMAN had an enhancement request to support Apple Silicon, and that it was available in the 5.10.0 release.

SDKMAN is a great little tool to allow you to quickly install multiple JDKs and can be coupled nicely with jenv to allow you to easily switch your primary JDK.

Installing and configuring SDKMAN

Follow normal SDKMAN install instructions, basically just run curl -s 'https://get.sdkman.io' | bash

Next, update config field sdkman_rosetta2_compatiblefor SDKMAN to set to false vi ~/.sdkman/etc/config

Restart terminal so that the updated config gets set.

Installing a JDK

In case you missed it, make sure you restart your terminal, if you don’t then you’ll get a longer list when you run sdk list java, you should see a short list (just Azul and Bellsoft at the time of writing)

See Full List On Github.com

Below is an example command to install Zulu 16.0.1 but obviously you can change to your preferred flavour based on the sdk list java output.

sdk install java 16.0.1-zulu

You can then run java --version to check that it worked the way you expected…

Gotchas

GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap

If you did what I did and didn’t restart your terminal so the new config got picked up then you would have received an error when running java as below:

This means you accidentally install the x86 version.
Stop now and restart your terminal so the config gets picked up. Next remove the cache of the JDK otherwise it’ll just reinstall the x86 version (I made this mistake).
rm ~/.sdkman/archives/*.zip

Finally, follow the JDK install instructions above.

Jdk 7 On Homebrew App

Photo by Nathan Dumlao on Unsplash