[{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/blog-post/","section":"Blog-Posts","summary":"","title":"Blog-Posts","type":"blog-post"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/japanese/","section":"Tags","summary":"","title":"Japanese","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"18 February 2026","externalUrl":null,"permalink":"/blog-post/1771413349488-keigo-%E6%95%AC%E8%AA%9E--honorific-speech-in-japanese/","section":"Blog-Posts","summary":"","title":"Keigo (敬語) : Honorific Speech in Japanese","type":"blog-post"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/language/","section":"Tags","summary":"","title":"Language","type":"tags"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":" Warning! This website is still under progress! ","date":"18 February 2026","externalUrl":null,"permalink":"/","section":"Welcome to aimang's blog","summary":"","title":"Welcome to aimang's blog","type":"page"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/google-sheets/","section":"Tags","summary":"","title":"Google Sheets","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"18 February 2026","externalUrl":null,"permalink":"/blog-post/1771435978461-personal-expense-tracker/","section":"Blog-Posts","summary":"","title":"Personal Expense Tracker Using Google Sheet and Google Form","type":"blog-post"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/tiddlywiki/","section":"Tags","summary":"","title":"Tiddlywiki","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"18 February 2026","externalUrl":null,"permalink":"/blog-post/1771435943690-tiddlywiki-personal-wiki-on-a-single-html-file/","section":"Blog-Posts","summary":"","title":"TiddlyWiki: Personal Wiki on a Single HTML File","type":"blog-post"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/tracker/","section":"Tags","summary":"","title":"Tracker","type":"tags"},{"content":"","date":"18 February 2026","externalUrl":null,"permalink":"/tags/website/","section":"Tags","summary":"","title":"Website","type":"tags"},{"content":"","date":"17 February 2026","externalUrl":null,"permalink":"/tags/bash/","section":"Tags","summary":"","title":"Bash","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"17 February 2026","externalUrl":null,"permalink":"/blog-post/1771410839001-essential-and-good-to-know-linux-commands/","section":"Blog-Posts","summary":"","title":"Essential and Good-to-know Linux Commands","type":"blog-post"},{"content":"","date":"17 February 2026","externalUrl":null,"permalink":"/tags/linux/","section":"Tags","summary":"","title":"Linux","type":"tags"},{"content":" Summary # Name: MUHAMMAD AIMANUDDIN BIN MOHAMMAD AMRI Location: Kuala Lumpur, MY Experience # Role \u0026amp; Company Dates Key Contributions Process Excutive CogDev Malaysia Sdn. Bhd. Dec 2025 – Present • JD 1\n• JD 2\n• JD 3 MS L1 Engineer NTT MSC Sdn. Bhd. June 2023 – Nov 2025 • JD 1\n• JD 2\n• JD 3 Education # Period Institution \u0026amp; Qualification 2018 – 2023 Kyoto Institute of Technology Bachelor of Science in Mechanical Engineering 2016 – 2018 Pusat Bahasa Teikyo Preparatory Course for Studies to Japan (Science Stream) 2011 – 2015 MRSM Gemencheh Sijil Pelajaran Malaysia (SPM) - Science Stream Certifications \u0026amp; Awards # Show Credentials Date Certification / Award Oct 2024 ITIL® 4 Foundation Certificate in IT Service Management May 2024 Microsoft Certified: Azure Data Fundamentals July 2023 Microsoft Certified: Azure Fundamentals May 2023 Google IT Support Specialization Feb 2023 2023 JSTP Student Award (Japan Society for Technology of Plasticity)\nCertificate | Report Sep 2021 Japanese Language Proficiency Test (JLPT) N1 Languages # Language Proficiency Level Malay Native or Bilingual Proficiency English Full Professional Proficiency (C1) Japanese Full Professional Proficiency (C1 / JLPT N1) Skills # Category Technical Skills Development \u0026amp; Markup Python, Markdown, HTML, Google Apps Script Infrastructure \u0026amp; IT Docker, Active Directory Productivity (Microsoft) MS Office (Word, Excel, PowerPoint) Productivity (Google) Google Workspace (Sheets, Docs, Slides) ","date":"17 February 2026","externalUrl":null,"permalink":"/about/","section":"Welcome to aimang's blog","summary":"","title":"About Me","type":"page"},{"content":"","date":"17 February 2026","externalUrl":null,"permalink":"/tags/example/","section":"Tags","summary":"","title":"Example","type":"tags"},{"content":"","date":"17 February 2026","externalUrl":null,"permalink":"/tags/tag/","section":"Tags","summary":"","title":"Tag","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"17 February 2026","externalUrl":null,"permalink":"/blog-post/welcome/","section":"Blog-Posts","summary":"","title":"Welcome","type":"blog-post"},{"content":"","date":"16 February 2026","externalUrl":null,"permalink":"/tags/homelab/","section":"Tags","summary":"","title":"Homelab","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"16 February 2026","externalUrl":null,"permalink":"/blog-post/1771399536332-installing-omada-software-controller-on-raspberry-pi-os/","section":"Blog-Posts","summary":"","title":"Installing Omada Software Controller on Raspberry Pi OS","type":"blog-post"},{"content":"","date":"16 February 2026","externalUrl":null,"permalink":"/tags/raspi/","section":"Tags","summary":"","title":"Raspi","type":"tags"},{"content":"","date":"16 February 2026","externalUrl":null,"permalink":"/tags/tp-link/","section":"Tags","summary":"","title":"TP-Link","type":"tags"},{"content":"","date":"16 February 2026","externalUrl":null,"permalink":"/tags/hugo/","section":"Tags","summary":"","title":"Hugo","type":"tags"},{"content":"","date":"16 February 2026","externalUrl":null,"permalink":"/tags/markdown/","section":"Tags","summary":"","title":"Markdown","type":"tags"},{"content":"an example to get you started\nThis is a heading # This is a subheading # This is a subsubheading # This is a subsubsubheading # This is a paragraph with bold and italic text. Check more at Blowfish documentation undefined\n","date":"16 February 2026","externalUrl":null,"permalink":"/blog-post/1771398982639-why-i-switched-to-hugo-and-why-i-love-it/","section":"Blog-Posts","summary":"","title":"Why I switched to Hugo (and Why I Love It)","type":"blog-post"},{"content":"","date":"11 August 2024","externalUrl":null,"permalink":"/tags/docker/","section":"Tags","summary":"","title":"Docker","type":"tags"},{"content":"","date":"11 August 2024","externalUrl":null,"permalink":"/tags/notebook/","section":"Tags","summary":"","title":"Notebook","type":"tags"},{"content":"","date":"11 August 2024","externalUrl":null,"permalink":"/tags/posgresql/","section":"Tags","summary":"","title":"Posgresql","type":"tags"},{"content":"","date":"11 August 2024","externalUrl":null,"permalink":"/tags/pyspark/","section":"Tags","summary":"","title":"Pyspark","type":"tags"},{"content":"A simple project on how to set up PySpark with Jupyter notebook. Also, we will be using PosgreSQL server as database and PGAdmin for the interface.\nRun Locally # Clone the project\ngit clone https://github.com/aimanamri/test-docker-app.git Go to the project directory\ncd test-docker-ap/pyspark-de Start the server using Docker\ndocker-compose -f de_env_setup.yaml up -d This project will run on localhost:80 for PGAdmin and localhost:8888 for Jupyter notebook.\nGetting token to login into Jupyter notebook # docker exec -it notebook sh Then, run following to get token for Jupyter and copy the token into http://localhost:8888.\njupyter server list Codes (de_env_setup.yaml) # services: pg-database: image: postgres container_name: pg_db restart: always ports: - \u0026#34;5432:5432\u0026#34; environment: POSTGRES_USER: aimang POSTGRES_PASSWORD: strong-password pgadmin: image: dpage/pgadmin4 container_name: pgadmin4 restart: always depends_on: pg-database: condition: service_started ports: - \u0026#34;80:80\u0026#34; environment: PGADMIN_DEFAULT_EMAIL: user-name@domain-name.com PGADMIN_DEFAULT_PASSWORD: strong-password volumes: - ./pgadmin-data:/var/lib/pgadmin pyspark-notebook: image: jupyter/pyspark-notebook container_name: notebook restart: always ports: - \u0026#34;8888:8888\u0026#34; volumes: - ./notebook:/home/jovyan/work Tech Stack # Client:: pgadmin\nCoding: Jupyter notebook with PySpark installed\nServer: posgresql\nFeedback # If you have any feedback, please open new issue here.\n","date":"11 August 2024","externalUrl":null,"permalink":"/blog-post/1771351585518-pyspark-notebook-with-posgresql-+-pgadmin/","section":"Blog-Posts","summary":"","title":"PySpark Notebook with PosgreSQL + PGAdmin","type":"blog-post"},{"content":"Config files: https://github.com/aimanamri/raspberry-pi4-hadoop-spark-cluster/tree/main/config_files\nProject Introduction # This project serves as my self-documentation of learning distributed data storage, parallel processing, and Linux OS using Apache Hadoop, Apache Spark and Raspbian OS.\nIn this project, we\u0026rsquo;ll be setup 3-node cluster using Raspberry Pi 4, install HDFS and run Spark processing jobs via YARN. Furthermore, we can horizontally scale up in the future to add more computing nodes.\nAlthough Hadoop provides MapReduce for processing, we won\u0026rsquo;t cover that in this project. Instead, we will be more focusing on Spark because Spark is faster these days and easier to work with.\nHadoop Distributed File System (HDFS): HDFS as the distributed storage solution, enabling efficient data management across multiple nodes. Hadoop YARN: YARN acts as the resource manager, ensuring optimal allocation of computing resources for Hadoop and Spark jobs. Spark : Distributed processing system used for big data workloads and it utilizes in-memory caching. APIs in Java, Scala, Python and R. Spark on YARN: Instead of running Spark jobs in standalone mode, Spark application can be launched in cluster mode or client mode with YARN. Requirements # To replicate this project, you’ll need the following:\nHadoop 3.4.0: Install Hadoop to set up your distributed environment. Spark 3.5.1: Install the latest version of Spark. Java 8: Ensure Java 8 or 11 (runtime) is installed on your Raspberry Pi servers. Raspberry Pi 4: Here, we\u0026rsquo;re setup 3-node cluster, so we’ll need three Raspberry Pi 4 devices, each with its power supply (5V/3A DC or 5.1V/ 3A DC minimum). Ethernet Cables (if using wired connections) Micro SD card and Micro SD card reader Sources # [1] How to Install and Set Up a 3-Node Hadoop Cluster\n[2] Running Spark on Top of a Hadoop YARN Cluster\n[3] Apache Hadoop Documentation\n[4] Apache Spark Documentation\n[5] Building a Raspberry Pi Hadoop / Spark Cluster\n[6] Getting Started with Hadoop \u0026amp; Apache Spark\n[7] How to install hadoop cluster/multi node on ubuntu server 18.04\n[8] Hadoop : Capacity Scheduler\nPhysical Cluster Setup # Stack all the Pis into a rack specialized for them. Plug in the power supply to turn it on.\nRaspberry Pi Initial Setting # Installing OS\nI went with Raspberry Pi OS with desktop for the master Pi, which has a GUI, and Raspberry Pi OS Lite for the worker Pis, which only have a CLI. Then, use the Raspberry Pi Imager to write the Raspberry Pi OS 64 Bit to each Pi. Configuring host name,SSH and network connection\nI\u0026rsquo;ve set host name and SSH credential in each Pi. For network connection, I used Wi-Fi. If you are using wired connection, you can skip the Wi-Fi setup.\nHowever, it is preferable to use wired connection for stabilibility especially during transferring the files across Pis. Basic Pi Configurations # Update packages, expand file system, then reboot. # **The following steps will need to be done on each Pi.**\nsudo apt update sudo apt upgrade -y sudo raspi-config --expand-rootfs sudo reboot now Configure Static IP # Static IP addresses are required. Here in this project, I assigned them on my home router. I am using 192.168.35.XX (usually home network is 192.168.0.XX) . Alternatively, you may assign them by editing /etc/network/interfaces file.\nConfigure Hostname/Host file # **The following steps will need to be done on each Pi.**\nFor hostname, I\u0026rsquo;ve already set it up during flashing the OS into the Pi. Alternatively, you can edit /etc/hostname file and then reboot.\nFor each node to communicate with each other by name, edit the /etc/hosts file to add the IP addresses of the three Raspberry Pi. Make sure to delete the localhost 127.0.0.1 line from the file. File: /etc/hosts\n192.168.35.11 pi1 192.168.35.12 pi2 192.168.35.13 pi3 Create Hadoop user and then log in as hadoop user # **The following steps will need to be done on each Pi.**\nsudo adduser hadoop sudo usermod -aG sudo hadoop su - hadoop **FROM HERE, MAKE SURE THAT YOU ARE LOGGED IN AS hadoop USER WHEN RUNNING ALL THE COMMANDS**\nSetup Password-less SSH Authentication\n# The master node, pi1 will use an SSH connection to connect to other nodes (pi2,pi3) with key-pair authentication. This will allow the master node to actively manage the cluster.\n**Perform these steps on the master Pi until only until directed to do otherwise.**\nCreate SSH Directory (~/.ssh) if not exist and set suitable permission accordingly. mkdir ~/.ssh touch ~/.ssh/config sudo chmod 700 ~/.ssh/ sudo chmod 600 ~/.ssh/* Public/Private Key Pair\nNext, create an SSH key pair on the Pi using: ssh-keygen -t rsa -b 4096 When generating this key, leave the password field blank so your Hadoop user can communicate unprompted.\nRepeat SSH keygen on other nodes pi2 and pi3 while logging as hadoop user.\nSSH Aliases\nOn every Pi, while logging as hadoop user: Edit SSH config file using command below.\nnano ~/.ssh/config File: /home/hadoop/.ssh/config\nHost pi1 User hadoop Hostname 192.168.35.11 Host pi2 User hadoop Hostname 192.168.35.12 Host pi3 User hadoop Hostname 192.168.35.13 Then use the following command on all Pis (including pi1) to copy the public keys into pi1\u0026rsquo;s authorized key list: ssh-copy-id pi1 Finally, you can copy pi1\u0026rsquo;s SSH configuration files to the rest of the Pi\u0026rsquo;s using the following commands:\n(piX below refer to pi2 , pi3) scp ~/.ssh/authorized_keys piX:~/.ssh/authorized_keys Now, we can SSH into any Pis from master without entering any password. Please double check this if it is working properly. Java 8 Installation # **Perform these steps on the master Pi until only until directed to do otherwise.**\nTo install Java 8, download the tar package from the official website of Oracle. The OpenJDK-8 is an older version so it is not available in the Debian repository. See more.\nDOWNLOAD LINK (Linux ARM64 Compressed Archive) : https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html#license-lightbox Then, copy the tar package to worker nodes. (piX below refer to pi2 , pi3)\nscp .\\jdk-8u401-linux-aarch64.tar.gz piX:~/ Repeat the steps below on each Pi.\nRun the following commands after downloading the tar package: sudo mkdir /usr/lib/jvm/ sudo tar -zxvf jdk-8u401-linux-aarch64.tar.gz -C /usr/lib/jvm/ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_401/bin/java 1 Display Java version java -version The output will be as below:\njava version \u0026#34;1.8.0_401\u0026#34; Java(TM) SE Runtime Environment (build 1.8.0_401-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode) To set up the environmental variables, run sudo nano /etc/profile.d/java.sh export PATH=$PATH:/usr/lib/jvm/jdk1.8.0_401/bin/ export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_401/ Load the variables using: source /etc/profile.d/java.sh Then, run the following to check Java installation path, JAVA_HOME: echo $JAVA_HOME Java 8 is completed!\nHadoop 3.4.0 Installation # Hadoop Single Node Installation (for master only, pi1) # **Perform these steps on the master Pi until only until directed to do otherwise.**\nDownload Apache Hadoop 3.4.0 binary-aarch64 from Apache Hadoop website by using wget command as below: wget https://dlcdn.apache.org/hadoop/common/hadoop-3.4.0/hadoop-3.4.0-aarch64.tar.gz Note : Binary download URL above may be different if different version is used\nExtract the file in hadoop user home directory, then delete the compressed file. tar -xzvf hadoop-3.4.0-aarch64.tar.gz rm hadoop-3.4.0-aarch64.tar.gz Configure Hadoop # To get the HDFS up and running, we need to modify some configuration files.\nSet environment variables # Add Hadoop binaries to your PATH. Edit /home/hadoop/.profile and add the following line: File: /home/hadoop/.profile PATH=/home/hadoop/hadoop-3.4.0/bin:/home/hadoop/hadoop-3.4.0/sbin:$PATH This will enable us to run hadoop commands without going into the hadoop bin and sbin directory!\nAdd Hadoop to your PATH for the shell. Edit .bashrc and add the following lines:\nFile: /home/hadoop/.bashrc # path and options for java export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_401/ # path and options for Hadoop export HADOOP_HOME=/home/hadoop/hadoop-3.4.0 export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin export HADOOP_INSTALL=$HADOOP_HOME export HADOOP_MAPRED_HOME=$HADOOP_HOME export HADOOP_COMMON_HOME=$HADOOP_HOME export HADOOP_HDFS_HOME=$HADOOP_HOME export HADOOP_INSTALL=$HADOOP_HOME export YARN_HOME=$HADOOP_HOME export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop export HADOOP_OPTS=\u0026#34;-Djava.library.path=$HADOOP_HOME/lib/native\u0026#34; Then, source the .bashrc file to ensure it updates.\nsource ~/.bashrc Set the value of JAVA_HOME in hadoop-env.sh You\u0026rsquo;ll have to scroll down to find the correct line. Uncomment the line and add the correct path of your JAVA installation path to the variable. File: /home/hadoop/hadoop-3.4.0/etc/hadoop/hadoop-env.sh export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_401/ Edit config files (core-site.xml,hdfs-site.xml) # Set NameNode location\nEdit ~/hadoop/etc/hadoop/core-site.xml file to set the NameNode location to pi1* on port 9000 File: ~/hadoop-3.4.0/etc/hadoop/core-site.xml \u0026lt;configuration\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;fs.defaultFS\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;hdfs://pi1:9000\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;/configuration\u0026gt; Set path for HDFS\nEdit hdfs-site.xml to resemble the following configuration: File: ~/hadoop-3.4.0/etc/hadoop/hdfs-site.xml \u0026lt;configuration\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;dfs.replication\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;1\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;dfs.namenode.name.dir\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;/home/hadoop/hdfs/namenode/\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;dfs.datanode.name.dir\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;/home/hadoop/hdfs/datanode/\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;/configuration\u0026gt; The first property, dfs.replication, indicates how many times data is replicated in the cluster (Default is 3). You can set 2 to have all the data duplicated on the two nodes. Don’t enter a value higher than the actual number of worker nodes.\nThen, inside of the hadoop home directory, create folders in each node (pi1,pi2,pi3) using: mkdir -p /home/hadoop/hdfs/{namenode,datanode} Set YARN as Job Scheduler for MapReduce operations\nEdit the mapred-site.xml file, setting YARN as the default framework for MapReduce operations: File: ~/hadoop-3.4.0/etc/hadoop/mapred-site.xml \u0026lt;configuration\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;mapreduce.framework.name\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;yarn\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.app.mapreduce.am.env\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;HADOOP_MAPRED_HOME=$HADOOP_HOME\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;mapreduce.map.env\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;HADOOP_MAPRED_HOME=$HADOOP_HOME\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;mapreduce.reduce.env\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;HADOOP_MAPRED_HOME=$HADOOP_HOME\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.app.mapreduce.am.resource.memory-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;512\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;mapreduce.map.resource.memory-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;256\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;mapreduce.reduce.resource.memory-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;256\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;/configuration\u0026gt; Note : If you\u0026rsquo;re running on single node: (1) Format the HDFS, (2) start-dfs.sh and then you can start exploring HDFS.\nHadoop Multi-Node Installation # Configure YARN # Edit yarn-site.xml, which contains the configuration options for YARN.\nTo configure the ResourceManager to use the CapacityScheduler for setting up queues (dev and prod queues), the following property need to be included: \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.resourcemanager.scheduler.class\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; File: ~/hadoop-3.4.0/etc/hadoop/yarn-site.xml\n\u0026lt;configuration\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.nodemanager.aux-services\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;mapreduce_shuffle\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.nodemanager.env-whitelist\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.acl.enable\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;0\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.resourcemanager.hostname\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;pi1\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.nodemanager.aux-services\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;mapreduce_shuffle\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.nodemanager.resource.memory-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;1536\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.maximum-allocation-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;1536\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.minimum-allocation-mb\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;128\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.nodemanager.vmem-check-enabled\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;false\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.resourcemanager.scheduler.class\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.capacity.root.queues\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;prod,dev\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.capacity.prod.capacity\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;0.5\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.capacity.dev.capacity\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;0.5\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.capacity.dev.maximum-capacity\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;0.5\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;property\u0026gt; \u0026lt;name\u0026gt;yarn.scheduler.capacity.prod.maximum-capacity\u0026lt;/name\u0026gt; \u0026lt;value\u0026gt;0.7\u0026lt;/value\u0026gt; \u0026lt;/property\u0026gt; \u0026lt;/configuration\u0026gt; Note:\nBased on above properties, capacity of resource allocation of each queue is 50%. We also define how much of our resources can be allocated to our queues at maximum. So, if one queue does not use all the resources allocated to it, then YARN will allocate those resources to the other queue. For example, dev queue will never use more than 50% of the allocated resources in the system. However, YARN allows prod queue to use up to 70% of the resource if dev queue is not used.\nThen, edit capacity-scheduler.xml by copying exactly as written in this file.\nFile: ~/hadoop-3.4.0/etc/hadoop/capacity-scheduler.xml Configure Master and Workers # For the Master:\nEdit ~/hadoop-3.4.0/etc/hadoop/master file.\npi1 For the Workers:\nEdit ~/hadoop-3.4.0/etc/hadoop/workers file.\npi2 pi3 Duplicate Config Files on Each Node\n# SSH into pi2 and then pi3 and run the following commands: sudo mkdir hadoop-3.4.0 sudo chown -R hadoop:hadoop hadoop-3.4.0/ Copy the Hadoop config files to the worker nodes from master node: for pi in pi2 pi3; do rsync -avxP ~/hadoop-3.4.0/ $pi:/home/hadoop/hadoop-3.4.0/; done Format HDFS # To run for the first time, the HDFS needs to be formatted. Hence, run the following command on master node, pi1:\n**THIS WILL DELETE ALL DATA IN THE HDFS**\nhdfs namenode -format Our Hadoop installation is now configured and ready to run!\nRun HDFS and YARN # Run the following command to start the HDFS and the YARN: start-dfs.sh \u0026amp;\u0026amp; start-yarn.sh Check that every process is running with the jps command on each node. On master node pi1, we should see the following (the PID number will be different): 5733 Jps 5623 ResourceManager 5435 SecondaryNameNode 5245 NameNode And on pi2 and pi3 we should see the following:\n1538 DataNode 1720 Jps 1640 NodeManager To stop HDFS and YARN on master and worker nodes, run the following command from pi1: stop-dfs.sh \u0026amp;\u0026amp; stop-yarn.sh Monitor HDFS and YARN via web UI\n# HDFS : http://pi1:9870 YARN : http://pi1:8088 (default port: 8088) Now, we have a working Hadoop Cluster! Spark 3.5.1 Installation # **The following steps only need to be performed on the master Pi, pi1**\nDownload Apache Spark 3.5.1 binary from Apache Spark website by using wget command as below: wget https://dlcdn.apache.org/spark/spark-3.5.1/spark-3.5.1-bin-hadoop3.tgz Note : Binary download URL above may be different if different version is used\nExtract the file in hadoop user home directory and rename the directory. Then, delete the compressed file. tar -xzvf spark-3.5.1-bin-hadoop3.tgz mv spark-3.5.1-bin-hadoop3 spark-3.5.1 rm spark-3.5.1-bin-hadoop3.tgz Set environment variables\n# Add Spark binaries to your PATH. Edit /home/hadoop/.profile and add the following line: File: /home/hadoop/.profile # add SPARK bin and sbin to the end of the line PATH variable PATH=/home/hadoop/spark-3.5.1/bin:/home/hadoop/spark-3.5.1/sbin:$PATH Add Hadoop to your PATH for the shell. Edit .bashrc and add the following lines: File: /home/hadoop/.bashrc # path and options for Spark export SPARK_HOME=/home/hadoop/spark-3.5.1 export PATH=$PATH:$SPARK_HOME/bin export LD_LIBRARY_PATH=$HADOOP_HOME/lib/native:$LD_LIBRARY_PATH export PYSPARK_PYTHON=python3 # add SPARK bin and sbin to the end of the line PATH variable export PATH=/home/hadoop/spark-3.5.1/bin:/home/hadoop/spark-3.5.1/sbin:$PATH Then, source the .bashrc file to ensure it updates.\nsource ~/.bashrc Configuring YARN for Spark # Configure Workers\nCopy workers.template to workers file in spark-3.5.1/conf directory. cp workers.template workers Then, add the hostname/IP address of workers nodes at the end line inside workers file.\nFile: /home/hadoop/spark-3.5.1/conf/workers\npi2 pi3 Configure Memory Allocation\nFor nodes with less than 4G RAM, the default configuration is not adequate and may trigger swapping and poor performance, or even the failure of application initialization due to lack of memory. See more [2] cp spark-defaults.conf.template spark-defaults.conf Edit spark-defaults.conf and add the following configurations. File: /home/hadoop/spark-3.5.1/conf/spark-defaults.conf spark.driver.memory 512m spark.yarn.am.memory 512m spark.executor.memory 512m Monitor Spark Applications # Enable the Web UI of Spark to track your submitted jobs by editing spark-defaults.conf file.\nAdd the following lines. File: /home/hadoop/spark-3.5.1/conf/spark-defaults.conf spark.eventLog.enabled true spark.eventLog.dir hdfs://pi1:9000/spark-logs spark.history.provider org.apache.spark.deploy.history.FsHistoryProvider spark.history.fs.logDirectory hdfs://pi1:9000/spark-logs spark.history.fs.update.interval 10s spark.history.ui.port 18080 If you specify a bigger interval, you will have some delay between what you see in the History Server and the real time status of your application. If you use a shorter interval, you will increase I/O on the HDFS.\nRestart HDFS and YARN if stopped. Then, create the log directory in the HDFS: start-dfs.sh \u0026amp;\u0026amp; start-yarn.sh hdfs dfs -mkdir /spark-logs Run the History Server, HDFS and YARN: start-history-server.sh To ensure all required daemons, run jps command. The output should be as below: 7971 Jps 7879 HistoryServer 7417 ResourceManager 7195 SecondaryNameNode 7038 NameNode Run the Pi parallel processing job again to generate logs in the HDFS: spark-submit --class org.apache.spark.examples.SparkPi --master yarn --queue dev /home/hadoop/spark-3.5.1/examples/jars/spark-examples_2.12-3.5.1.jar 10 Access the History Server by navigating to http://pi1:18080 in a web browser:\nTo stop all running daemons:\nstop-dfs.sh \u0026amp;\u0026amp; stop-yarn.sh \u0026amp;\u0026amp; stop-history-server.sh Running the Spark Interactive Shell # Ensure that HDFS and YARN are running. To confirm, run jps on each of the nodes.\nAs an example, we are going to use Titanic dataset. Download the CSV file using wget on another terminal:\nwget https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv Then, upload it to HDFS directory and then confirm the file is already uploaded.\nhdfs dfs -put ~/titanic.csv /titanic.csv hdfs dfs -ls / Using the Spark Shell (Scala) # Start Spark shell. spark-shell --master yarn --queue dev --name APPLICATION_NAME_SCALA Loading Data val df = spark.read.format(\u0026#34;csv\u0026#34;).option(\u0026#34;header\u0026#34;,true).option(\u0026#34;separator\u0026#34;,\u0026#34;,\u0026#34;).load(\u0026#34;hdfs:///titanic.csv\u0026#34;) df.show(10,false) To exit, enter: :q Using the PySpark (Python) # Start PySpark shell. pyspark --master yarn --queue dev --name APPLICATION_NAME_PYSPARK Loading Data df = spark.read.format(\u0026#34;csv\u0026#34;).option(\u0026#34;header\u0026#34;,True).option(\u0026#34;separator\u0026#34;,\u0026#34;,\u0026#34;).load(\u0026#34;hdfs:///titanic.csv\u0026#34;) df.show(10,False) To exit, enter: exit() Submit file as Spark Job/Application to the YARN Cluster\n# Here, I will show only for Python language. But, you can also run Scala and R script.\nPython Script # Create Python file as script.py. Edit the file to run simple task. from pyspark.sql import SparkSession from pyspark.sql.functions import col # Create a SparkSession spark = SparkSession.builder.appName(\u0026#34;Testing PySpark Example\u0026#34;).getOrCreate() sample_data = [{\u0026#34;name\u0026#34;: \u0026#34;John D.\u0026#34;, \u0026#34;age\u0026#34;: 30}, {\u0026#34;name\u0026#34;: \u0026#34;Alice G.\u0026#34;, \u0026#34;age\u0026#34;: 25}, {\u0026#34;name\u0026#34;: \u0026#34;Bob T.\u0026#34;, \u0026#34;age\u0026#34;: 35}, {\u0026#34;name\u0026#34;: \u0026#34;Eve A.\u0026#34;, \u0026#34;age\u0026#34;: 28}] df = spark.createDataFrame(sample_data) from pyspark.sql.functions import col, regexp_replace # Remove additional spaces in name def remove_extra_spaces(df, column_name): # Remove extra spaces from the specified column df_transformed = df.withColumn(column_name, regexp_replace(col(column_name), \u0026#34;\\\\s+\u0026#34;, \u0026#34; \u0026#34;)) return df_transformed transformed_df = remove_extra_spaces(df, \u0026#34;name\u0026#34;) transformed_df.show() Submit Python script as Spark job. spark-submit --master yarn --queue prod ~/script.py Other examples to run Scala and R Script: # # For Scala and Java, use run-example: ./bin/run-example SparkPi # For R examples, use spark-submit directly: ./bin/spark-submit examples/src/main/r/dataframe.R We now have a working Spark Cluster. Keep exploring!\nMore Information # HDFS Shell Documentation PySpark Documentation Submitting Spark Applications aimanamri/raspberry-pi4-hadoop-spark-cluster Step-by-step guide to build a 3-node Hadoop 3.5 and Spark 4.3 cluster on Raspberry Pi 4. HDFS for storage, YARN for scheduling, Spark jobs on YARN. For Raspberry Pi OS or Ubuntu 64-bit with Java 17. Shell 10 1 ","date":"14 July 2024","externalUrl":null,"permalink":"/blog-post/1771343621504-build-raspberry-pi-4-hadoop/","section":"Blog-Posts","summary":"","title":"Build Raspberry Pi 4 Hadoop/Spark Cluster","type":"blog-post"},{"content":"","externalUrl":null,"permalink":"/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"}]