Browse Source

HADOOP-688. Move DFS administrative commands to a separate command named 'dfsadmin'. Contributed by Dhruba.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@473487 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
6ed340979e
3 changed files with 7 additions and 85 deletions
  1. 3 0
      CHANGES.txt
  2. 4 1
      bin/hadoop
  3. 0 84
      src/java/org/apache/hadoop/dfs/DFSShell.java

+ 3 - 0
CHANGES.txt

@@ -44,6 +44,9 @@ Trunk (unreleased changes)
 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
 

+ 4 - 1
bin/hadoop

@@ -28,7 +28,8 @@ if [ $# = 0 ]; then
   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 @@ elif [ "$COMMAND" = "datanode" ] ; then
   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

+ 0 - 84
src/java/org/apache/hadoop/dfs/DFSShell.java

@@ -545,68 +545,6 @@ public class DFSShell extends ToolBase {
         return strVal;
     }
 
-    /**
-     * 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 @@ public class DFSShell extends ToolBase {
           } 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 @@ public class DFSShell extends ToolBase {
             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 @@ public class DFSShell extends ToolBase {
                   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 @@ public class DFSShell extends ToolBase {
                 }
             } 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");