Skip to content

Commit

Permalink
- added readme
Browse files Browse the repository at this point in the history
- reverse hostname compare
  • Loading branch information
sujee committed Feb 10, 2012
1 parent eca68ca commit 63c2b52
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
29 changes: 29 additions & 0 deletions README.txt
@@ -0,0 +1,29 @@
Hadoop is picky about DNS (and reverse DNS!)
Every node in the cluster has to have DNS working properly.

This script checks DNS and reverse DNS for hosts given. Hosts are specified in a file, on a line by line basis.

What is needed:
- Java (JDK 1.6) : which you will have installed in a Hadoop cluster anyway
- rsync (to distribute files to remote machines)
- SSH (and password less SSH setup between hosts)

Compile the source files first:
./compile.sh
this will create a file 'a.jar'. This jar will be used by run scripts

the script 'run.sh' runs the checks on the current host:
./run.sh hosts_file

'run-on-cluster.sh' runs the tests on all machines specified in hosts file
- it uses SSH to login to remote hosts and run the tests. So it is handy to have password-less SSH configured.
In a typical Hadoop cluster, 'master' host is setup to have password-less SSH to all slaves. So this script can be run from master server

- it logs into each host and runs the DNS test

./run-on-cluster.sh hosts_file

Happy Hadooping!

Sujee Maniyam
s@sujee.net
7 changes: 2 additions & 5 deletions hosts1
@@ -1,5 +1,2 @@
c2107.pcs.hds.com
c2108.pcs.hds.com
c2109.pcs.hds.com
smbuild.pcs.hds.com
10.1.1.2
host1
host2
14 changes: 10 additions & 4 deletions src/net/sujee/hadoop/CheckDNS.java
Expand Up @@ -8,12 +8,15 @@
import java.util.ArrayList;
import java.util.List;

/**
* check dns and reverse dns of hosts in a given file
*
* @author sujee@sujee.net
*
*/
public class CheckDNS
{

/**
* @param args
*/
public static void main(String[] args) throws Exception
{
if (args.length < 1)
Expand Down Expand Up @@ -50,7 +53,10 @@ public static void main(String[] args) throws Exception
{
InetAddress revHost = InetAddress.getByAddress(inet.getAddress());
String revHostName = revHost.getHostName();
System.out.println (" reverse lookup : success (" + revHostName + ")");
if (host.equals(revHostName))
System.out.println (" reverse lookup : success (" + revHostName + ")");
else
System.out.println (" reverse lookup : ***failed*** (" + revHostName + " != " + host + " (expected) )");
}
catch (UnknownHostException e)
{
Expand Down

0 comments on commit 63c2b52

Please sign in to comment.