Free CCA175 Exam Braindumps (page: 12)

Page 12 of 25

Problem Scenario 93 : You have to run your Spark application with locally 8 thread or locally on 8 cores. Replace XXX with correct values.
spark-submit --class com.hadoopexam.MyTask XXX \ -deploy-mode cluster SSPARK_HOME/lib/hadoopexam.jar 10

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution:
XXX: -master local[8]
Notes : The master URL passed to Spark can be in one of the following formats:
Master URL Meaning
local Run Spark locally with one worker thread (i.e. no parallelism at all}. local[K] Run Spark locally with K worker threads (ideally, set this to the number of cores on your machine).
local[*] Run Spark locally with as many worker threads as logical cores on your machine. spark://HOST:PORT Connect to the given Spark standalone cluster master. The port must be whichever one your master is configured to use, which is 7077 by default. mesos://HOST:PORT Connect to the given Mesos cluster. The port must be whichever one your is configured to use, which is 5050 by default. Or, for a Mesos cluster using ZooKeeper, use mesos://zk://.... To submit with --deploy-mode cluster, the HOST:PORT should be configured to connect to the MesosClusterDispatcher. yarn Connect to a YARN cluster in client or cluster mode depending on the value of - deploy-mode. The cluster location will be found based on the HADOOP CONF DIR or YARN CONF DIR variable.



Problem Scenario 50 : You have been given below code snippet (calculating an average score}, with intermediate output.
type ScoreCollector = (Int, Double)
type PersonScores = (String, (Int, Double))
val initialScores = Array(("Fred", 88.0), ("Fred", 95.0), ("Fred", 91.0), ("Wilma", 93.0), ("Wilma", 95.0), ("Wilma", 98.0))
val wilmaAndFredScores = sc.parallelize(initialScores).cache()
val scores = wilmaAndFredScores.combineByKey(createScoreCombiner, scoreCombiner, scoreMerger)
val averagingFunction = (personScore: PersonScores) => { val (name, (numberScores, totalScore)) = personScore (name, totalScore / numberScores)
}
val averageScores = scores.collectAsMap(}.map(averagingFunction)
Expected output: averageScores: scala.collection.Map[String,Double] = Map(Fred ->
91.33333333333333, Wilma -> 95.33333333333333)
Define all three required function , which are input for combineByKey method, e.g.
(createScoreCombiner, scoreCombiner, scoreMerger). And help us producing required
results.

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution :

val createScoreCombiner = (score: Double) => (1, score) val scoreCombiner = (collector: ScoreCollector, score: Double) => { val (numberScores. totalScore) = collector (numberScores + 1, totalScore + score) }
val scoreMerger= (collector-!: ScoreCollector, collector2: ScoreCollector) => { val (numScoresl. totalScorel) = collector! val (numScores2, tota!Score2) = collector (numScoresl + numScores2, totalScorel + totalScore2) }



Problem Scenario 76 : You have been given MySQL DB with following details.
user=retail_dba
password=cloudera
database=retail_db
table=retail_db.orders
table=retail_db.order_items
jdbc URL = jdbc:mysql://quickstart:3306/retail_db
Columns of order table : (orderid , order_date , ordercustomerid, order_status}
.....
Please accomplish following activities.

1. Copy "retail_db.orders" table to hdfs in a directory p91_orders.
2. Once data is copied to hdfs, using pyspark calculate the number of order for each status.
3. Use all the following methods to calculate the number of order for each status. (You
need to know all these functions and its behavior for real exam)

- countByKey()
-groupByKey()
- reduceByKey()
-aggregateByKey()
- combineByKey()

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution :
Step 1: Import Single table
sqoop import --connect jdbc:mysql://quickstart:3306/retail_db --username=retail dba - password=cloudera -table=orders --target-dir=p91_orders Note : Please check you dont have space between before or after '=' sign. Sqoop uses the MapReduce framework to copy data from RDBMS to hdfs
Step 2: Read the data from one of the partition, created using above command, hadoop fs -cat p91_orders/part-m-00000

Step 3: countByKey #Number of orders by status allOrders = sc.textFile("p91_orders")
#Generate key and value pairs (key is order status and vale as an empty string keyValue = aIIOrders.map(lambda line: (line.split(", ")[3], ""))
#Using countByKey, aggregate data based on status as a key output=keyValue.countByKey()Jtems()
for line in output: print(line)
Step 4: groupByKey
#Generate key and value pairs (key is order status and vale as an one keyValue = allOrders.map(lambda line: (line.split)", ")[3], 1))
#Using countByKey, aggregate data based on status as a key output= keyValue.groupByKey().map(lambda kv: (kv[0], sum(kv[1]}}} tor line in output.collect(): print(line}
Step 5: reduceByKey
#Generate key and value pairs (key is order status and vale as an one keyValue = allOrders.map(lambda line: (line.split(", "}[3], 1))
#Using countByKey, aggregate data based on status as a key output= keyValue.reduceByKey(lambda a, b: a + b)
tor line in output.collect(): print(line}

