Skip to content

Instantly share code, notes, and snippets.

View sujee's full-sized avatar

Sujee Maniyam sujee

View GitHub Profile
@sujee
sujee / mapred-site.xml
Created January 22, 2014 00:23
hadoop2 mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
@sujee
sujee / yarn-site.xml
Created January 22, 2014 00:08
hadoop2 yarn-site.xml
<?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>
@sujee
sujee / hdfs-site.xml
Created January 21, 2014 21:47
hadoop 2 single node : hdfs-site.xml
<?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>
@sujee
sujee / core-site.xml
Last active January 4, 2016 01:19
hadoop2 core-site.xml
<?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>
@sujee
sujee / pom.xml
Last active December 31, 2015 01:49
maven pom.xml for Hadoop / HBase dependencies
<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 -->
@sujee
sujee / gist:1997870
Created March 8, 2012 01:33
hadoop-dns : modify /etc/hosts
#!/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
@sujee
sujee / gist:1997859
Created March 8, 2012 01:30
hadoop-dns : backup /etc/hosts
#!/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
@sujee
sujee / gist:1174761
Created August 27, 2011 00:21
HBase utilities : Bytes.add
// ---------- 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));
@sujee
sujee / gist:1174701
Created August 26, 2011 23:38
HBase utilities : Bytes.toBytes
// -------- 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";
@sujee
sujee / gist:1169743
Created August 25, 2011 01:23
hadoop utilities : Cluster Status
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;