Need tips on how to integrate Spark on a local Hadoop cluster

Hi.

I am an Engineering student and am currently working on a Big Data project. I am doing the project one of the Computer Labs in my College (5 PCs - 1 Master, 4 Slaves - Ubuntu 18.04 - Hadoop 2.7.7).

For the first part of the project, I successfully configured the Multinode cluster and carried out the required tasks (Analyzing a data set using a K-Nearest Neighbor Alogrithm in Java).

For this I used this blog as a reference. (Additionally, if you think this isn't an ideal configuration, I would love to get some tips and feedback so that my Hadoop cluster works better).

​

Now, I plan to carry out the same analysis but with Spark on the same Hadoop Cluster. I tried to follow this guide to set it up (Note: I used the appropriate spark version) and it kind of worked. Spark does seem to start but there are numerous errors.

I am a beginner with very basic knowledge in this. It took me about 2-3 weeks to fully understand, configure and run my Hadoop cluster.

I would really appreciate if you could:

  1. Help point out the issues with the resources I linked and how can I rectify them.
  2. If you have any better tutorials, blogs or guides that I can read/watch and understand this better please share the links.
  3. Am I even doing this right? I have had no actual courses on these topics in College and I am just doing this because the field of Big Data, Machine Learning, etc interest me.
  4. How does Cloudera,, Hortonworks etc actually work? I have full systems with ubuntu and not VMs and I have been unable to find a guide or blog that could help me setup either of those services for my cluster of 5 Computers. If these are any good, I would really appreciate it if you could explain it a little and/or link some blogs, guides or tutorials I could refer to.

I have been stuck on this for a few weeks now. Trying to figure out how to run it. Haven't had a lot of success. Any help would be really appreciated!

​

Thanks. :)

Posted Dec 9, 2018, 2:12 PM UTC · edited

211
abhimadav•

The steps in the attached link seem about right. Can you share the error you are running into for the spark job? Share the steps that you are using to execute the spark-job for better understanding and troubleshooting.

A good start to sanitise your setup (in context to spark on yarn) would be to open up a quick session of spark-shell and execute a small job. It could just read a simple local file and print the count of the records therein. This https://medium.com/@mrpowers/manually-creating-spark-dataframes-b14dae906393 could help?

2
vinit144OP•

I will try this out tomorrow when I go back to the lab. I will also share the error logs then since I don't have them on me right now.

Thank you for the link (and the quick response :) ), I will test that and see what happens. I will post the errors, results, etc tomorrow so that you can get a better picture of the issues.

1
vinit144OP•

Hey, I had to fix some issues with one of the nodes and also wait for the tests that we already had running.

This is what I get when I start the spark shell:

https://pastebin.com/F3MDNPjj

Is this fine?

1
abhimadav•

Looks like it isn't able to connect to HDFS. Is it a kerberos enabled cluster? Can you check if basic HDFS commands are working for you? What is the set value for fs.DefaulFs?

1
vinit144OP•

Hey, thanks for responding again.

I fixed it after going through the process all over again. It wasn't able to connect to hdfs because my Namenode is called 'master' but while setting up spark I used 'node-master' as that was the name in the Linode article and I'm an idiot :D

It's fixed now and I can submit jobs, but, there's one little (or giant issue) I have and I cannot find the solution.

In Hadoop, I used to pass the location of the output folder as an argument and the output could be found in HDFS.

In Spark, the "spark-logs" folder (in hdfs and even the web UI at master:18080) only has the logs. Can you tell me where I can find the solutions or how I can specify an output folder in my Spark App Code (written in Scala), or how I can pass a specific folder location in HDFS to the spark submit job to get the output there?

​

1
abhimadav•

Depends what code you are using for your example run. When you say, your spark app does not write to hdfs, what does it do then? Does it succeeds and you don't see any target or does it fail midstream or you simply don't know what's happening? Can you try providing complete file path while referencing hdfs location as hdfs:\path?

1
chumboy•
  1. How does Cloudera, Hortonworks, etc actually work? I have full systems with ubuntu and not VMs and I have been unable to find a guide or blog that could help me setup either of those services for my cluster of 5 Computers. If these are any good, I would really appreciate it if you could explain it a little and/or link some blogs, guides or tutorials I could refer to.

Cloudera and Hortonworks are 3rd party vendors, that provide assistance to companies in installing and maintaining Apache software stacks. They might sometimes customise or patch different software based on different companies requests (such as Cloudera's Cloudera Manager for managing clusters). They both provide "Quick start" VM images with working stacks to test different things out, but it's not that difficult to set things up yourself and it would probably be a much better learning experience to do so.

1
vinit144OP•

Thank you explaining this. I was kind of reluctant to try them out but they seem like they will save a lot of time.

I have been going through some of the documentation since last night and I've realized I've wasted a lot of time setting all the systems up. I will discuss it with my professor when I get to college in a couple of hours. Hopefully we can move to AWS or something similar with one of the Cloudera or Ambari and get back to working on the main aspects of the project.

​

1
dacort•

If you’re looking at AWS, be sure to check out EMR - it allows you to spin up a Hadoop cluster with Spark (or other Apache projects) at the click of a button. (Disclaimer: I work on EMR)

1
vinit144OP•

I am a student, so I might not be able to buy a lot of space, etc. How much does this cost you? I don't think I'll need a lot of space per machine (VM) given that my data set is pretty small but I do need numerous nodes. I will definitely check it out right now and read through whatever instructions I can find on their site.

1