Step 6: aggregateByKey
#Generate key and value pairs (key is order status and vale as an one keyValue = allOrders.map(lambda line: (line.split(", ")[3], line}} output=keyValue.aggregateByKey(0, lambda a, b: a+1, lambda a, b: a+b} for line in output.collect(): print(line}
Step 7: combineByKey
#Generate key and value pairs (key is order status and vale as an one keyValue = allOrders.map(lambda line: (line.split(", ")[3], line)) output=keyValue.combineByKey(lambda value: 1, lambda ace, value: acc+1, lambda ace, value: acc+value)
tor line in output.collect(): print(line)
#Watch Spark Professional Training provided by www.ABCTECH.com to understand more on each above functions. (These are very important functions for real exam)



Problem Scenario 21 : You have been given log generating service as below.
startjogs (It will generate continuous logs)
tailjogs (You can check , what logs are being generated)
stopjogs (It will stop the log service)
Path where logs are generated using above service : /opt/gen_logs/logs/access.log
Now write a flume configuration file named flumel.conf , using that configuration file dumps logs in HDFS file system in a directory called flumel. Flume channel should have following property as well. After every 100 message it should be committed, use non-durable/faster channel and it should be able to hold maximum 1000 events

Solution :
Step 1: Create flume configuration file, with below configuration for source, sink and channel.
#Define source , sink , channel and agent,
agent1 .sources = source1
agent1 .sinks = sink1
agent1.channels = channel1
# Describe/configure source1
agent1 .sources.source1.type = exec
agent1.sources.source1.command = tail -F /opt/gen logs/logs/access.log
## Describe sinkl
agentl .sinks.sinkl.channel = memory-channel
agentl .sinks.sinkl .type = hdfs
agentl .sinks.sink1.hdfs.path = flumel
agentl .sinks.sinkl.hdfs.fileType = Data Stream
# Now we need to define channell property.
agent1.channels.channel1.type = memory
agent1.channels.channell.capacity = 1000
agent1.channels.channell.transactionCapacity = 100
# Bind the source and sink to the channel
agent1.sources.source1.channels = channel1
agent1.sinks.sink1.channel = channel1
Step 2: Run below command which will use this configuration file and append data in hdfs.
Start log service using : startjogs
Start flume service:
flume-ng agent -conf /home/cloudera/flumeconf -conf-file /home/cloudera/flumeconf/flumel.conf-Dflume.root.logger=DEBUG, INFO, console
Wait for few mins and than stop log service.
Stop_logs

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A



Page 12 of 25



Post your Comments and Discuss Cloudera CCA175 exam with other Community members:

Inbarajan commented on January 02, 2025
Very useful
Anonymous
upvote

Heidi commented on January 02, 2025
Good practice set
CANADA
upvote

IT commented on January 02, 2025
is the exams changed? tropics ??
UNITED STATES
upvote

Nari commented on January 02, 2025
Thanks for sharing the questions for practice exam
INDONESIA
upvote

Adesosun Saidi commented on January 02, 2025
Planning to write the test soon
UNITED ARAB EMIRATES
upvote

Edward M commented on January 02, 2025
really helpful
UNITED STATES
upvote

Chandra commented on January 02, 2025
Need to have a look at the other Questions too.
UNITED STATES
upvote

Prasad commented on January 02, 2025
Useful Data
UNITED STATES
upvote

Renjith Raj commented on December 31, 2024
very good questions
Anonymous
upvote

Sapna M commented on December 31, 2024
Very descriptive and easy to understand due to links provided.
INDIA
upvote

hvt commented on December 31, 2024
really useful and max free questions upto 27 at least
Anonymous
upvote

Ahmed Beshara commented on December 31, 2024
Explanation is very helpful
SAUDI ARABIA
upvote

Den commented on December 31, 2024
Usefull data
UNITED STATES
upvote

Abhishek commented on December 30, 2024
It's a useful deck
Anonymous
upvote

Ramba commented on December 30, 2024
is this valid?
EUROPEAN UNION
upvote

Sith commented on December 30, 2024
Anyone taken the exam recently?
CANADA
upvote

sith commented on December 30, 2024
Are these question still valid ? can someone please confirm?
CANADA
upvote

Frank Smith commented on December 30, 2024
Excellent material for exam preparation
COSTA RICA
upvote

Anonymous commented on December 30, 2024
thank you for sharing
Anonymous
upvote

NB commented on December 30, 2024
good support
Anonymous
upvote

Karanpeet Sachdeva commented on December 30, 2024
Preparing for exam
INDIA
upvote

Harshini commented on December 30, 2024
Good Practice
Anonymous
upvote

Uzman commented on December 30, 2024
great collection
Anonymous
upvote

Md Habibur Rahman commented on December 30, 2024
Very helpful
BANGLADESH
upvote

Kollur commented on December 29, 2024
Best questions for preparation
JAPAN
upvote

Kollur commented on December 29, 2024
Usefull data
JAPAN
upvote

dinesh commented on December 29, 2024
Useful data
AUSTRALIA
upvote

Max commented on December 29, 2024
You’re the best
Anonymous
upvote

Deepika Deshmukh commented on December 29, 2024
very helpful content it helps a lot
Anonymous
upvote

Criss commented on December 29, 2024
Very nice and very good questions
Anonymous
upvote

Real truth commented on December 29, 2024
this is crap
Anonymous
upvote

Md commented on December 29, 2024
Totally worth it!
Anonymous
upvote

Datahighway commented on December 29, 2024
nice very good Stuff
UNITED STATES
upvote

Mon88 commented on December 29, 2024
is this dumps still valid to take the exam
UNITED STATES
upvote