Author: cutting
Date: Fri Nov 10 13:15:31 2006
New Revision: 473487
URL: http://svn.apache.org/viewvc?view=rev&rev=473487
Log:
HADOOP-688. Move DFS administrative commands to a separate command named
'dfsadmin'. Contributed by Dhruba.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/bin/hadoop
lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=473487&r1=473486&r2=473487
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Nov 10 13:15:31 2006
@@ -44,6 +44,9 @@
13. HADOOP-611. Add support for iterator-based merging to
SequenceFile. (Devaraj Das via cutting)
+14. HADOOP-688. Move DFS administrative commands to a separate
+ command named 'dfsadmin'. (Dhruba Borthakur via cutting)
+
Release 0.8.0 - 2006-11-03
Modified: lucene/hadoop/trunk/bin/hadoop
URL:
http://svn.apache.org/viewvc/lucene/hadoop/trunk/bin/hadoop?view=diff&rev=473487&r1=473486&r2=473487
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop (original)
+++ lucene/hadoop/trunk/bin/hadoop Fri Nov 10 13:15:31 2006
@@ -28,7 +28,8 @@
echo " namenode -format format the DFS filesystem"
echo " namenode run the DFS namenode"
echo " datanode run a DFS datanode"
- echo " dfs run a DFS admin client"
+ echo " dfsadmin run a DFS admin client"
+ echo " dfs run a DFS user client"
echo " fsck run a DFS filesystem checking utility"
echo " jobtracker run the MapReduce job Tracker node"
echo " tasktracker run a MapReduce task Tracker node"
@@ -124,6 +125,8 @@
CLASS='org.apache.hadoop.dfs.DataNode'
elif [ "$COMMAND" = "dfs" ] ; then
CLASS=org.apache.hadoop.dfs.DFSShell
+elif [ "$COMMAND" = "dfsadmin" ] ; then
+ CLASS=org.apache.hadoop.dfs.DFSAdmin
elif [ "$COMMAND" = "fsck" ] ; then
CLASS=org.apache.hadoop.dfs.DFSck
elif [ "$COMMAND" = "jobtracker" ] ; then
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
URL:
http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java?view=diff&rev=473487&r1=473486&r2=473487
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java Fri Nov 10
13:15:31 2006
@@ -546,68 +546,6 @@
}
/**
- * Gives a report on how the FileSystem is doing
- */
- public void report() throws IOException {
- if (fs instanceof DistributedFileSystem) {
- DistributedFileSystem dfs = (DistributedFileSystem)fs;
- long raw = dfs.getRawCapacity();
- long rawUsed = dfs.getRawUsed();
- long used = dfs.getUsed();
- boolean mode = dfs.setSafeMode(
FSConstants.SafeModeAction.SAFEMODE_GET );
-
- if( mode )
- System.out.println("Safe mode is ON" );
- System.out.println("Total raw bytes: " + raw + " (" + byteDesc(raw) +
")");
- System.out.println("Used raw bytes: " + rawUsed + " (" +
byteDesc(rawUsed) + ")");
- System.out.println("% used: " + limitDecimal(((1.0 * rawUsed) / raw) *
100, 2) + "%");
- System.out.println();
- System.out.println("Total effective bytes: " + used + " (" +
byteDesc(used) + ")");
- System.out.println("Effective replication multiplier: " + (1.0 *
rawUsed / used));
-
-
System.out.println("-------------------------------------------------");
- DatanodeInfo info[] = dfs.getDataNodeStats();
- System.out.println("Datanodes available: " + info.length);
- System.out.println();
- for (int i = 0; i < info.length; i++) {
- System.out.println(info[i].getDatanodeReport());
- System.out.println();
- }
- }
- }
-
- /**
- * Safe mode maintenance command.
- *
- * Usage: java DFSShell -safemode [enter | leave | get]
- */
- public void setSafeMode( String argv[], int idx ) throws IOException {
- final String safeModeUsage = "Usage: java DFSShell -safemode [enter |
leave | get]";
- if( ! (fs instanceof DistributedFileSystem) ) {
- System.out.println( "FileSystem is " + fs.getName() );
- return;
- }
- if( idx != argv.length-1 ) {
- printUsage("-safemode");
- return;
- }
- FSConstants.SafeModeAction action;
- if( "leave".equalsIgnoreCase(argv[idx]) )
- action = FSConstants.SafeModeAction.SAFEMODE_LEAVE;
- else if( "enter".equalsIgnoreCase(argv[idx]) )
- action = FSConstants.SafeModeAction.SAFEMODE_ENTER;
- else if( "get".equalsIgnoreCase(argv[idx]) )
- action = FSConstants.SafeModeAction.SAFEMODE_GET;
- else {
- printUsage("-safemode");
- return;
- }
- DistributedFileSystem dfs = (DistributedFileSystem)fs;
- boolean mode = dfs.setSafeMode( action );
- System.out.println( "Safe mode is " + ( mode ? "ON" : "OFF" ));
- }
-
- /**
* Apply operation specified by 'cmd' on all parameters
* starting from argv[startindex].
*/
@@ -701,15 +639,9 @@
} else if ("-get".equals(cmd)) {
System.err.println("Usage: java DFSShell" +
" [" + cmd + " <src> <localdst> [addnl]]");
- } else if ("-report".equals(cmd)) {
- System.err.println("Usage: java DFSShell" +
- " [report]");
} else if ("-setrep".equals(cmd)) {
System.err.println("Usage: java DFSShell" +
" [-setrep [-R] <rep> <path/file>]");
- } else if ("-safemode".equals(cmd)) {
- System.err.println("Usage: java DFSShell" +
- " [-safemode enter | leave | get]");
} else {
System.err.println("Usage: java DFSShell");
System.err.println(" [-fs <local | namenode:port>]");
@@ -731,9 +663,7 @@
System.err.println(" [-copyToLocal <src> <localdst>]");
System.err.println(" [-moveToLocal <src> <localdst>]");
System.err.println(" [-mkdir <path>]");
- System.err.println(" [-report]");
System.err.println(" [-setrep [-R] <rep> <path/file>]");
- System.err.println(" [-safemode enter | leave | get]");
}
}
@@ -761,16 +691,6 @@
printUsage(cmd);
return exitCode;
}
- } else if ("-safemode".equals(cmd)) {
- if (argv.length != 2) {
- printUsage(cmd);
- return exitCode;
- }
- } else if ( "-report".equals(cmd)) {
- if (argv.length != 1) {
- printUsage(cmd);
- return exitCode;
- }
} else if ("-mv".equals(cmd) || "-cp".equals(cmd)) {
if (argv.length < 3) {
printUsage(cmd);
@@ -843,10 +763,6 @@
}
} else if ("-mkdir".equals(cmd)) {
doall(cmd, argv, conf, i);
- } else if ("-report".equals(cmd)) {
- report();
- } else if ("-safemode".equals(cmd)) {
- setSafeMode(argv,i);
} else {
exitCode = -1;
System.err.println(cmd.substring(1) + ": Unknown command");