1 To 8
1 To 8
Aim:
Procedure:
1. Prepare two input matrices in HDFS with the format: <MatrixName, Row, Column, Value>.
3. Write a Reducer to calculate partial products and sum them up for final results.
Program:
import java.io.IOException;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
public void map(LongWritable key, Text value, Context context) throws IOException,
InterruptedException {
if (matrix.equals("A")) {
} else {
}
}
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException,
InterruptedException {
if (elements[0].equals("A")) {
A[Integer.parseInt(elements[1])] = Double.parseDouble(elements[2]);
} else {
B[Integer.parseInt(elements[1])] = Double.parseDouble(elements[2]);
double sum = 0;
for (int i = 0; i < 10; i++) {
Output:
The output will be the resultant matrix stored in the HDFS directory.
Result:
Aim:
To execute Hive commands for importing, distributing, sorting, clustering, and exporting data.
Procedure:
2. Execute commands step by step for importing, distributing, sorting, clustering, and exporting.
1. IMPORT:
2. DISTRIBUTE BY:
3. EXPORT:
4. SORT BY:
5. CLUSTER BY:
Result:
Aim:
Procedure:
1. Use the Hadoop file system commands to create directories, add files, and list their contents.
Commands:
# Delete a file
Output:
1. Directory created.
2. File uploaded.
3. Contents listed.
4. File deleted.
Result:
Aim:
Procedure:
Program:
word.set(w);
context.write(word, one);
public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException,
InterruptedException {
int sum = 0;
sum += val.get();
}
}
Output:
The output is a list of words with their respective counts stored in HDFS.
Result:
Aim:
Procedure:
Commands:
wget https://archive.apache.org/dist/hbase/X.X.X/hbase-X.X.X-bin.tar.gz
cd hbase-X.X.X
# Start HBase
bin/start-hbase.sh
Output:
Result:
Aim:
Procedure:
Commands:
1. Create Table:
2. Insert Data:
put 'customer', '1', 'info:name', 'John'
3. Get Data:
4. Delete Data:
Output:
Commands successfully create, update, retrieve, and delete data in the HBase table.
Result:
Aim:
Program:
Similar to word count, but split the input into characters instead of words.
Aim:
Procedure:
1. INSERT:
2. SELECT:
3. DELETE: