This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<configuration> | |
<property> | |
<name>mapreduce.framework.name</name> | |
<value>yarn</value> | |
</property> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<property> | |
<name>yarn.resourcemanager.hostname</name> | |
<value>localhost</value> | |
</property> | |
<property> | |
<name>yarn.nodemanager.aux-services</name> | |
<value>mapreduce_shuffle</value> | |
</property> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<configuration> | |
<property> | |
<name>dfs.replication</name> | |
<value>1</value> | |
<description>single node, 1 copy</description> | |
</property> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | |
<configuration> | |
<property> | |
<name>fs.defaultFS</name> | |
<value>hdfs://localhost:8020</value> | |
<description> | |
this replaces Hadoop 1 property : fs.default.name | |
</description> | |
</property> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>mygroup</groupId> <!-- change this --> | |
<artifactId>project_name</artifactId> <!-- change this --> | |
<packaging>jar</packaging> | |
<version>1.0</version> | |
<name>Sample Project Name</name> <!-- change this --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hosts=$(cat $HADOOP_HOME/conf/slaves | grep -v '#') | |
for host in $hosts | |
do | |
echo "------------------" $host "------------" | |
scp -o StrictHostKeyChecking=no hadoop_hosts $host: | |
ssh -o StrictHostKeyChecking=no root@$host "cat /etc/hosts.orig hadoop_hosts >> /etc/hosts" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
hosts=$(cat $HADOOP_HOME/conf/slaves | grep -v '#') | |
for host in $hosts | |
do | |
echo "------------------" $host "------------" | |
ssh -o StrictHostKeyChecking=no root@$host "cp /etc/hosts /etc/hosts.orig" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------- Bytes.add() : creating composite keys --------- | |
// rowkey = int + long | |
int i = 0; | |
long timestamp = System.currentTimeMillis(); | |
byte [] rowkey2 = Bytes.add(Bytes.toBytes(i), Bytes.toBytes(timestamp)); | |
System.out.println ("rowkey2 (" + rowkey2.length + ") : " + Arrays.toString(rowkey2)); | |
// add also supports adding 3 byte arrays | |
// rowkey = int + str + long | |
byte[] rowkey3 = Bytes.add(Bytes.toBytes(0) , Bytes.toBytes("hello"), Bytes.toBytes(timestamp)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------- Bytes.toBytes() : converting objects to bytes ------ | |
int i = 10000; | |
byte [] intBytes = Bytes.toBytes(i); | |
System.out.println ("int " + i + " in bytes : " + Arrays.toString(intBytes)); | |
float f = (float) 999.993; | |
byte [] floatBytes = Bytes.toBytes(f); | |
System.out.println ("float " + f + " in bytes : " + Arrays.toString(floatBytes)); | |
String s = "foobar"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sujee; | |
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.conf.Configured; | |
import org.apache.hadoop.mapred.ClusterStatus; | |
import org.apache.hadoop.mapred.JobClient; | |
import org.apache.hadoop.mapred.JobConf; | |
import org.apache.hadoop.util.Tool; | |
import org.apache.hadoop.util.ToolRunner; |