Contribute Limited Amount Of Storage Of DataNode  In Hadoop Cluster

Contribute Limited Amount Of Storage Of DataNode In Hadoop Cluster

Task :-

??In a Hadoop cluster, find how to contribute limited/specific amount of storage as slave to the cluster?


* To complete this task or To solve this issue , we have to use Linux Partition Concept .

* I will follow the below step for this task -

<1>. Add New HardDisk To DataNode

<2>. Create Partition In Add Device At DataNode

<3>. Format & Mount Partition at DataNode

<4>. Configure NameNode

<5>. Configure DataNode

<6>. Check Contribution Of DataNode In Distributed File Storage of Hadoop Cluster

I have a Hadoop Cluster in which one NameNode and one DataNode is present.

IP of NameNode - 192.168.43.106 Hostname is "NN1"

IP of DataNode - 192.168.43.65 Hostname is "DN1"

Step - 1 Add New HardDisk To DataNode -

Now I am using Oracle Virtual Box so we don't need to purchase new hard disk . We will use Virtual Hard Disk concept.

We are adding new hard disk because we don't have any unallocated space to do partitions.

* You can also refer this video for more understanding for this -


To add new hard disk DataNode must be in "Stopped" state then Follow this steps -

(A) Go Storage in Settings of DataNode -

No alt text provided for this image

(B) Click on "Controller: SATA" & after this click on right "+" icon of "Controller: SATA" -

No alt text provided for this image

(C) Click On "Create" -

No alt text provided for this image

(D) Click on "Next" -

No alt text provided for this image

(E) Again "Next" -

No alt text provided for this image

(F) Choose your Hard Disk Size & Do "Create" -

In my case My Hard Disk size is 10 GiB

No alt text provided for this image

(G) Click on "DN_1.vdi" because in my case hard disk name is "DN_1.vdi" & and choose it -

No alt text provided for this image

(H) Now our Hard Disk is attached -

No alt text provided for this image

(I) To check hard disk is attached or not run "fdisk -l" command -

You will see "/dev/sdb : 10 GiB"

No alt text provided for this image

Step - 2 Create Partition In Add Device At DataNode -

* You can also refer this video for more understanding for this-

(A) Run "fdisk /dev/sdb" command -

"/dev/sdb" is name of added device in previous step.

No alt text provided for this image

(B) Run "n" to create new partition -

No alt text provided for this image

(C) Run "p" -

* Here I want to create Primary Partitions.

No alt text provided for this image

(D) Press "Enter" -

No alt text provided for this image

(E) Again press "Enter" -

No alt text provided for this image

(F) Give value of Last Sector -

* I want to create 2 GiB partition so that DataNode can only use 2 GiB for contribution in Hadoop Cluster.

No alt text provided for this image

(G) Run "w" to Save this Partition -

No alt text provided for this image

(H) Run "fdisk -l /dev/sdb" to check partition -

No alt text provided for this image

(I) Run "udevadm settle" to load Driver for Partition -

* Whenever New device is added in Computer then we have to load respectively driver so that we can communicate with that device.

No alt text provided for this image

Step - 3 Format & Mount Partition at DataNode -

* You can refer this video more understanding for this -

(A) Run this command to format "mkfs.ext4 /dev/sdb1" -

* In my case I am using "ext4" format type ,you can choose according to you.

No alt text provided for this image

(B) Create a Directory where you want to mount Partition -

* I will use this directory in Hadoop Cluster Distributed File Storage .

No alt text provided for this image

(C) Mount Partition at "/DataNode" Directory -

No alt text provided for this image

Step -4 Configure NameNode -

(A) Make a Directory "/nn" -

No alt text provided for this image

(B) "hdfs-site.xml" file configuration -

No alt text provided for this image

(C) "core-site.xml" file configuration -

No alt text provided for this image

(D) Format NameNode -

No alt text provided for this image

(E) Start NameNode -

No alt text provided for this image

Check with "jps" command NameNode is working or not.

(F) Stop Firewalld -

No alt text provided for this image

Step - 5 Configure DataNode -

(A) "hdfs-site.xml" file configuration -

No alt text provided for this image

(B) "core-site.xml" file configuration -

No alt text provided for this image

(C) Stop Firewalld -

No alt text provided for this image

(D) Start DataNode -

No alt text provided for this image

Check with "jps" command that DataNode is running or not.

Step -6 Check Contribution Of DataNode In Distributed File Storage of Hadoop Cluster -

* Run this command "hadoop dfsadmin -report"

No alt text provided for this image

You can see DataNode is contributing around 2 GiB . Thus we can set limitation of contribution of DataNode in Hadoop Cluster.

Thank you for giving you time to my article.

karthik kompella

Full stack Java | Cloud Computing | Ansible Automation | Python | Angular | React | C | C++ | Nextjs | NestJs | springboot | HTML | CSS | Javascript | Typescript | SQL | Devops enthusiastic

4 年

nice

回复

要查看或添加评论,请登录

Govind Bhardwaj的更多文章

社区洞察

其他会员也浏览了